Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用特定版本的Rust?_Rust_Rust Cargo - Fatal编程技术网

如何使用特定版本的Rust?

如何使用特定版本的Rust?,rust,rust-cargo,Rust,Rust Cargo,我知道Rust目前有两个版本(2015和2018),我怎么才能知道cargo和rustc我想用哪一个呢?你可以将以下内容添加到你的cargo.toml,它记录在: 如果您直接使用rustc您可以使用rustc--edition 2018,它是通过rustc--help-v命令记录的 ——2015年版| 2018年 指定在运行时要使用的编译器版本 编译代码。 另请参见:当前,如果未在Cargo.toml中设置edition,则默认设置为2015。 [package] edition = "201

我知道Rust目前有两个版本(
2015
2018
),我怎么才能知道
cargo
rustc
我想用哪一个呢?

你可以将以下内容添加到你的
cargo.toml
,它记录在:


如果您直接使用
rustc
您可以使用
rustc--edition 2018
,它是通过
rustc--help-v
命令记录的

——2015年版| 2018年
指定在运行时要使用的编译器版本
编译代码。

另请参见:当前,如果未在
Cargo.toml
中设置
edition
,则默认设置为
2015
[package]
edition = "2018"