fmt
This commit is contained in:
parent
0f8640376d
commit
702793191f
5 changed files with 13 additions and 9 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(_) => {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(_) => {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(_) => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ fn main() {
|
|||
_ => {}
|
||||
}
|
||||
|
||||
match *nexh { //~ ERROR: memory is uninitialized
|
||||
match *nexh {
|
||||
//~^ ERROR: memory is uninitialized
|
||||
NonExhaustive::A(ref _val) => {}
|
||||
_ => {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue