Auto merge of #2141 - saethlin:early-diagnostics-ice, r=RalfJung
Adjust diagnostics assertion so we don't ICE in setup Fixes https://github.com/rust-lang/miri/issues/2076 just by handling diagnostics produced during setup. The tracking notes don't have any spans but it's better than an ICE. It looks like we leak allocations 1..20, and allocations 13..19 don't have any creation notes, and 14 only has a `FreedAlloc` alloc tracking diagnostic.
This commit is contained in:
commit
e3227cfc7e
10
src/eval.rs
10
src/eval.rs
@ -168,6 +168,12 @@ pub fn create_ecx<'mir, 'tcx: 'mir>(
|
||||
param_env,
|
||||
Evaluator::new(config, layout_cx),
|
||||
);
|
||||
|
||||
// Capture the current interpreter stack state (which should be empty) so that we can emit
|
||||
// allocation-tracking and tag-tracking diagnostics for allocations which are part of the
|
||||
// early runtime setup.
|
||||
let info = ecx.preprocess_diagnostics();
|
||||
|
||||
// Some parts of initialization require a full `InterpCx`.
|
||||
Evaluator::late_init(&mut ecx, config)?;
|
||||
|
||||
@ -287,6 +293,10 @@ pub fn create_ecx<'mir, 'tcx: 'mir>(
|
||||
}
|
||||
}
|
||||
|
||||
// Emit any diagnostics related to the setup process for the runtime, so that when the
|
||||
// interpreter loop starts there are no unprocessed diagnostics.
|
||||
ecx.process_diagnostics(info);
|
||||
|
||||
Ok((ecx, ret_place))
|
||||
}
|
||||
|
||||
|
5
tests/run-pass/track-alloc-1.rs
Normal file
5
tests/run-pass/track-alloc-1.rs
Normal file
@ -0,0 +1,5 @@
|
||||
// Ensure that tracking early allocations doesn't ICE Miri.
|
||||
// Early allocations are probably part of the runtime and therefore uninteresting, but they
|
||||
// shouldn't cause a crash.
|
||||
// compile-flags: -Zmiri-track-alloc-id=1
|
||||
fn main() {}
|
5
tests/run-pass/track-alloc-1.stderr
Normal file
5
tests/run-pass/track-alloc-1.stderr
Normal file
@ -0,0 +1,5 @@
|
||||
note: tracking was triggered
|
||||
|
|
||||
= note: created allocation with id 1
|
||||
= note: (no span available)
|
||||
|
Loading…
x
Reference in New Issue
Block a user