- Feature Name: N/A
- Start Date: 2016-04-22
- RFC PR: rust-lang/rfcs#1589
- Rust Issue: N/A
Summary
Defines
Motivation
From time to time, we encounter
One of the key points of this policy is that (a) warnings should be issued initially rather than hard errors if at all possible and (b) every change that causes existing code to stop compiling will have an associated tracking issue. This issue provides
What qualifies修飾する as a bug fix?
Note that this RFC does not try to define
- Soundness changes: Fixes to holes uncovered in the type system.
- Compiler bugs: Places where the compiler is not implementing the specified特定する、指定する、規定するsemantics found in an RFC or lang-team decision.
- Underspecified language言語semantics: Clarifications to grey areas where the compiler behaves振る舞うinconsistently and no formal behaviorふるまいhad been previously decided.
Please see the RFC for full details!
Detailed design設計(する)
The procedure for making a breaking change is as follows
- Do a crater run to assess the impact of the change.
- Make a special tracking issue dedicated to the change.
- Do not report an error right away. Instead, issue forwards-compatibility lint warnings.
- Sometimes this is not straightforward. See the text below for suggestions on different techniques we have employed in the past.
- For cases where warnings are infeasible:
- Report errors, but make every effort to give a targeted error message that directs users to the tracking issue
- Submit PRs to all known affected crates that fix the issue
- or, at minimum,最小のalert the owners of those crates to the problem and direct them to the tracking issue
- or, at minimum,
- Once the change has been in the wild for at least one cycle, we can stabilize the change, converting変換するthose warnings into errors.
Finally, for changes to libsyntax that will affect plugins, the general
Tracking issue
Every breaking change should be accompanied by a dedicated tracking issue for that change. The main text of this issue should describe the change being made, with a focus on what users must do to fix their code. The issue should be approachable and practical; it may make sense to direct users to an RFC or some other issue for the full details. The issue also serves
A template for these breaking-change tracking issues can be found below. An example of how such an issue should look can be found here.
The issue should be tagged with (at least) B-unstable
and T-compiler
.
Tracking issue template
What follows
This is the summary issue for the YOUR_LINT_NAME_HERE
future-compatibility warning and other related errors. The goal of this page is describe why this change was made and how you can fix code that is affected by it. It also provides
What is the warning for?
Describe the conditions
When will this warning become a hard error?
At the beginning of each 6-week release cycle, the Rust compiler team will review the set
Issuing future compatibility互換性 warnings
The best way to handle a breaking change is to begin by issuing future-compatibility warnings. These are a special category of lint warning. Adding
Helpful techniques
It can often be challenging to filter out new warnings from older, pre-existing errors. One technique that has been used in the past is to run the older code unchanged and collect the errors it would have reported. You can then issue warnings for any errors you would give which do not appear
Crater and crates.io
We should always do a crater run to assess impact. It is polite and considerate to at least notify the authors of affected crates the breaking change. If we can submit PRs to fix the problem, so much the better.
Is it ever acceptable to go directly直接 to issuing errors?
Changes that are believed to have negligible impact can go directlycrates.io
: if fewer than 10 total affected projects are found (not root errors), we can move straight to an error. In such cases, we should still make the "breaking change" page as before, and we should ensure
If the impact is not believed to be negligible (e.g., more than 10 crates are affected), then warnings are required (unless the compiler team agrees to grant a special exemption in some particular case). If implementing warnings is not feasible, then we should make an aggressive strategy of migrating crates before we land the change so as to lower
- Issue warnings for subparts of the problem, and reserve the new errors for the smallest setセットする、集合of cases you can.
- Try to give a very precise error message that suggests how to fix the problem and directs users to the tracking issue.
- It may also make sense to layer the fix:
- First, add warnings where possible and let those land before proceeding進むto issue errors.
- Work with authors of affected crates to ensure保証するthat corrected versions are available before the fix lands, so that downstream users can use them.
- First, add warnings where possible and let those land before proceeding
Stabilization
After a change is made, we will stabilize the change using the same process that we use for unstable features:
- After a new release is made, we will go through the outstanding tracking issues corresponding照応するto breaking changes and nominate some of them for final comment period (FCP).
- The FCP for such issues lasts for one cycle. In the final week or two of the cycle, we will review comments and make a final determination:
- Convert変換するto error: the change should be made into a hard error.
- Revert: we should remove the warning and continue to allow許可する、可能にするthe older code to compile.
- Defer: can't decide yet, wait longer, or try other strategies.
- Convert
Ideally, breaking changes should have landed on the stable branch
Batching breaking changes to libsyntax
Due to the lack of stable plugins, making changes to libsyntax can currently be quite disruptive to the ecosystem that relies on plugins. In an effort to ease this pain, we generally try to batch up such changes so that they occur
cc #31645 @Manishearth
to the PR and avoid
Drawbacks
Following
Alternatives代わりのもの、選択肢
There are obviously many points that we could tweak in this policy:
- Eliminate the tracking issue.
- Change the stabilization schedule.
Two other obvious (and rather extreme) alternatives
- Not having a policy at all (as is the case today) encourages inconsistent treatment of issues.
- Not making any sorts of breaking changes would mean that Rust simply has to stop evolving, or else would issue new major versions quite frequently, causing undue disruption.
Unresolved questions
N/A