且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

有没有办法在稳定版或测试版的编译器版本上获得不稳定的功能?

更新时间:2022-10-22 09:24:57

你不能(简单地)编译任何稳定版本的 Rust 来使用不稳定的特性.您也不能下载稳定版本,就好像它不稳定一样.然而,Rust 的下载有一组

我可以弄清楚当前 Beta 版在技术上是哪一天是 Nightly.现在,假设之前的 Nightly 和 Beta 版本 1.6 之间没有重大错误修复,我转到文件夹(在本例中为 2015 年 12 月 9 日)并从列表中下载了相应的 Nightly 安装程序.

有些文件夹可以追溯到 2014 年 11 月 7 日,因此如果您需要过去特定版本的 Rust 来编译您的代码,您很可能会在那里找到它.

I'm in a bit of a bind right now. My personal code relies on rand, which is currently not compiling on Nightly 1.7, but does work on Beta 1.6 and stable.

However, my work also uses unstable features such as box syntax/patterns/raw and convert in a way that can't (easily) be refactored out. Is there any way, including by compiling from source, to get Rust 1.6 "as if" it were a nightly? I'm on Windows (10)/MSYS 2 if that complicates things any, such as building the source.

You cannot (trivially) compile any stable version of Rust to use unstable features. Nor can you download the stable version as if it were unstable. However, Rust's downloads has a set of archives.

By checking when the most recent release happened:

I could figure out what day the current Beta was technically a Nightly. Now, presuming there wasn't a major bugfix between the previous Nightly and Beta releases of 1.6, I went to the folder (in this case, December 9, 2015) and downloaded the corresponding Nightly installer from the list.

There are folders going back to 2014-11-07, so if you need a specific version of Rust from the past to compile your code, you can likely find it there.