Skip to content

Commit 6e4f562

Browse files
committed
Auto merge of #3331 - rust-lang:rustup-2024-02-27, r=RalfJung
Automatic Rustup
2 parents 91f5f53 + 226c2c3 commit 6e4f562

25 files changed

+49
-77
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0250ef2571185b05701ed9d74fc904c17508a397
1+
71ffdf7ff7ac6df5f9f64de7e780b8345797e8a0

src/concurrency/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ pub struct Thread<'mir, 'tcx> {
143143
join_status: ThreadJoinStatus,
144144

145145
/// Stack of active panic payloads for the current thread. Used for storing
146-
/// the argument of the call to `miri_start_panic` (the panic payload) when unwinding.
146+
/// the argument of the call to `miri_start_unwind` (the panic payload) when unwinding.
147147
/// This is pointer-sized, and matches the `Payload` type in `src/libpanic_unwind/miri.rs`.
148148
///
149149
/// In real unwinding, the payload gets passed as an argument to the landing pad,

src/shims/foreign_items.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
6868
let ret = match ret {
6969
None =>
7070
match link_name.as_str() {
71-
"miri_start_panic" => {
72-
// `check_shim` happens inside `handle_miri_start_panic`.
73-
this.handle_miri_start_panic(abi, link_name, args, unwind)?;
71+
"miri_start_unwind" => {
72+
// `check_shim` happens inside `handle_miri_start_unwind`.
73+
this.handle_miri_start_unwind(abi, link_name, args, unwind)?;
7474
return Ok(None);
7575
}
7676
// This matches calls to the foreign item `panic_impl`.

src/shims/intrinsics/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
5454

5555
// Some intrinsics are special and need the "ret".
5656
match intrinsic_name {
57-
"try" => return this.handle_try(args, dest, ret),
57+
"catch_unwind" => return this.handle_catch_unwind(args, dest, ret),
5858
_ => {}
5959
}
6060

src/shims/panic.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
//! The core pieces of the runtime are:
44
//! - An implementation of `__rust_maybe_catch_panic` that pushes the invoked stack frame with
55
//! some extra metadata derived from the panic-catching arguments of `__rust_maybe_catch_panic`.
6-
//! - A hack in `libpanic_unwind` that calls the `miri_start_panic` intrinsic instead of the
6+
//! - A hack in `libpanic_unwind` that calls the `miri_start_unwind` intrinsic instead of the
77
//! target-native panic runtime. (This lives in the rustc repo.)
8-
//! - An implementation of `miri_start_panic` that stores its argument (the panic payload), and then
8+
//! - An implementation of `miri_start_unwind` that stores its argument (the panic payload), and then
99
//! immediately returns, but on the *unwind* edge (not the normal return edge), thus initiating unwinding.
1010
//! - A hook executed each time a frame is popped, such that if the frame pushed by `__rust_maybe_catch_panic`
1111
//! gets popped *during unwinding*, we take the panic payload and store it according to the extra
@@ -44,9 +44,9 @@ impl VisitProvenance for CatchUnwindData<'_> {
4444

4545
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriInterpCx<'mir, 'tcx> {}
4646
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
47-
/// Handles the special `miri_start_panic` intrinsic, which is called
47+
/// Handles the special `miri_start_unwind` intrinsic, which is called
4848
/// by libpanic_unwind to delegate the actual unwinding process to Miri.
49-
fn handle_miri_start_panic(
49+
fn handle_miri_start_unwind(
5050
&mut self,
5151
abi: Abi,
5252
link_name: Symbol,
@@ -55,7 +55,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
5555
) -> InterpResult<'tcx> {
5656
let this = self.eval_context_mut();
5757

58-
trace!("miri_start_panic: {:?}", this.frame().instance);
58+
trace!("miri_start_unwind: {:?}", this.frame().instance);
5959

6060
// Get the raw pointer stored in arg[0] (the panic payload).
6161
let [payload] = this.check_shim(abi, Abi::Rust, link_name, args)?;
@@ -69,7 +69,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
6969
}
7070

7171
/// Handles the `try` intrinsic, the underlying implementation of `std::panicking::try`.
72-
fn handle_try(
72+
fn handle_catch_unwind(
7373
&mut self,
7474
args: &[OpTy<'tcx, Provenance>],
7575
dest: &PlaceTy<'tcx, Provenance>,
@@ -85,7 +85,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
8585
// what that is), and returns 1.
8686
// The `payload` is passed (by libstd) to `__rust_panic_cleanup`, which is then expected to
8787
// return a `Box<dyn Any + Send + 'static>`.
88-
// In Miri, `miri_start_panic` is passed exactly that type, so we make the `payload` simply
88+
// In Miri, `miri_start_unwind` is passed exactly that type, so we make the `payload` simply
8989
// a pointer to `Box<dyn Any + Send + 'static>`.
9090

9191
// Get all the arguments.
@@ -141,7 +141,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
141141
// We set the return value of `try` to 1, since there was a panic.
142142
this.write_scalar(Scalar::from_i32(1), &catch_unwind.dest)?;
143143

144-
// The Thread's `panic_payload` holds what was passed to `miri_start_panic`.
144+
// The Thread's `panic_payload` holds what was passed to `miri_start_unwind`.
145145
// This is exactly the second argument we need to pass to `catch_fn`.
146146
let payload = this.active_thread_mut().panic_payloads.pop().unwrap();
147147

tests/fail/function_calls/check_callback_abi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn main() {
88
unsafe {
99
// Make sure we check the ABI when Miri itself invokes a function
1010
// as part of a shim implementation.
11-
std::intrinsics::r#try(
11+
std::intrinsics::catch_unwind(
1212
//~^ ERROR: calling a function with ABI C using caller ABI Rust
1313
std::mem::transmute::<extern "C" fn(*mut u8), _>(try_fn),
1414
std::ptr::null_mut(),

tests/fail/function_calls/check_callback_abi.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: Undefined Behavior: calling a function with ABI C using caller ABI Rust
22
--> $DIR/check_callback_abi.rs:LL:CC
33
|
4-
LL | / std::intrinsics::r#try(
4+
LL | / std::intrinsics::catch_unwind(
55
LL | |
66
LL | | std::mem::transmute::<extern "C" fn(*mut u8), _>(try_fn),
77
LL | | std::ptr::null_mut(),

tests/fail/intrinsics/simd-div-by-zero.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
#![feature(platform_intrinsics, repr_simd)]
1+
#![feature(core_intrinsics, repr_simd)]
22

3-
extern "platform-intrinsic" {
4-
pub(crate) fn simd_div<T>(x: T, y: T) -> T;
5-
}
3+
use std::intrinsics::simd::simd_div;
64

75
#[repr(simd)]
86
#[allow(non_camel_case_types)]

tests/fail/intrinsics/simd-div-overflow.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
#![feature(platform_intrinsics, repr_simd)]
1+
#![feature(core_intrinsics, repr_simd)]
22

3-
extern "platform-intrinsic" {
4-
pub(crate) fn simd_div<T>(x: T, y: T) -> T;
5-
}
3+
use std::intrinsics::simd::simd_div;
64

75
#[repr(simd)]
86
#[allow(non_camel_case_types)]

tests/fail/intrinsics/simd-reduce-invalid-bool.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
#![feature(platform_intrinsics, repr_simd)]
1+
#![feature(core_intrinsics, repr_simd)]
22

3-
extern "platform-intrinsic" {
4-
pub(crate) fn simd_reduce_any<T>(x: T) -> bool;
5-
}
3+
use std::intrinsics::simd::simd_reduce_any;
64

75
#[repr(simd)]
86
#[allow(non_camel_case_types)]

tests/fail/intrinsics/simd-rem-by-zero.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
#![feature(platform_intrinsics, repr_simd)]
1+
#![feature(core_intrinsics, repr_simd)]
22

3-
extern "platform-intrinsic" {
4-
pub(crate) fn simd_rem<T>(x: T, y: T) -> T;
5-
}
3+
use std::intrinsics::simd::simd_rem;
64

75
#[repr(simd)]
86
#[allow(non_camel_case_types)]

tests/fail/intrinsics/simd-select-bitmask-invalid.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
#![feature(platform_intrinsics, repr_simd)]
1+
#![feature(core_intrinsics, repr_simd)]
22

3-
extern "platform-intrinsic" {
4-
fn simd_select_bitmask<M, T>(m: M, yes: T, no: T) -> T;
5-
}
3+
use std::intrinsics::simd::simd_select_bitmask;
64

75
#[repr(simd)]
86
#[allow(non_camel_case_types)]

tests/fail/intrinsics/simd-select-invalid-bool.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
#![feature(platform_intrinsics, repr_simd)]
1+
#![feature(core_intrinsics, repr_simd)]
22

3-
extern "platform-intrinsic" {
4-
fn simd_select<M, T>(m: M, yes: T, no: T) -> T;
5-
}
3+
use std::intrinsics::simd::simd_select;
64

75
#[repr(simd)]
86
#[allow(non_camel_case_types)]

tests/fail/intrinsics/simd-shl-too-far.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
#![feature(platform_intrinsics, repr_simd)]
1+
#![feature(core_intrinsics, repr_simd)]
22

3-
extern "platform-intrinsic" {
4-
pub(crate) fn simd_shl<T>(x: T, y: T) -> T;
5-
}
3+
use std::intrinsics::simd::simd_shl;
64

75
#[repr(simd)]
86
#[allow(non_camel_case_types)]

tests/fail/intrinsics/simd-shr-too-far.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
#![feature(platform_intrinsics, repr_simd)]
1+
#![feature(core_intrinsics, repr_simd)]
22

3-
extern "platform-intrinsic" {
4-
pub(crate) fn simd_shr<T>(x: T, y: T) -> T;
5-
}
3+
use std::intrinsics::simd::simd_shr;
64

75
#[repr(simd)]
86
#[allow(non_camel_case_types)]

tests/fail/panic/bad_miri_start_panic.rs renamed to tests/fail/panic/bad_miri_start_unwind.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
#![feature(c_unwind)]
44

55
extern "C" {
6-
fn miri_start_panic(payload: *mut u8) -> !;
6+
fn miri_start_unwind(payload: *mut u8) -> !;
77
}
88

99
fn main() {
10-
unsafe { miri_start_panic(&mut 0) }
10+
unsafe { miri_start_unwind(&mut 0) }
1111
//~^ ERROR: unwinding past a stack frame that does not allow unwinding
1212
}

tests/fail/panic/bad_miri_start_panic.stderr renamed to tests/fail/panic/bad_miri_start_unwind.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
WARNING: the flag `-Zmiri-disable-abi-check` is deprecated and planned to be removed.
22
If you have a use-case for it, please file an issue.
33
error: Undefined Behavior: unwinding past a stack frame that does not allow unwinding
4-
--> $DIR/bad_miri_start_panic.rs:LL:CC
4+
--> $DIR/bad_miri_start_unwind.rs:LL:CC
55
|
6-
LL | unsafe { miri_start_panic(&mut 0) }
7-
| ^^^^^^^^^^^^^^^^^^^^^^^^ unwinding past a stack frame that does not allow unwinding
6+
LL | unsafe { miri_start_unwind(&mut 0) }
7+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ unwinding past a stack frame that does not allow unwinding
88
|
99
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
1010
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
1111
= note: BACKTRACE:
12-
= note: inside `main` at $DIR/bad_miri_start_panic.rs:LL:CC
12+
= note: inside `main` at $DIR/bad_miri_start_unwind.rs:LL:CC
1313

1414
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1515

tests/fail/panic/unwind_panic_abort.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
//! Unwinding despite `-C panic=abort` is an error.
44
55
extern "Rust" {
6-
fn miri_start_panic(payload: *mut u8) -> !;
6+
fn miri_start_unwind(payload: *mut u8) -> !;
77
}
88

99
fn main() {
1010
unsafe {
11-
miri_start_panic(&mut 0); //~ ERROR: unwinding past a stack frame that does not allow unwinding
11+
miri_start_unwind(&mut 0); //~ ERROR: unwinding past a stack frame that does not allow unwinding
1212
}
1313
}

tests/fail/panic/unwind_panic_abort.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: Undefined Behavior: unwinding past a stack frame that does not allow unwinding
22
--> $DIR/unwind_panic_abort.rs:LL:CC
33
|
4-
LL | miri_start_panic(&mut 0);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^ unwinding past a stack frame that does not allow unwinding
4+
LL | miri_start_unwind(&mut 0);
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ unwinding past a stack frame that does not allow unwinding
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/pass/float_nan.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(float_gamma, portable_simd, core_intrinsics, platform_intrinsics)]
1+
#![feature(float_gamma, portable_simd, core_intrinsics)]
22
use std::collections::HashSet;
33
use std::fmt;
44
use std::hash::Hash;
@@ -525,12 +525,6 @@ fn test_simd() {
525525
use std::intrinsics::simd::*;
526526
use std::simd::*;
527527

528-
extern "platform-intrinsic" {
529-
fn simd_fsqrt<T>(x: T) -> T;
530-
fn simd_ceil<T>(x: T) -> T;
531-
fn simd_fma<T>(x: T, y: T, z: T) -> T;
532-
}
533-
534528
let nan = F32::nan(Neg, Quiet, 0).as_f32();
535529
check_all_outcomes(
536530
HashSet::from_iter([F32::nan(Pos, Quiet, 0), F32::nan(Neg, Quiet, 0)]),

tests/pass/function_calls/disable_abi_check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn main() {
1515
unsafe {
1616
let _ = malloc(0);
1717
std::mem::transmute::<fn(), extern "C" fn()>(foo)();
18-
std::intrinsics::r#try(
18+
std::intrinsics::catch_unwind(
1919
std::mem::transmute::<extern "C" fn(*mut u8), _>(try_fn),
2020
std::ptr::null_mut(),
2121
|_, _| unreachable!(),

tests/pass/portable-simd-ptrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Separate test without strict provenance
22
//@compile-flags: -Zmiri-permissive-provenance
3-
#![feature(portable_simd, platform_intrinsics)]
3+
#![feature(portable_simd)]
44
use std::ptr;
55
use std::simd::prelude::*;
66

tests/pass/portable-simd.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@compile-flags: -Zmiri-strict-provenance
2-
#![feature(portable_simd, platform_intrinsics, adt_const_params, inline_const, core_intrinsics)]
2+
#![feature(portable_simd, adt_const_params, inline_const, core_intrinsics)]
33
#![allow(incomplete_features, internal_features)]
44
use std::intrinsics::simd as intrinsics;
55
use std::ptr;
@@ -216,10 +216,7 @@ fn simd_ops_i32() {
216216
}
217217

218218
fn simd_mask() {
219-
extern "platform-intrinsic" {
220-
pub(crate) fn simd_bitmask<T, U>(x: T) -> U;
221-
pub(crate) fn simd_select_bitmask<M, T>(m: M, yes: T, no: T) -> T;
222-
}
219+
use std::intrinsics::simd::*;
223220

224221
let intmask = Mask::from_int(i32x4::from_array([0, -1, 0, 0]));
225222
assert_eq!(intmask, Mask::from_array([false, true, false, false]));
@@ -493,9 +490,6 @@ fn simd_round() {
493490

494491
fn simd_intrinsics() {
495492
use intrinsics::*;
496-
extern "platform-intrinsic" {
497-
fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U;
498-
}
499493

500494
unsafe {
501495
// Make sure simd_eq returns all-1 for `true`

tests/pass/simd-intrinsic-generic-elements.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(repr_simd, platform_intrinsics)]
1+
#![feature(repr_simd)]
22

33
#[repr(simd)]
44
#[derive(Copy, Clone, Debug, PartialEq)]

tests/utils/miri_extern.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ extern "Rust" {
5656
///
5757
/// This is internal and unstable and should not be used; we give it here
5858
/// just to be complete.
59-
pub fn miri_start_panic(payload: *mut u8) -> !;
59+
pub fn miri_start_unwind(payload: *mut u8) -> !;
6060

6161
/// Miri-provided extern function to get the internal unique identifier for the allocation that a pointer
6262
/// points to. If this pointer is invalid (not pointing to an allocation), interpretation will abort.

0 commit comments

Comments
 (0)