I know there are currently two editions of Rust (2015
and 2018
), how can I tell cargo
and rustc
which one I want to use?
Asked
Active
Viewed 328 times
4

Shepmaster
- 388,571
- 95
- 1,107
- 1,366

Stargateur
- 24,473
- 8
- 65
- 91
-
See also: [Rust error: borrow occurs after drop a mutable borrow](https://stackoverflow.com/a/55285391/493729) – Peter Hall Apr 03 '19 at 23:43
1 Answers
4
You can add the following to your Cargo.toml
, it's documented on the edition 2018 guide:
[package]
edition = "2018"
If you directly use rustc
you can use rustc --edition 2018
, it's documented with rustc --help -v
command.
--edition 2015|2018
Specify which edition of the compiler to use when
compiling code.

Stargateur
- 24,473
- 8
- 65
- 91
-
Currently, if `edition` is not set in `Cargo.toml`, it will default to `2015`. – so61pi Apr 04 '19 at 16:03