| Software | Version(s) |
| Rust | 1.30.1 |
| Form Factor | Desktop |
| Browser Type | Chrome |
| Browser Version | 70.0.3538.110 |
I'm going to say HTML.
If i correctly followed (or copy/pasted) the code example under the heading "A Small Rust Application" then i should be able to compile and run the sample program.
Compiling the sample code results in:
error[E0432]: unresolved import `ferris_says`
--> src/main.rs:1:5
|
1 | use ferris_says::say; // from the previous step
| ^^^^^^^^^^^ Maybe a missing `extern crate ferris_says;`?
error: aborting due to previous error
Follow the instructions on the /learn/get-started page through the "A Small Rust Application" section.
This is due to your version of Rust. Rust 1.31 introduced a new concept called “Editions,” explained in detail here. The basic gist of it is that Rust 2018 Edition introduces a number of breaking changes that are not available in the Rust 2015 Edition. As Rust 2018 is completely opt-in, and is a new feature as of Rust 1.31, any crate created with Rust 1.30.x and earlier will default to Rust 2015. In Rust 2015, an extern crate ferris_sys is needed in main.rs; in Rust 2018, it isn’t. Rust versions are specified in Cargo.toml by inserting edition = “year” under the [package] header.
TLDR: Two ways of solving the problem:
edition = “2018” under the authors line of Cargo.tomlextern crate ferris_sys at the top of main.rsSomething concisely explaining this might be useful at the bottom of the learn/get-started page.
My point was that a new user, following the instructions on the page, will be left with code that does not compile. That seems like a poor initial experience for potential rustaceans.
That makes more sense. Sorry. And I completely agree.
My point was that a new user, following the instructions on the page, will be left with code that does not compile. That seems like a poor initial experience for potential rustaceans.
It wlll work if they are using the current stable version of Rust.
I went through the example again and it does indeed now compile and run just fine. Thanks.
- Cargo.toml
where is the path of Cargo.toml?
Most helpful comment
My point was that a new user, following the instructions on the page, will be left with code that does not compile. That seems like a poor initial experience for potential rustaceans.