问题描述
谁能向我解释一下 Rust 每晚的生产"情况?
我想使用使用 PyO3 板条箱的 PyO3 板条箱https://github.com/rust-lang/rust/issues/31844" rel="nofollow noreferrer">专业化 需要夜间 Rust 的功能.
使用 Rust 的每晚版本是否已做好生产准备?我知道未来版本可能会出现问题,并且可能会引入 API 更改,但就质量/测试/生产准备情况而言,夜间安全吗?
来自 这个关于 Rust 用户的帖子似乎我应该没问题,只要我限制我的非稳定功能的使用(例如,仅限于专业化)?
显然,nightly 没有稳定性保证,这使得这个问题与 乔治伯克利一次.
但是,nightly 编译器非常稳定:对 master 分支(从 nightly 中拉出)的每一次更改,即使是最普通的更改,都需要通过 CI,该 CI 执行完整的测试套件,并且必须通过.如果更改破坏了以前工作的内容,则 master 上没有我们将在稍后修复此问题".其次,大的变化——比如最近对 std::collections
和 std::sync
的变化——通过 crater-runs,其中相当一部分公开可用的 Rust 代码是建成;如果 PR 会破坏以前没有破坏过的东西,它就不会在 nightly 中着陆. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .最后但并非最不重要的是,许多 Rust 项目在每晚使用预定的 CI,其中手头的项目及其依赖项每月构建和测试一次.像 rocket
这样的项目一直在每晚运行,如果每晚引入回归或错误,它会很快被注意到.所有这一切意味着您的每晚突然脱落的可能性很小>
不过,对于需要夜间运行的不稳定功能,情况有所不同.语义可以改变,曾经运行过的代码可能会或多或少突然无法编译;然而,更改通常不太可能导致静默失败、先前定义的行为变为未定义等.
因此,一个常见的策略是选择特定版本的 nightly(比如2019-05-09")并坚持使用该版本一段时间.
插件:我的目的是要明确每晚能否可靠地编译东西?"之间的区别.以及nightly 编译的东西可靠吗?"我对两者都提出了强有力的论据,重点是第二点:1) 是的,大多数时候 nightly 将能够编译您的代码.2) 由于行为的细微变化或完全错误编译,每晚编译的东西不可靠的可能性极小.
Can someone explain to me how "production" Rust nightly is?
I want to use the PyO3 crate which uses the specialization feature that needs nightly Rust.
Does using a nightly version of Rust is production ready? I understand that things might break in future releases and API changes might be introduced but in terms of quality/testing/production readiness is nightly safe?
From this thread on Rust users it seems I should be fine as long as I limit my non-stable features usage (e.g. only to specialization)?
Obviously, there are no stability guarantees on nightly, which makes this question a duplicate of the one asked by George Berkeley once.
However, the nightly compiler is very stable: Every single, even the most mundane, change to the master branch (from which nightly is pulled) goes through CI, which executes the full test suite, which has to pass. There is no "we will fix this later" on master if the change breaks things that worked before.Secondly, big changes - like the recent changes to std::collections
and std::sync
- go through crater-runs where a decent portion of the publicly available Rust code is built; if the PR would break things that weren't broken before, it does not land in nightly. Last but not least many rust projects use scheduled CI on nightly, where the project at hand and it's dependencies are built and tested once a month. Projects like rocket
run on nightly all the time and if a regression or a bug is introduced in nightly, it is noticed very quickly. All of this means that it is highly unlikely that your front suddenly falls off on nightly
Things are different for the unstable features that require nightly, though. The semantics can change, and code that once worked may fail to compile more or less suddenly; it is usually highly unlikely, however, that changes will cause silent failures, previously defined behavior to become undefined and the like.
A common strategy, therefore, is to pick a specific version of nightly (let's say "2019-05-09") and stick with that version for a whole while.
Addon: My intention was to make clear that there is a difference between "can nightly compile things reliably?" and "are the things compiled by nightly reliable?" I'd make a strong argument for both, with the emphasis on the second point: 1) Yes, most of the time nightly will be able to compile your code. 2) It is extremely unlikely that things compiled by nightly are unreliable due to subtle changes in behavior or outright miscompilations.
这篇关于在生产中每晚使用 Rust的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!