What is the stabilization process?

后端 未结 2 1886
执笔经年
执笔经年 2020-12-17 21:49

What is the stabilization process? Reading the release notes I see a lot of different standard library APIs and even language features (e.g. underscore lifetimes). How does

2条回答
  •  误落风尘
    2020-12-17 22:44

    Rust favors an agile approach to introducing features and APIs, in order to iterate on them based on feedback1.

    However, iterating over the design of features or APIs is at odds with Rust strong commitment to backward compatibility (aka stability). Therefore, the Stabilization Process was designed to resolve this apparent conundrum:

    • any non-trivial feature or API addition is first unstable, and hidden behind a feature gate,
    • to use such a feature, the user must opt-in using #![feature] in their crate,
    • it is only possible to opt-in on the nightly release channel, and impossible on the beta or stable release channels.

    This way, enthusiasts can use nightly to experiment with the feature, and provide feedback to polish it, while any other user can use any feature available and be confident they will not accidentally use an unstable one.

    Once a feature is judged ready, the final step is to have the team in charge approve it; the feature gate is then removed and the feature becomes available on all channels (though it takes some time to propagate from nightly to stable, of course).

    1 A famous example of specification failure was the "export template" functionality of C++98; it was only ever implemented in the EDG front-end and this sole feature took over a year. Since then, the C++ committee generally requires prototype implementations.

提交回复
热议问题