Skip to content

Commit 8de9fac

Browse files
authored
Unrolled build for rust-lang#118358
Rollup merge of rust-lang#118358 - RalfJung:const-tests, r=WaffleLapkin make const tests independent of std debug assertions Fixes some fallout from rust-lang#110303: `ignore-debug` is bad since it makes it very annoying to develop rustc with debug assertions enabled. These tests do not really provide any interesting test coverage, we already got plenty of other tests that check that we detect invalid enums. So we can just remove them.
2 parents aa33051 + 8892d29 commit 8de9fac

File tree

6 files changed

+112
-232
lines changed

6 files changed

+112
-232
lines changed

tests/ui/consts/const-eval/raw-bytes.32bit.stderr

+54-76
Large diffs are not rendered by default.

tests/ui/consts/const-eval/raw-bytes.64bit.stderr

+54-76
Large diffs are not rendered by default.

tests/ui/consts/const-eval/raw-bytes.rs

+4-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// stderr-per-bitwidth
22
// ignore-endian-big
33
// ignore-tidy-linelength
4-
// ignore-debug debug assertions catch some UB too early
54
// normalize-stderr-test "╾─*ALLOC[0-9]+(\+[a-z0-9]+)?─*╼" -> "╾ALLOC_ID$1╼"
65

76
#![feature(never_type, rustc_attrs, ptr_metadata, slice_from_ptr_range, const_slice_from_ptr_range)]
@@ -13,6 +12,8 @@ use std::ptr::NonNull;
1312
use std::num::{NonZeroU8, NonZeroUsize};
1413
use std::slice::{from_ptr_range, from_raw_parts};
1514

15+
// # Bad enums and chars
16+
1617
#[repr(usize)]
1718
#[derive(Copy, Clone)]
1819
enum Enum {
@@ -51,6 +52,7 @@ const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8)
5152
const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
5253
//~^ ERROR is undefined behavior
5354

55+
// # Bad pointers and references
5456

5557
const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
5658
//~^ ERROR it is undefined behavior to use this value
@@ -197,16 +199,7 @@ const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92
197199
const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
198200
//~^ ERROR it is undefined behavior to use this value
199201

200-
201-
// not ok, since alignment needs to be non-zero.
202-
const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) };
203-
//~^ ERROR it is undefined behavior to use this value
204-
205-
// not ok, since alignment needs to be a power of two.
206-
const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) };
207-
//~^ ERROR it is undefined behavior to use this value
208-
209-
202+
// Uninhabited types
210203
const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR undefined behavior
211204
const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR undefined behavior
212205
const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) }; //~ ERROR undefined behavior

tests/ui/consts/std/alloc.32bit.stderr

-25
This file was deleted.

tests/ui/consts/std/alloc.64bit.stderr

-25
This file was deleted.

tests/ui/consts/std/alloc.rs

-19
This file was deleted.

0 commit comments

Comments
 (0)