commit
1ddbda28e3
@ -1 +1 @@
|
||||
f0f68778f798d6d34649745b41770829b17ba5b8
|
||||
39b841dfe36f90a7cd111e7f0c55f32594f6e578
|
||||
|
@ -12,7 +12,7 @@ use crate::*;
|
||||
/// Details of premature program termination.
|
||||
pub enum TerminationInfo {
|
||||
Exit(i64),
|
||||
Abort(Option<String>),
|
||||
Abort(String),
|
||||
UnsupportedInIsolation(String),
|
||||
ExperimentalUb { msg: String, url: String },
|
||||
Deadlock,
|
||||
@ -24,10 +24,8 @@ impl fmt::Display for TerminationInfo {
|
||||
match self {
|
||||
Exit(code) =>
|
||||
write!(f, "the evaluated program completed with exit code {}", code),
|
||||
Abort(None) =>
|
||||
write!(f, "the evaluated program aborted execution"),
|
||||
Abort(Some(msg)) =>
|
||||
write!(f, "the evaluated program aborted execution: {}", msg),
|
||||
Abort(msg) =>
|
||||
write!(f, "{}", msg),
|
||||
UnsupportedInIsolation(msg) =>
|
||||
write!(f, "{}", msg),
|
||||
ExperimentalUb { msg, .. } =>
|
||||
|
@ -391,8 +391,8 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn abort(_ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx, !> {
|
||||
throw_machine_stop!(TerminationInfo::Abort(None))
|
||||
fn abort(_ecx: &mut InterpCx<'mir, 'tcx, Self>, msg: String) -> InterpResult<'tcx, !> {
|
||||
throw_machine_stop!(TerminationInfo::Abort(msg))
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
@ -149,7 +149,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
||||
throw_machine_stop!(TerminationInfo::Exit(code.into()));
|
||||
}
|
||||
"abort" => {
|
||||
throw_machine_stop!(TerminationInfo::Abort(None))
|
||||
throw_machine_stop!(TerminationInfo::Abort("the program aborted execution".to_owned()))
|
||||
}
|
||||
_ => throw_unsup_format!("can't call (diverging) foreign function: {}", link_name),
|
||||
},
|
||||
|
@ -419,7 +419,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
||||
|
||||
|
||||
// Query type information
|
||||
"assert_inhabited" |
|
||||
"assert_zero_valid" |
|
||||
"assert_uninit_valid" => {
|
||||
let &[] = check_arg_count(args)?;
|
||||
@ -427,13 +426,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
||||
let layout = this.layout_of(ty)?;
|
||||
// Abort here because the caller might not be panic safe.
|
||||
if layout.abi.is_uninhabited() {
|
||||
throw_machine_stop!(TerminationInfo::Abort(Some(format!("attempted to instantiate uninhabited type `{}`", ty))))
|
||||
// Use this message even for the other intrinsics, as that's what codegen does
|
||||
throw_machine_stop!(TerminationInfo::Abort(format!("aborted execution: attempted to instantiate uninhabited type `{}`", ty)))
|
||||
}
|
||||
if intrinsic_name == "assert_zero_valid" && !layout.might_permit_raw_init(this, /*zero:*/ true).unwrap() {
|
||||
throw_machine_stop!(TerminationInfo::Abort(Some(format!("attempted to zero-initialize type `{}`, which is invalid", ty))))
|
||||
throw_machine_stop!(TerminationInfo::Abort(format!("aborted execution: attempted to zero-initialize type `{}`, which is invalid", ty)))
|
||||
}
|
||||
if intrinsic_name == "assert_uninit_valid" && !layout.might_permit_raw_init(this, /*zero:*/ false).unwrap() {
|
||||
throw_machine_stop!(TerminationInfo::Abort(Some(format!("attempted to leave type `{}` uninitialized, which is invalid", ty))))
|
||||
throw_machine_stop!(TerminationInfo::Abort(format!("aborted execution: attempted to leave type `{}` uninitialized, which is invalid", ty)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// error-pattern: the evaluated program aborted
|
||||
// error-pattern: the program aborted
|
||||
#![feature(unwind_attributes)]
|
||||
|
||||
#[unwind(aborts)]
|
||||
|
@ -1,4 +1,4 @@
|
||||
// error-pattern: the evaluated program aborted execution: attempted to instantiate uninhabited type `!`
|
||||
// error-pattern: attempted to instantiate uninhabited type `!`
|
||||
#![feature(never_type)]
|
||||
|
||||
#[allow(deprecated, invalid_value)]
|
||||
|
@ -1,4 +1,4 @@
|
||||
// error-pattern: the evaluated program aborted execution: attempted to zero-initialize type `fn()`, which is invalid
|
||||
// error-pattern: attempted to zero-initialize type `fn()`, which is invalid
|
||||
|
||||
#[allow(deprecated, invalid_value)]
|
||||
fn main() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// error-pattern: the evaluated program aborted
|
||||
// error-pattern: the program aborted
|
||||
|
||||
struct Foo;
|
||||
impl Drop for Foo {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// error-pattern: the evaluated program aborted execution
|
||||
// error-pattern: the program aborted execution
|
||||
// compile-flags: -C panic=abort
|
||||
|
||||
fn main() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// error-pattern: the evaluated program aborted execution
|
||||
// error-pattern: the program aborted execution
|
||||
// compile-flags: -C panic=abort
|
||||
|
||||
fn main() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// error-pattern: the evaluated program aborted execution
|
||||
// error-pattern: the program aborted execution
|
||||
// compile-flags: -C panic=abort
|
||||
|
||||
fn main() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// error-pattern: the evaluated program aborted execution
|
||||
// error-pattern: the program aborted execution
|
||||
// compile-flags: -C panic=abort
|
||||
|
||||
fn main() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user