You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: posts/2021-05-07-caught-red-handed.md
+76-20Lines changed: 76 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,36 @@
1
1
---
2
2
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
5
5
team: the compiler team <https://www.rust-lang.org/governance/teams/compiler>
6
+
release: true
6
7
---
7
8
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.
9
34
10
35
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):
note: the compiler unexpectedly panicked. this is a bug.
20
45
```
21
46
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`.
23
48
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.
25
50
26
51
This post is going to:
27
52
@@ -60,16 +85,25 @@ More recently, in March, we encountered a [miscompilation][issue-82920] that led
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.
It turns out `verify-ich` was turned on in version 1.52.0, which was [released recently][].
68
99
69
100
[released recently]: /2021/05/06/Rust-1.52.0.html
70
101
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.
72
105
106
+
## How does this show up
73
107
74
108
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.
75
109
@@ -87,39 +121,61 @@ There are three ways that you may have incremental compilation turned on: You ma
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.
91
127
92
128
## What should a Rust programmer do in response
93
129
94
130
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.
95
131
96
132
But regardless of whether or not you file a bug, the problem here can be resolved by either:
97
133
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`.
100
138
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.
102
141
103
142
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.
104
143
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
+
105
151
## What is the Rust project going to do to fix this
106
152
107
153
### Short-term plan
108
154
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:
110
156
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.
112
160
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.
114
165
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.
116
172
117
173
### Long-term plan
118
174
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.)
0 commit comments