fix miri backtrace panic

This commit is contained in:
Oliver Schneider 2016-09-20 12:51:48 +02:00
parent c1ae916a64
commit 63cc7fc9e8
No known key found for this signature in database
GPG Key ID: 56D6EEA0FC67AC46
3 changed files with 15 additions and 8 deletions

View File

@ -1188,13 +1188,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
ppaux::parameterized(f, self.1, self.0, ppaux::Ns::Value, &[])
}
}
let inst = Instance(def_id, substs);
match ::std::panic::catch_unwind(|| {
format!("inside call to {}", inst)
}) {
Ok(msg) => err.span_note(span, &msg),
Err(_) => err.span_note(span, &format!("ppaux::parameterized failed: {:?}, {:?}", def_id, substs)),
};
err.span_note(span, &format!("inside call to {}", Instance(def_id, substs)));
}
err.emit();
}

View File

@ -218,7 +218,7 @@ fn eval_fn_call(
Some((ptr, block)) => (Some(ptr), StackPopCleanup::Goto(block)),
None => (None, StackPopCleanup::None),
};
self.push_stack_frame(def_id, span, mir, resolved_substs, return_ptr, return_to_block)?;
self.push_stack_frame(resolved_def_id, span, mir, resolved_substs, return_ptr, return_to_block)?;
for (i, (src, src_ty)) in arg_srcs.into_iter().enumerate() {
let dest = self.frame().locals[i];

View File

@ -0,0 +1,13 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
assert!(Ok::<i32, String>(42) == Ok(42));
}