Skip to content

Commit 7d67f88

Browse files
Adjustments to be more of a release blog post
Just a first draft, need to re-read and adjust the structure a little still.
1 parent 5fad60a commit 7d67f88

File tree

1 file changed

+76
-20
lines changed

1 file changed

+76
-20
lines changed

posts/2021-05-07-caught-red-handed.md

Lines changed: 76 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,36 @@
11
---
22
layout: post
3-
title: "1.52.0, fingerprints and compiler error forensics"
4-
author: Felix Klock
3+
title: "Rust 1.52.1"
4+
author: Felix Klock, Mark Rousskov
55
team: the compiler team <https://www.rust-lang.org/governance/teams/compiler>
6+
release: true
67
---
78

8-
The Rust teams are always excited to report on new features offered with each release. Sometimes, however, an important change that is not yet "fully baked" gets accidentally included in a release.
9+
The Rust team has prepared a new release, 1.52.1, working around a bug
10+
introduced in 1.52.0. We recommend all Rust users, including those currently
11+
using stable versions prior to 1.52.0 upgrade to 1.52.1.
12+
13+
If you have a previous version of Rust installed via rustup, getting Rust
14+
1.52.1 is as easy as:
15+
16+
```console
17+
rustup update stable
18+
```
19+
20+
If you don't have it already, you can [get `rustup`][install]
21+
from the appropriate page on our website.
22+
23+
[install]: https://www.rust-lang.org/install.html
24+
25+
# What's in 1.52.1 stable
26+
27+
This point release contains a single change: it disables incremental
28+
compilation. Read on for more details as to why, and the next steps the Rust
29+
project is pursuing on this issue.
30+
31+
# Summary
32+
33+
The Rust teams are always excited to report on new features offered with each release. Sometimes, however, an important change that is not yet "fully baked" gets accidentally included in a release, and we need to issue a point release.
934

