Skip to content

Commit 6a57043

Browse files
committed
Auto merge of #3597 - rust-lang:rustup-2024-05-11, r=RalfJung
Automatic Rustup
2 parents 9f63c72 + 3fec060 commit 6a57043

17 files changed

+71
-36
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
d568423a7a4ddb4b49323d96078a22f94df55fbd
1+
ef15976387ad9c1cdceaabf469e0cf35f5852f6d

src/borrow_tracker/stacked_borrows/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl NewPermission {
136136
cx: &crate::MiriInterpCx<'_, 'tcx>,
137137
) -> Self {
138138
// `ty` is not the `Box` but the field of the Box with this pointer (due to allocator handling).
139-
let pointee = ty.builtin_deref(true).unwrap().ty;
139+
let pointee = ty.builtin_deref(true).unwrap();
140140
if pointee.is_unpin(*cx.tcx, cx.param_env()) {
141141
// A regular box. On `FnEntry` this is `noalias`, but not `dereferenceable` (hence only
142142
// a weak protector).

src/borrow_tracker/tree_borrows/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ impl<'tcx> NewPermission {
173173
cx: &crate::MiriInterpCx<'_, 'tcx>,
174174
zero_size: bool,
175175
) -> Option<Self> {
176-
let pointee = ty.builtin_deref(true).unwrap().ty;
176+
let pointee = ty.builtin_deref(true).unwrap();
177177
pointee.is_unpin(*cx.tcx, cx.param_env()).then_some(()).map(|()| {
178178
// Regular `Unpin` box, give it `noalias` but only a weak protector
179179
// because it is valid to deallocate it within the function.

src/intrinsics/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
117117

118118
"write_bytes" | "volatile_set_memory" => {
119119
let [ptr, val_byte, count] = check_arg_count(args)?;
120-
let ty = ptr.layout.ty.builtin_deref(true).unwrap().ty;
120+
let ty = ptr.layout.ty.builtin_deref(true).unwrap();
121121
let ty_layout = this.layout_of(ty)?;
122122
let val_byte = this.read_scalar(val_byte)?.to_u8()?;
123123
let ptr = this.read_pointer(ptr)?;

src/intrinsics/simd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
267267
Op::WrappingOffset => {
268268
let ptr = left.to_scalar().to_pointer(this)?;
269269
let offset_count = right.to_scalar().to_target_isize(this)?;
270-
let pointee_ty = left.layout.ty.builtin_deref(true).unwrap().ty;
270+
let pointee_ty = left.layout.ty.builtin_deref(true).unwrap();
271271

272272
let pointee_size = i64::try_from(this.layout_of(pointee_ty)?.size.bytes()).unwrap();
273273
let offset_bytes = offset_count.wrapping_mul(pointee_size);

src/shims/unix/foreign_items.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
378378
.builtin_deref(true)
379379
.ok_or_else(|| err_ub_format!(
380380
"wrong signature used for `pthread_key_create`: first argument must be a raw pointer."
381-
))?
382-
.ty;
381+
))?;
383382
let key_layout = this.layout_of(key_type)?;
384383

385384
// Create key and write it into the memory where `key_ptr` wants it.

src/shims/x86/avx2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::rustc_middle::ty::layout::LayoutOf as _;
21
use rustc_middle::mir;
2+
use rustc_middle::ty::layout::LayoutOf as _;
33
use rustc_middle::ty::Ty;
44
use rustc_span::Symbol;
55
use rustc_target::spec::abi::Abi;

tests/fail/enum-set-discriminant-niche-variant-wrong.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![feature(custom_mir)]
33

44
use std::intrinsics::mir::*;
5-
use std::num::NonZeroI32;
5+
use std::num::NonZero;
66

77
// We define our own option type so that we can control the variant indices.
88
#[allow(unused)]
@@ -13,7 +13,7 @@ enum Option<T> {
1313
use Option::*;
1414

1515
#[custom_mir(dialect = "runtime", phase = "optimized")]
16-
fn set_discriminant(ptr: &mut Option<NonZeroI32>) {
16+
fn set_discriminant(ptr: &mut Option<NonZero<i32>>) {
1717
mir! {
1818
{
1919
// We set the discriminant to `Some`, which is a NOP since this is the niched variant.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use std::num::*;
1+
use std::num::NonZero;
22

33
#[repr(C)]
4-
struct S1(NonZeroI32);
4+
struct S1(NonZero<i32>);
55

66
#[repr(C)]
77
struct S2(i32);
@@ -11,6 +11,6 @@ fn callee(_s: S2) {}
1111
fn main() {
1212
let fnptr: fn(S2) = callee;
1313
let fnptr: fn(S1) = unsafe { std::mem::transmute(fnptr) };
14-
fnptr(S1(NonZeroI32::new(1).unwrap()));
14+
fnptr(S1(NonZero::new(1).unwrap()));
1515
//~^ ERROR: calling a function with argument of type S2 passing data of type S1
1616
}

tests/fail/function_pointers/abi_mismatch_repr_C.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: Undefined Behavior: calling a function with argument of type S2 passing data of type S1
22
--> $DIR/abi_mismatch_repr_C.rs:LL:CC
33
|
4-
LL | fnptr(S1(NonZeroI32::new(1).unwrap()));
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with argument of type S2 passing data of type S1
4+
LL | fnptr(S1(NonZero::new(1).unwrap()));
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with argument of type S2 passing data of type S1
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

0 commit comments

Comments
 (0)