Skip to content
This repository has been archived by the owner on May 5, 2019. It is now read-only.

Commit

Permalink
Add the feature to every example & cargo +nightly
Browse files Browse the repository at this point in the history
When I was trying the new edition, I found that I needed to add the Rust feature declaration to every example in addition to the lib.rs file and main.rs file. I also need to use `cargo +nightly fix` in order to run the commands.

This PR adds that to the edition guide.
  • Loading branch information
sunjay committed Aug 16, 2018
1 parent 86d7f4c commit 399f504
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/editions/transitioning-your-code-to-a-new-edition.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ manually!
Before an edition is released, it will have a "preview" phase which lets you
try out the new edition in nightly Rust before its release. Currently Rust 2018
is in its preview phase and because of this, there's an extra step you need to
take to opt in. Add this feature flag to your `lib.rs` or `main.rs`:
take to opt in. Add this feature flag to your `lib.rs` or `main.rs` as well as
to any examples in the `examples` directory of your project if you have one:

```rust
#![feature(rust_2018_preview)]
Expand Down Expand Up @@ -67,6 +68,13 @@ picture. To enable the compatibility lints for your project you run:
$ cargo fix --edition
```

If the nightly toolchain is not your default, you may need to run this command
instead:

```shell
$ cargo +nightly fix --edition
```

This will instruct Cargo to compile all targets in your project (libraries,
binaries, tests, etc.) while enabling all Cargo features and prepare them for
the 2018 edition. Cargo will likely automatically fix a number of files,
Expand Down

0 comments on commit 399f504

Please sign in to comment.