[英]How do I use a specific edition of Rust?
我知道目前有两个版本的Rust( 2015
和2018
),我怎么能告诉cargo
和rustc
哪个我想用?
You can add the following to your Cargo.toml
, it's documented on the edition 2018 guide : 您可以将以下内容添加到Cargo.toml
,它记录在2018年版指南中 :
[package]
edition = "2018"
If you directly use rustc
you can use rustc --edition 2018
, it's documented with rustc --help -v
command. 如果你直接使用rustc
你可以使用rustc --edition 2018
,它与rustc --help -v
命令一起记录。
--edition 2015|2018
Specify which edition of the compiler to use when
compiling code.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.