Skip to content

Commit e304ef0

Browse files
Add some language around what miscompilations are and what releases they are in
1 parent e1c66ae commit e304ef0

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

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

+29-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: post
3-
title: "Rust 1.52.1"
3+
title: "Announcing Rust 1.52.1"
44
author: Felix Klock, Mark Rousskov
55
team: the compiler team <https://www.rust-lang.org/governance/teams/compiler>
66
release: true
@@ -28,7 +28,7 @@ from the appropriate page on our website.
2828

2929
This release works around broken builds on 1.52.0, which are caused by newly
3030
added verification. The bugs this verification detects are present in all Rust
31-
versions, and can trigger miscompilations in incremental builds, so downgrading
31+
versions[^1], and can trigger miscompilations in incremental builds, so downgrading
3232
to a prior stable version is not a fix.
3333

3434
Users are encouraged to upgrade to 1.52.1 or disable incremental in their local
@@ -38,6 +38,14 @@ section for details on how to do so.
3838
Incremental compilation is off by default for release builds, so few
3939
production builds should be affected (only users who may have opted in).
4040

41+
Miscompilations that can arise from the bugs in incremental compilation generate incorrect code in final
42+
artifacts, essentially producing malformed binaries, which means that in theory
43+
any behavior is possible. In practice we are currently only aware of one
44+
particular known miscompilation, but bugs due to incremental are notoriously
45+
hard to track down: users frequently simply rebuild after some light editing if
46+
they see unexpected results from their binaries, and this often causes
47+
sufficient recompilation to fix the bug(s).
48+
4149
This post is going to:
4250

4351
1. Explain [what the errors look like][part0],
@@ -57,7 +65,7 @@ This post is going to:
5765
The error message looks something like this, with the key piece being the "found
5866
unstable fingerprints" text.
5967

60-
```
68+
```text
6169
thread 'rustc' panicked at 'assertion failed: `(left == right)`
6270
left: `Some(Fingerprint(4565771098143344972, 7869445775526300234))`,
6371
right: `Some(Fingerprint(14934403843752251060, 623484215826468126))`: found unstable fingerprints for <massive text describing rustc internals elided>
@@ -67,7 +75,7 @@ error: internal compiler error: unexpected panic
6775
note: the compiler unexpectedly panicked. this is a bug.
6876
```
6977

70-
This is the error caused by the internal consistency check, and as stated in the diagnostic, it 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, the ICE is revealing a bug in incremental compilation that predates the 1.52.0 release and could result in miscompilation if it had not been caught by `verify-ich`.
78+
This is the error caused by the internal consistency check, and as stated in the diagnostic, it 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, the ICE is revealing a bug in incremental compilation that predates the 1.52.0 release and could result in miscompilation if it had not been caught.
7179

7280
## What are fingerprints? Why are we checking them?
7381

@@ -79,28 +87,29 @@ Fingerprints are part of our architecture for detecting when inputs change. More
7987

8088
[rustc-dev-guide-fingerprints]: https://rustc-dev-guide.rust-lang.org/queries/incremental-compilation-in-detail.html#checking-query-results-for-changes-hashstable-and-fingerprints
8189

82-
The `verify-ich` check is a safeguard asserting internal consistency of the
83-
fingerprints. Sometimes the compiler is forced to rerun a query, and expects
90+
The fingerprint stability check is a safeguard asserting internal consistency of
91+
the fingerprints. Sometimes the compiler is forced to rerun a query, and expects
8492
that the output is the same as from a prior incremental compilation session. The
8593
newly enabled verification checks that the value is indeed as expected, rather
8694
than assuming so. In some cases, due to bugs in the compiler's implementation,
8795
this was not actually the case.
8896

8997
## History
9098

91-
We [initially added][pr-45867] `verify-ich` as a tool to use when developing
92-
rustc itself, back in 2017. It was solely provided via an unstable `-Z` flag,
93-
only available to nightly and development builds.
99+
We [initially added][pr-45867] these fingerprint checks as a tool to use when
100+
developing rustc itself, back in 2017. It was solely provided via an unstable
101+
`-Z` flag, only available to nightly and development builds.
94102

95103
More recently, in March, we encountered a [miscompilation][issue-82920] that led us to [turn on `verify-ich` by default][pr-83007]. The Rust compiler team decided it was better to catch fingerprint problems and abort compilation, rather than allow for potential miscompilations (and subsequent misbehavior) to sneak into Rust programmer's binaries.
96104

97105
[pr-45867]: https://github.com/rust-lang/rust/pull/45867
98106
[issue-82920]: https://github.com/rust-lang/rust/issues/82920
99107
[pr-83007]: https://github.com/rust-lang/rust/pull/83007
100108

101-
When we first turned on `verify-ich` by default, there was a steady stream of
102-
issues filed by users of the nightly (and beta) toolchains, and steady progress
103-
has been made on identifying fixes, a number of which have already landed.
109+
When we first turned on the fingerprint checks by default, there was a steady
110+
stream of issues filed by users of the nightly (and beta) toolchains, and steady
111+
progress has been made on identifying fixes, a number of which have already
112+
landed.
104113

105114
In the past week, we had started [making plans][issue-84970] to improve the
106115
user-experience, so that the diagnostic issued by the check would do a better
@@ -144,7 +153,7 @@ There are several ways that you may have incremental compilation turned on:
144153

145154
If your project has not adjusted the defaults, then when running `cargo build
146155
--release` or otherwise in the `release` profile configuration incremental is
147-
disabled on all Rust versions, and these issues should not affect your release
156+
disabled on all Rust versions[^1], and these issues should not affect your release
148157
builds.
149158

150159
## What should a Rust programmer do in response
@@ -212,3 +221,10 @@ identified and fixed. Depending on the state of the fixes, future stable
212221
releases (1.53 and onwards) will likely re-enable incremental compilation.
213222

214223
[issue-list]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+unstable+fingerprints
224+
225+
The Rust teams will also be developing plans to ensure we have better tracking
226+
systems in place in the future for bugs, both to prevent situations like this
227+
from arising again, but also to further increase the stability of our releases
228+
by tracking bugs more accurately as they propagate across channels.
229+
230+
[^1]: Since incremental was first enabled, which was in Rust 1.24.

0 commit comments

Comments
 (0)