如何使用特定版本的 Rust? [英] How do I use a specific edition of Rust?

查看:78
本文介绍了如何使用特定版本的 Rust?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道目前有两个版本的 Rust(20152018),我怎么知道 cargorustc 我想用哪一个?

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?

推荐答案

您可以将以下内容添加到您的 Cargo.toml,它记录在 2018 版指南:

You can add the following to your Cargo.toml, it's documented on the edition 2018 guide:

[package]
edition = "2018"

<小时>

如果你直接使用 rustc 你可以使用 rustc --edition 2018,它用 rustc --help -v 命令记录.


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.

这篇关于如何使用特定版本的 Rust?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