rust-lang / rust-lang/rust-by-example

Function - diverging example code does not compile at all on stable release channel

Open
#1,633 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Handlebars
Stars
8.1k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

Link to page: https://doc.rust-lang.org/stable/rust-by-example/fn/diverging.html

Code in question:

#![feature(never_type)]

fn main() {
    let x: ! = panic!("This call never returns.");
    println!("You will never see this line!");
}

This results in the following error:

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> src/main.rs:1:1
  |
1 | #![feature(never_type)]
  | ^^^^^^^^^^^^^^^^^^^^^^^

I'm guessing this example was written before this limitation was introduced (or feature flag removed) from the stable channel? Or is it not meant to compile at all? Should it be removed?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open the stable Rust by Example page at fn/diverging.html and run the displayed snippet on the stable release channel. Check the never_type feature requirement and determine whether the example should be revised or removed; done means the page no longer presents code that fails to compile on stable.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
Half a day
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.