1035
There was an instance of this in the most recent release, 1.52.0, which added a new bit of internal-consistency checking, called "incremental compilation hash verification" (abbreviated `verify-ich`). This check is also called an "unstable fingerprint" check, because the diagnostic it currently prints look [like this](https://github.com/rust-lang/rust/issues/84336):
1136

@@ -19,9 +44,9 @@ error: internal compiler error: unexpected panic
1944
note: the compiler unexpectedly panicked. this is a bug.
2045
```
2146

22-
This internal-consistency check, as stated in the diagnostic, yields an "Internal Compiler Error" (or ICE). In other words, it represents a bug in the internals of the Rust compiler itself. In *this* case, though, the ICE is revealing a bug that 1.) is very likely to predate the 1.52.0 release and 2.) could result in miscompilation if it had not been caught by `verify-ich`.
47+
This internal-consistency check, as stated in the diagnostic, yields an "Internal Compiler Error" (or ICE). In other words, it represents a bug in the internals of the Rust compiler itself. In *this* case, though, the ICE is revealing a bug that 1.) predates the 1.52.0 release and 2.) could result in miscompilation if it had not been caught by `verify-ich`.
2348

24-
In other words: If you are seeing the above Internal Compiler Error, you may be tempted to respond by reverting to the 1.51 release. I want to stress that a downgrade is *not* the best response to this problem.
49+
In other words: If you are seeing the above Internal Compiler Error, you may be tempted to respond by reverting to the 1.51 release. It is important to note that a downgrade is *not* the best response to this problem.
2550

2651
This post is going to:
2752

@@ -60,16 +85,25 @@ More recently, in March, we encountered a [miscompilation][issue-82920] that led
6085
[issue-82920]: https://github.com/rust-lang/rust/issues/82920
6186
[pr-83007]: https://github.com/rust-lang/rust/pull/83007
6287

63-
When we first turned on `verify-ich` by default, we assumed we would have time to iron out all the known causes of unstable fingerprints. When we realized this assumption was false, we started [making plans][issue-84970] to improve the user-experience, so that the diagnostic issued by the check would do a better job of telling the programmer what to do in response. But we made a mistake: We thought that the switch for this check was not going to be on the Rust stable channel until version 1.53.
88+
When we first turned on `verify-ich` by default, there was a steady stream of
89+
issues filed by users of the nightly (and beta) toolchains, and steady progress
90+
has been made on identifying fixes, a number of which have already landed. This
91+
last week, we noted incorrectly that the error would be shipping to stable
92+
next cycle in 1.53.0, and we started [making plans][issue-84970] to improve the
93+
user-experience, so that the diagnostic issued by the check would do a better
94+
job of telling the programmer what to do in response.
6495

6596
[issue-84970]: https://github.com/rust-lang/rust/issues/84970
6697

6798
It turns out `verify-ich` was turned on in version 1.52.0, which was [released recently][].
6899

69100
[released recently]: /2021/05/06/Rust-1.52.0.html
70101

71-
## How does this show up
102+
This release, 1.52.1, works around the breakage caused by the newly added
103+
verification by temporarily changing the defaults in the Rust compiler to disable
104+
incremental unless the user knowingly opts in.
72105

106+
## How does this show up
73107

74108
Essentially, for some crates, certain sequences of edit-compile cycles will cause `rustc` to hit the "unstable fingerprints" ICE. I showed one example at the start of this blog post.
75109

@@ -87,39 +121,61 @@ There are three ways that you may have incremental compilation turned on: You ma
87121
[cargo-toml]: https://doc.rust-lang.org/cargo/reference/config.html#buildincremental
88122
[profiles]: https://doc.rust-lang.org/cargo/reference/profiles.html
89123

90-
If your project has not opted into enabling incremental compilation, then none of the fingerprint issues should affect your release builds.
124+
Incremental is disabled by default for the release profile, which should mean
125+
that unless you have enabled it yourself, these errors do not affect release
126+
builds, as they are only present in incremental builds.
91127

92128
## What should a Rust programmer do in response
93129

94130
The Internal Compiler Error asks you to report a bug, and if you can do so, we still want that information. We *want* to know about the cases that are failing.
95131

96132
But regardless of whether or not you file a bug, the problem here can be resolved by either:
97133

98-
1. deleting your incremental compilation cache (e.g. by running `cargo clean`), or
99-
2. force incremental compilation to be disabled, by setting `CARGO_INCREMENTAL=0` in your environment or `build.incremental` to `false` in the `config.toml`.
134+
1. upgrading to 1.52.1, if you have not yet done so (which will disable
135+
incremental for you).
136+
2. deleting your incremental compilation cache (e.g. by running `cargo clean`), or
137+
3. force incremental compilation to be disabled, by setting `CARGO_INCREMENTAL=0` in your environment or `build.incremental` to `false` in the `config.toml`.
100138

101-
We recommend that users of 1.52.0 disable incremental compilation, to avoid running into this problem.
139+
We recommend that users of 1.52.0 upgrade to 1.52.1, which disables incremental
140+
compilation.
102141

103142
We do *not* recommend that users of 1.52.0 downgrade to an earlier version of Rust in response to this problem. As noted above, there is at least one instance of a silent [miscompilation][issue-82920] caused by incremental compilation that was not caught until we added the fingerprint checking.
104143

144+
If a user is willing to deal with the incremental verification ICE's, and wishes
145+
to opt back into the 1.52.0 behavior, they may set `RUSTC_FORCE_INCREMENTAL` to
146+
`1` in their environment. The Rust compiler will then respect the
147+
`-Cincremental` option passed by Cargo, and things will work as before. Note
148+
that this flag does not enable incremental if it has not already been separately
149+
enabled (whether by Cargo or otherwise).
150+
105151
## What is the Rust project going to do to fix this
106152

107153
### Short-term plan
108154

109-
Based on the number of bug reports that have already come in, we know we need to do something quickly.
155+
We have issued 1.52.1 today which:
110156

111-
We are going to be issuing a point release, 1.52.1. The point release will improve the diagnostic output from `verify-ich`, so that a programmer can more effectively act in response to the message (i.e., they will be told that the problem is due to the use of incremental compilation, and that they need to delete their cache, at the very least).
157+
* Disables incremental compilation in the Rust compiler (unless asked for by a
158+
new environment variable, `RUSTC_FORCE_INCREMENTAL=1`).
159+
* Improves diagnostic output for the new verification if incremental compilation is enabled, indicating how to work around the bugs.
112160

113-
We might also make incremental compilation opt-in for *all* Cargo [profiles][]; that is, we may turn incremental compilation off for the `dev` and `test`, so that they match `release` and `bench`, which already have incremental compilation off. (This remains to be decided.)
161+
This is intended to be a mitigation that helps the majority of Rust users have
162+
an upgrade path to a safe Rust compiler which does not have the risk of
163+
miscompiling their code, but also provide the option for users willing to deal
164+
with the errors to do so.
114165

115-
We do not plan to disable incremental compilation in its entirety. We believe that incremental compilation is providing value for a large number of Rust programmers, and we want to empower them to continue using it, as long as they are equipped with the tools they need to turn it off if they encounter this issue.
166+
We expect to continue to actively invest in fixing the bugs, and depending on
167+
our confidence in the fixes, may issue a 1.52.2 point release which backports
168+
those fixes to the stable channel. Users wishing to help us test can use the
169+
nightly channel, and report bugs to rust-lang/rust with any ICEs they are
170+
seeing. We do not expect at this time to disable incremental by default on the
171+
nightly channel.
116172

117173
### Long-term plan
118174

119-
The long-term plan is to fix the bugs! Incremental compilation is the only realistic way for the Rust compiler to be able to provide a fast edit-compile-run cycle for all of its programmers, and so we need to address [all of the issues][issue-list] that have been identified thus far via `verify-ich`. (There are 32 such issues as of this writing, though many may be duplicates.)
175+
The long-term plan is to fix the bugs! Incremental compilation is the only realistic way for the Rust compiler to be able to provide a fast edit-compile-run cycle for all of its programmers, and so we need to address [all of the issues][issue-list] that have been identified thus far via `verify-ich`. (There are 32 such issues as of this writing, though many are duplicates.)
120176

121-
[issue-list]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+unstable+fingerprints
122-
123-
If you want to come help us do it, we would love for you to [join us][] with the effort!
177+
We are actively investing in this, and a number of bugs have already been
178+
identified and fixed. Depending on the state of the fixes, future stable
179+
releases (1.53 and onwards) will likely re-enable incremental compilation.
124180

125-
[join us]: https://www.rust-lang.org/community
181+
[issue-list]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+unstable+fingerprints

0 commit comments

Comments
 (0)