This commit is contained in:
Ralf Jung
2020-12-10 19:53:45 +01:00
parent 75ea76d6f5
commit 7bbd6bca77
13 changed files with 19 additions and 21 deletions
+1 -1
View File
@@ -1 +1 @@
f0f68778f798d6d34649745b41770829b17ba5b8
39b841dfe36f90a7cd111e7f0c55f32594f6e578
+3 -5
View File
@@ -12,7 +12,7 @@
/// 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 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
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, .. } =>
+2 -2
View File
@@ -391,8 +391,8 @@ fn assert_panic(
}
#[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)]
+1 -1
View File
@@ -149,7 +149,7 @@ fn emulate_foreign_item(
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),
},
+4 -4
View File
@@ -419,7 +419,6 @@ fn call_intrinsic(
// Query type information
"assert_inhabited" |
"assert_zero_valid" |
"assert_uninit_valid" => {
let &[] = check_arg_count(args)?;
@@ -427,13 +426,14 @@ fn call_intrinsic(
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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -1,4 +1,4 @@
// error-pattern: the evaluated program aborted
// error-pattern: the program aborted
struct Foo;
impl Drop for Foo {
+1 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -1,4 +1,4 @@
// error-pattern: the evaluated program aborted execution
// error-pattern: the program aborted execution
// compile-flags: -C panic=abort
fn main() {