This commit is contained in:
The Miri Cronjob Bot 2026-02-15 05:27:15 +00:00 committed by Ralf Jung
parent 0f8640376d
commit 702793191f
5 changed files with 13 additions and 9 deletions

View file

@ -5,7 +5,7 @@ enum Never {}
fn main() {
unsafe {
match *std::ptr::null::<Result<Never, Never>>() {
//~^ ERROR: read discriminant of an uninhabited enum variant
//~^ ERROR: read discriminant of an uninhabited enum variant
Ok(_) => {
lol();
}

View file

@ -22,7 +22,8 @@ fn main() {
// After rust-lang/rust#138961, constructing the closure performs a reborrow of r.
// Nevertheless, the discriminant is only actually inspected when the closure
// is called.
match r { //~ ERROR: read discriminant of an uninhabited enum variant
match r {
//~^ ERROR: read discriminant of an uninhabited enum variant
E::V0 => {}
E::V1(_) => {}
}

View file

@ -4,8 +4,8 @@
#[repr(C)]
#[allow(dead_code)]
enum E {
V0, // discriminant: 0
V1(!), // 1
V0, // discriminant: 0
V1(!), // 1
}
fn main() {
@ -14,7 +14,8 @@ fn main() {
let val = 1u32;
let ptr = (&raw const val).cast::<E>();
let r = unsafe { &*ptr };
match r { //~ ERROR: read discriminant of an uninhabited enum variant
match r {
//~^ ERROR: read discriminant of an uninhabited enum variant
E::V0 => {}
E::V1(_) => {}
}

View file

@ -20,12 +20,13 @@ fn main() {
let x: &[u8; 2] = &[21, 37];
let y: &Exhaustive = std::mem::transmute(x);
match y {
Exhaustive::A(_) => {},
Exhaustive::A(_) => {}
}
let y: &NonExhaustive = std::mem::transmute(x);
match y { //~ ERROR: enum value has invalid tag
NonExhaustive::A(_) => {},
match y {
//~^ ERROR: enum value has invalid tag
NonExhaustive::A(_) => {}
}
}
}

View file

@ -28,7 +28,8 @@ fn main() {
_ => {}
}
match *nexh { //~ ERROR: memory is uninitialized
match *nexh {
//~^ ERROR: memory is uninitialized
NonExhaustive::A(ref _val) => {}
_ => {}
}