Closed Mark-Simulacrum closed 2 years ago
cc @b-naber @lcnr does this ring a bell wrt recent const representation changes in MIR?
cc @b-naber @lcnr does this ring a bell wrt recent const representation changes in MIR?
Does a crater run use nightly?
None of the changes we made are in nightly right now. Only one PR was merged, but that was later reverted.
Reduced a bit from https://github.com/deaz/adventofcode-2018:
use std::collections::HashMap;
pub fn f(input: &str) {
input
.lines()
.map(|s| -> (u32) { (1) })
.fold(HashMap::new(), |mut map, (x)| {
let prev = map.get(&(0, x)).unwrap_or(&0);
map.insert((0, x), prev + 1);
map
});
}
pub fn main() {
let _ = f("");
}
This crashes on beta but not on stable or nightly.
minimalized
struct Repro;
impl Repro {
fn get(&self) -> &i32 {
&3
}
fn insert(&mut self, _: i32) {}
}
fn main() {
let x = &0;
let mut conflict = Repro;
let prev = conflict.get();
conflict.insert(*prev + *x);
}
the issue is that body.tainted_by_errors
is also set when only emitting a lint
Sounds like this comment might be relevant: https://github.com/rust-lang/rust/pull/93368#issuecomment-1048487073 - i.e. that PR ended up doing a drive-by fix because conflating errors and warnings became a type mismatch at the DiagnosticBuilder
level.
So you can probably confirm that nightly was broken between #93691 landing (nightly-2022-02-13
?) and #93368 landing (nightly-2022-02-26
?), and I guess beta branched between the two?
EDIT: heh, @lcnr already opened the fix/backport PR as I was writing this.
Should be fixed by https://github.com/rust-lang/rust/pull/94552.
Crater picked up this issue in a number of crates:
May be a duplicate of https://github.com/rust-lang/rust/issues/93002, but filing this as a dedicated bug with a rough list of affected crates in Crater.
ty::ConstKind::Error constructed but no error reported (we should check, may be a distinct bug; maybe https://github.com/rust-lang/rust/issues/94506):