Skip to content

Commit

Permalink
Auto merge of #3254 - rust-lang:rustup-2024-01-06, r=saethlin
Browse files Browse the repository at this point in the history
Automatic Rustup
  • Loading branch information
bors committed Jan 6, 2024
2 parents 8c0da96 + ec2f768 commit ca4374a
Show file tree
Hide file tree
Showing 23 changed files with 35 additions and 26 deletions.
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a59a98024e3fe317e37e218392f5c34e932b2394
5bcd86d89b2b7b6a490f7e075dd4eb346deb5f98
4 changes: 2 additions & 2 deletions src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,12 +454,12 @@ pub fn report_msg<'tcx>(
let span = stacktrace.first().map_or(DUMMY_SP, |fi| fi.span);
let sess = machine.tcx.sess;
let level = match diag_level {
DiagLevel::Error => Level::Error { lint: false },
DiagLevel::Error => Level::Error,
DiagLevel::Warning => Level::Warning(None),
DiagLevel::Note => Level::Note,
};
let mut err = DiagnosticBuilder::<()>::new(sess.dcx(), level, title);
err.set_span(span);
err.span(span);

// Show main message.
if span != DUMMY_SP {
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/both_borrows/newtype_pair_retagging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

//@[stack]error-in-other-file: which is strongly protected
//@[tree]error-in-other-file: /deallocation through .* is forbidden/
struct Newtype<'a>(&'a mut i32, i32);
struct Newtype<'a>(#[allow(dead_code)] &'a mut i32, #[allow(dead_code)] i32);

fn dealloc_while_running(_n: Newtype<'_>, dealloc: impl FnOnce()) {
dealloc();
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/both_borrows/newtype_retagging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//@[stack]error-in-other-file: which is strongly protected
//@[tree]error-in-other-file: /deallocation through .* is forbidden/

struct Newtype<'a>(&'a mut i32);
struct Newtype<'a>(#[allow(dead_code)] &'a mut i32);

