mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
we can now print on entering/leaving the topmost frame, and make sure it stays that way
This commit is contained in:
parent
22d6c55cdf
commit
4653ae1e3e
@ -602,14 +602,15 @@ pub fn const_eval_raw_provider<'a, 'tcx>(
|
||||
other => return other,
|
||||
}
|
||||
}
|
||||
// the first trace is for replicating an ice
|
||||
// There's no tracking issue, but the next two lines concatenated link to the discussion on
|
||||
// zulip. It's not really possible to test this, because it doesn't show up in diagnostics
|
||||
// or MIR.
|
||||
// https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/
|
||||
// subject/anon_const_instance_printing/near/135980032
|
||||
trace!("const eval: {}", key.value.instance);
|
||||
trace!("const eval: {:?}", key);
|
||||
if cfg!(debug_assertions) {
|
||||
// Make sure we format the instance even if we do not print it.
|
||||
// This serves as a regression test against an ICE on printing.
|
||||
// The next two lines concatenated contain some discussion:
|
||||
// https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/
|
||||
// subject/anon_const_instance_printing/near/135980032
|
||||
let instance = key.value.instance.to_string();
|
||||
trace!("const eval: {:?} ({})", key, instance);
|
||||
}
|
||||
|
||||
let cid = key.value;
|
||||
let def_id = cid.instance.def.def_id();
|
||||
|
@ -450,7 +450,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
|
||||
return_place: Option<PlaceTy<'tcx, M::PointerTag>>,
|
||||
return_to_block: StackPopCleanup,
|
||||
) -> EvalResult<'tcx> {
|
||||
if self.stack.len() > 1 { // FIXME should be "> 0", printing topmost frame crashes rustc...
|
||||
if self.stack.len() > 0 {
|
||||
info!("PAUSING({}) {}", self.cur_frame(), self.frame().instance);
|
||||
}
|
||||
::log_settings::settings().indentation += 1;
|
||||
@ -525,9 +525,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
|
||||
self.frame_mut().locals = locals;
|
||||
}
|
||||
|
||||
if self.stack.len() > 1 { // FIXME no check should be needed, but some instances ICE
|
||||
info!("ENTERING({}) {}", self.cur_frame(), self.frame().instance);
|
||||
}
|
||||
info!("ENTERING({}) {}", self.cur_frame(), self.frame().instance);
|
||||
|
||||
if self.stack.len() > self.tcx.sess.const_eval_stack_frame_limit {
|
||||
err!(StackFrameLimitReached)
|
||||
@ -537,9 +535,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
|
||||
}
|
||||
|
||||
pub(super) fn pop_stack_frame(&mut self) -> EvalResult<'tcx> {
|
||||
if self.stack.len() > 1 { // FIXME no check should be needed, but some instances ICE
|
||||
info!("LEAVING({}) {}", self.cur_frame(), self.frame().instance);
|
||||
}
|
||||
info!("LEAVING({}) {}", self.cur_frame(), self.frame().instance);
|
||||
::log_settings::settings().indentation -= 1;
|
||||
let frame = self.stack.pop().expect(
|
||||
"tried to pop a stack frame, but there were none",
|
||||
@ -591,7 +587,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
|
||||
StackPopCleanup::None { .. } => {}
|
||||
}
|
||||
|
||||
if self.stack.len() > 1 { // FIXME should be "> 0", printing topmost frame crashes rustc...
|
||||
if self.stack.len() > 0 {
|
||||
info!("CONTINUING({}) {}", self.cur_frame(), self.frame().instance);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user