Description
Emitting diagnostics in one thread taints every infcx out there, but other threads don't expect their infcx to become tainted if they themselves aren't emitting anything. This leads to skipped diagnostics, early bailing out of queries that could've run to completion or painful to debug ICEs. For example, take #120601: snippet below run with -Zthreads=3 --edition=2021
works, but crashes if you uncomment the last function.
struct Tuple(i32);
async fn tuple() -> Tuple {
Tuple(1i32)
}
async fn xyz() {
match tuple() {
Tuple(_) => {},
}
}
/* uncomment this function to observe crashes
async fn fail() {
Fail(())
}
*/
In parallel compiler, code that does different things depending on the result of InferCtxt::tainted_by_errors()
can introduce spurious failures or even replace previously resolved Ty
's with Ty::new_error()
:
rust/compiler/rustc_borrowck/src/nll.rs
Line 202 in f9515fd
in
regioncx.infer_opaque_types
:rust/compiler/rustc_borrowck/src/region_infer/opaque_types.rs
Lines 133 to 134 in f9515fd
rust/compiler/rustc_borrowck/src/region_infer/opaque_types.rs
Lines 278 to 285 in f9515fd
relevant part of
InferCtxt
:rust/compiler/rustc_infer/src/infer/mod.rs
Lines 1219 to 1239 in f9515fd
rustc 1.81.0-nightly (f1586001a 2024-06-13)
binary: rustc
commit-hash: f1586001ace26df7cafeb6534eaf76fb2c5513e5
commit-date: 2024-06-13
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7
Metadata
Metadata
Assignees
Labels
Type
Projects
Status