How do I use a specific edition of Rust?

淺唱寂寞╮ 提交于 2020-01-11 09:17:09

问题


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?


回答1:


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.


来源:https://stackoverflow.com/questions/55504416/how-do-i-use-a-specific-edition-of-rust

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!