fn dealloc_while_running(_n: Newtype<'_>, dealloc: impl FnOnce()) {
dealloc();
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/concurrency/read_only_atomic_load_large.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use std::sync::atomic::{AtomicI64, Ordering};

#[repr(align(8))]
struct AlignedI64(i64);
struct AlignedI64(#[allow(dead_code)] i64);

fn main() {
static X: AlignedI64 = AlignedI64(0);
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/dangling_pointers/dyn_size.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// should find the bug even without retagging
//@compile-flags: -Zmiri-disable-stacked-borrows

struct SliceWithHead(u8, [u8]);
struct SliceWithHead(#[allow(dead_code)] u8, #[allow(dead_code)] [u8]);

fn main() {
let buf = [0u32; 1];
Expand Down
7 changes: 6 additions & 1 deletion tests/fail/function_pointers/abi_mismatch_array_vs_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
// Some targets treat arrays and structs very differently. We would probably catch that on those
// targets since we check the `PassMode`; here we ensure that we catch it on *all* targets
// (in particular, on x86-64 the pass mode is `Indirect` for both of these).
struct S(i32, i32, i32, i32);
struct S(
#[allow(dead_code)] i32,
#[allow(dead_code)] i32,
#[allow(dead_code)] i32,
#[allow(dead_code)] i32,
);
type A = [i32; 4];

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/issue-miri-1112.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
trait Empty {}

#[repr(transparent)]
pub struct FunnyPointer(dyn Empty);
pub struct FunnyPointer(#[allow(dead_code)] dyn Empty);

#[repr(C)]
pub struct Meta {
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/unaligned_pointers/drop_in_place.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//@compile-flags: -Cdebug-assertions=no

#[repr(transparent)]
struct HasDrop(u8);
struct HasDrop(#[allow(dead_code)] u8);

impl Drop for HasDrop {
fn drop(&mut self) {}
Expand Down
4 changes: 2 additions & 2 deletions tests/fail/unaligned_pointers/promise_alignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod utils;

#[repr(align(8))]
#[derive(Copy, Clone)]
struct Align8(u64);
struct Align8(#[allow(dead_code)] u64);

fn main() {
let buffer = [0u32; 128]; // get some 4-aligned memory
Expand Down Expand Up @@ -35,7 +35,7 @@ fn main() {
if cfg!(read_unaligned_ptr) {
#[repr(align(16))]
#[derive(Copy, Clone)]
struct Align16(u128);
struct Align16(#[allow(dead_code)] u128);

let align16 = if align8.addr() % 16 == 0 { align8 } else { align8.wrapping_add(2) };
assert!(align16.addr() % 16 == 0);
Expand Down
4 changes: 2 additions & 2 deletions tests/pass/align_offset_symbolic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn test_align_to() {
{
#[repr(align(8))]
#[derive(Copy, Clone)]
struct Align8(u64);
struct Align8(#[allow(dead_code)] u64);

let (_l, m, _r) = unsafe { s.align_to::<Align8>() };
assert!(m.len() > 0);
Expand Down Expand Up @@ -97,7 +97,7 @@ fn huge_align() {
const SIZE: usize = 1 << 30;
#[cfg(target_pointer_width = "16")]
const SIZE: usize = 1 << 13;
struct HugeSize([u8; SIZE - 1]);
struct HugeSize(#[allow(dead_code)] [u8; SIZE - 1]);
let _ = std::ptr::invalid::<HugeSize>(SIZE).align_offset(SIZE);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/pass/box-custom-alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn test1() {
}

// Make the allocator itself so big that the Box is not even a ScalarPair any more.
struct OnceAllocRef<'s, 'a>(&'s OnceAlloc<'a>, u64);
struct OnceAllocRef<'s, 'a>(&'s OnceAlloc<'a>, #[allow(dead_code)] u64);

unsafe impl<'shared, 'a: 'shared> Allocator for OnceAllocRef<'shared, 'a> {
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
Expand Down
2 changes: 1 addition & 1 deletion tests/pass/box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn boxed_pair_to_vec() {
}

#[derive(Debug)]
struct Foo(u64);
struct Foo(#[allow(dead_code)] u64);
fn reinterstruct(box_pair: Box<PairFoo>) -> Vec<Foo> {
let ref_pair = Box::leak(box_pair) as *mut PairFoo;
let ptr_foo = unsafe { std::ptr::addr_of_mut!((*ref_pair).fst) };
Expand Down
2 changes: 1 addition & 1 deletion tests/pass/fat_ptr.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// test that ordinary fat pointer operations work.

struct Wrapper<T: ?Sized>(u32, T);
struct Wrapper<T: ?Sized>(#[allow(dead_code)] u32, T);

struct FatPtrContainer<'a> {
ptr: &'a [u8],
Expand Down
2 changes: 1 addition & 1 deletion tests/pass/issues/issue-3200-packed2-field-offset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use std::mem;

#[repr(packed(4))]
struct Slice([u32]);
struct Slice(#[allow(dead_code)] [u32]);

#[repr(packed(2), C)]
struct PackedSized {
Expand Down
2 changes: 1 addition & 1 deletion tests/pass/issues/issue-34571.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#[repr(u8)]
enum Foo {
Foo(u8),
Foo(#[allow(dead_code)] u8),
}

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion tests/pass/issues/issue-36278-prefix-nesting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use std::mem;

const SZ: usize = 100;
struct P<T: ?Sized>([u8; SZ], T);
struct P<T: ?Sized>(#[allow(dead_code)] [u8; SZ], T);

type Ack<T> = P<P<T>>;

Expand Down
2 changes: 1 addition & 1 deletion tests/pass/packed_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fn test_inner_packed() {
struct Inner(u32);

#[derive(Clone, Copy)]
struct Outer(u8, Inner);
struct Outer(#[allow(dead_code)] u8, Inner);

let o = Outer(0, Inner(42));
let _x = o.1;
Expand Down
2 changes: 1 addition & 1 deletion tests/pass/stacked-borrows/no_field_retagging.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@compile-flags: -Zmiri-retag-fields=none

struct Newtype<'a>(&'a mut i32);
struct Newtype<'a>(#[allow(dead_code)] &'a mut i32);

fn dealloc_while_running(_n: Newtype<'_>, dealloc: impl FnOnce()) {
dealloc();
Expand Down
6 changes: 5 additions & 1 deletion tests/pass/stacked-borrows/non_scalar_field_retagging.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
//@compile-flags: -Zmiri-retag-fields=scalar

struct Newtype<'a>(&'a mut i32, i32, i32);
struct Newtype<'a>(
#[allow(dead_code)] &'a mut i32,
#[allow(dead_code)] i32,
#[allow(dead_code)] i32,
);

fn dealloc_while_running(_n: Newtype<'_>, dealloc: impl FnOnce()) {
dealloc();
Expand Down
2 changes: 1 addition & 1 deletion tests/pass/stacked-borrows/stacked-borrows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ fn not_unpin_not_protected() {
// the self-referential-coroutine situation, it does not seem worth the potential trouble.)
use std::marker::PhantomPinned;

pub struct NotUnpin(i32, PhantomPinned);
pub struct NotUnpin(#[allow(dead_code)] i32, PhantomPinned);

fn inner(x: &mut NotUnpin, f: fn(&mut NotUnpin)) {
// `f` may mutate, but it may not deallocate!
Expand Down
2 changes: 1 addition & 1 deletion tests/pass/tree_borrows/tree-borrows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ fn not_unpin_not_protected() {
// the self-referential-coroutine situation, it does not seem worth the potential trouble.)
use std::marker::PhantomPinned;

pub struct NotUnpin(i32, PhantomPinned);
pub struct NotUnpin(#[allow(dead_code)] i32, PhantomPinned);

fn inner(x: &mut NotUnpin, f: fn(&mut NotUnpin)) {
// `f` may mutate, but it may not deallocate!
Expand Down
2 changes: 1 addition & 1 deletion tests/pass/zst_variant_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ impl Drop for Foo {
static mut FOO: bool = false;

enum Bar {
A(Box<i32>),
A(#[allow(dead_code)] Box<i32>),
B(Foo),
}

Expand Down

0 comments on commit ca4374a

Please sign in to comment.