Skip to content

Commit 1ddbda2

Browse files
committed
Auto merge of #1646 - RalfJung:rustup, r=RalfJung
rustup
2 parents 75ea76d + 7bbd6bc commit 1ddbda2

File tree

13 files changed

+19
-21
lines changed

13 files changed

+19
-21
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f0f68778f798d6d34649745b41770829b17ba5b8
1+
39b841dfe36f90a7cd111e7f0c55f32594f6e578

src/diagnostics.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::*;
1212
/// Details of premature program termination.
1313
pub enum TerminationInfo {
1414
Exit(i64),
15-
Abort(Option<String>),
15+
Abort(String),
1616
UnsupportedInIsolation(String),
1717
ExperimentalUb { msg: String, url: String },
1818
Deadlock,
@@ -24,10 +24,8 @@ impl fmt::Display for TerminationInfo {
2424
match self {
2525
Exit(code) =>
2626
write!(f, "the evaluated program completed with exit code {}", code),
27-
Abort(None) =>
28-
write!(f, "the evaluated program aborted execution"),
29-
Abort(Some(msg)) =>
30-
write!(f, "the evaluated program aborted execution: {}", msg),
27+
Abort(msg) =>
28+
write!(f, "{}", msg),
3129
UnsupportedInIsolation(msg) =>
3230
write!(f, "{}", msg),
3331
ExperimentalUb { msg, .. } =>

src/machine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,8 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
391391
}
392392

393393
#[inline(always)]
394-
fn abort(_ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx, !> {
395-
throw_machine_stop!(TerminationInfo::Abort(None))
394+
fn abort(_ecx: &mut InterpCx<'mir, 'tcx, Self>, msg: String) -> InterpResult<'tcx, !> {
395+
throw_machine_stop!(TerminationInfo::Abort(msg))
396396
}
397397

398398
#[inline(always)]

src/shims/foreign_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
149149
throw_machine_stop!(TerminationInfo::Exit(code.into()));
150150
}
151151
"abort" => {
152-
throw_machine_stop!(TerminationInfo::Abort(None))
152+
throw_machine_stop!(TerminationInfo::Abort("the program aborted execution".to_owned()))
153153
}
154154
_ => throw_unsup_format!("can't call (diverging) foreign function: {}", link_name),
155155
},

src/shims/intrinsics.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,21 +419,21 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
419419

420420

421421
// Query type information
422-
"assert_inhabited" |
423422
"assert_zero_valid" |
424423
"assert_uninit_valid" => {
425424
let &[] = check_arg_count(args)?;
426425
let ty = instance.substs.type_at(0);
427426
let layout = this.layout_of(ty)?;
428427
// Abort here because the caller might not be panic safe.
429428
if layout.abi.is_uninhabited() {
430-
throw_machine_stop!(TerminationInfo::Abort(Some(format!("attempted to instantiate uninhabited type `{}`", ty))))
429+
// Use this message even for the other intrinsics, as that's what codegen does
430+
throw_machine_stop!(TerminationInfo::Abort(format!("aborted execution: attempted to instantiate uninhabited type `{}`", ty)))
431431
}
432432
if intrinsic_name == "assert_zero_valid" && !layout.might_permit_raw_init(this, /*zero:*/ true).unwrap() {
433-
throw_machine_stop!(TerminationInfo::Abort(Some(format!("attempted to zero-initialize type `{}`, which is invalid", ty))))
433+
throw_machine_stop!(TerminationInfo::Abort(format!("aborted execution: attempted to zero-initialize type `{}`, which is invalid", ty)))
434434
}
435435
if intrinsic_name == "assert_uninit_valid" && !layout.might_permit_raw_init(this, /*zero:*/ false).unwrap() {
436-
throw_machine_stop!(TerminationInfo::Abort(Some(format!("attempted to leave type `{}` uninitialized, which is invalid", ty))))
436+
throw_machine_stop!(TerminationInfo::Abort(format!("aborted execution: attempted to leave type `{}` uninitialized, which is invalid", ty)))
437437
}
438438
}
439439

tests/compile-fail/abort-terminator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// error-pattern: the evaluated program aborted
1+
// error-pattern: the program aborted
22
#![feature(unwind_attributes)]
33

44
#[unwind(aborts)]

tests/compile-fail/intrinsics/uninit_uninhabited_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// error-pattern: the evaluated program aborted execution: attempted to instantiate uninhabited type `!`
1+
// error-pattern: attempted to instantiate uninhabited type `!`
22
#![feature(never_type)]
33

44
#[allow(deprecated, invalid_value)]

tests/compile-fail/intrinsics/zero_fn_ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// error-pattern: the evaluated program aborted execution: attempted to zero-initialize type `fn()`, which is invalid
1+
// error-pattern: attempted to zero-initialize type `fn()`, which is invalid
22

33
#[allow(deprecated, invalid_value)]
44
fn main() {

tests/compile-fail/panic/double_panic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// error-pattern: the evaluated program aborted
1+
// error-pattern: the program aborted
22

33
struct Foo;
44
impl Drop for Foo {

tests/compile-fail/panic/panic_abort1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// error-pattern: the evaluated program aborted execution
1+
// error-pattern: the program aborted execution
22
// compile-flags: -C panic=abort
33

44
fn main() {

tests/compile-fail/panic/panic_abort2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// error-pattern: the evaluated program aborted execution
1+
// error-pattern: the program aborted execution
22
// compile-flags: -C panic=abort
33

44
fn main() {

tests/compile-fail/panic/panic_abort3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// error-pattern: the evaluated program aborted execution
1+
// error-pattern: the program aborted execution
22
// compile-flags: -C panic=abort
33

44
fn main() {

tests/compile-fail/panic/panic_abort4.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// error-pattern: the evaluated program aborted execution
1+
// error-pattern: the program aborted execution
22
// compile-flags: -C panic=abort
33

44
fn main() {

0 commit comments

Comments
 (0)