This commit is contained in:
Ralf Jung 2022-06-29 21:31:27 -04:00
parent 5974e7d4a9
commit a2e61aeeff
41 changed files with 73 additions and 73 deletions

View File

@ -1 +1 @@
ddcbba036aee08f0709f98a92a342a278eae5c05
bf45371f262e184b4a77adea88c8ac01ac79759b

View File

@ -12,7 +12,7 @@ fn main() {
// However, it drops provenance when transmuting to TwoPtrs, so this is UB.
let val = unsafe {
transmute::<_, &str>(
//~^ ERROR type validation failed: encountered a dangling reference
//~^ ERROR constructing invalid value: encountered a dangling reference
!mask & transmute::<_, TwoPtrs>("false !")
| mask & transmute::<_, TwoPtrs>("true !"),
)

View File

@ -1,4 +1,4 @@
error: Undefined Behavior: type validation failed: encountered a dangling reference (address $HEX is unallocated)
error: Undefined Behavior: constructing invalid value: encountered a dangling reference (address $HEX is unallocated)
--> $DIR/branchless-select-i128-pointer.rs:LL:CC
|
LL | / transmute::<_, &str>(
@ -6,7 +6,7 @@ LL | |
LL | | !mask & transmute::<_, TwoPtrs>("false !")
LL | | | mask & transmute::<_, TwoPtrs>("true !"),
LL | | )
| |_____________^ type validation failed: encountered a dangling reference (address $HEX is unallocated)
| |_____________^ constructing invalid value: encountered a dangling reference (address $HEX is unallocated)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered invalid drop function pointer in vtable (function has incompatible signature)
error: Undefined Behavior: constructing invalid value: encountered invalid drop function pointer in vtable (function has incompatible signature)
--> $DIR/issue-miri-1112.rs:LL:CC
|
LL | let obj = std::mem::transmute::<FatPointer, *mut FunnyPointer>(obj);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop function pointer in vtable (function has incompatible signature)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid drop function pointer in vtable (function has incompatible signature)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered vtable pointer does not have permission to read drop function pointer
error: Undefined Behavior: constructing invalid value: encountered vtable pointer does not have permission to read drop function pointer
--> RUSTLIB/core/src/ptr/metadata.rs:LL:CC
|
LL | unsafe { PtrRepr { components: PtrComponents { data_address, metadata } }.const_ptr }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered vtable pointer does not have permission to read drop function pointer
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered vtable pointer does not have permission to read drop function pointer
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered uninitialized bytes, but expected initialized bytes
error: Undefined Behavior: constructing invalid value: encountered uninitialized bytes, but expected initialized bytes
--> $DIR/transmute-pair-uninit.rs:LL:CC
|
LL | let v = unsafe { *z.offset(first_undef) };
| ^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized bytes
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected initialized bytes
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -7,7 +7,7 @@ const N: usize = 8;
fn main() {
let bad = unsafe {
std::mem::transmute::<&[u8], [u8; N]>(&[1u8])
//~^ ERROR: type validation failed: encountered a pointer
//~^ ERROR: constructing invalid value: encountered a pointer
};
let _val = bad[0] + bad[bad.len() - 1];
}

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered a pointer, but expected plain (non-pointer) bytes
error: Undefined Behavior: constructing invalid value: encountered a pointer, but expected plain (non-pointer) bytes
--> $DIR/transmute_fat1.rs:LL:CC
|
LL | std::mem::transmute::<&[u8], [u8; N]>(&[1u8])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected plain (non-pointer) bytes
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a pointer, but expected plain (non-pointer) bytes
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered uninitialized bytes, but expected initialized bytes
error: Undefined Behavior: constructing invalid value: encountered uninitialized bytes, but expected initialized bytes
--> $DIR/uninit_byte_read.rs:LL:CC
|
LL | let undef = unsafe { *v.get_unchecked(5) };
| ^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized bytes
| ^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected initialized bytes
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,4 +1,4 @@
fn main() {
let _val = unsafe { std::mem::MaybeUninit::<*const u8>::uninit().assume_init() };
//~^ ERROR type validation failed at .value: encountered uninitialized raw pointer
//~^ ERROR constructing invalid value at .value: encountered uninitialized raw pointer
}

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed at .value: encountered uninitialized raw pointer
error: Undefined Behavior: constructing invalid value at .value: encountered uninitialized raw pointer
--> $DIR/uninit_raw_ptr.rs:LL:CC
|
LL | let _val = unsafe { std::mem::MaybeUninit::<*const u8>::uninit().assume_init() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .value: encountered uninitialized raw pointer
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .value: encountered uninitialized raw pointer
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered a null reference
error: Undefined Behavior: constructing invalid value: encountered a null reference
--> $DIR/cast_fn_ptr1.rs:LL:CC
|
LL | g(0usize as *const i32)
| ^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a null reference
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered a null reference
error: Undefined Behavior: constructing invalid value: encountered a null reference
--> $DIR/cast_fn_ptr2.rs:LL:CC
|
LL | let _x = g();
| ^^^ type validation failed: encountered a null reference
| ^^^ constructing invalid value: encountered a null reference
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered a dangling reference (address 0x10 is unallocated)
error: Undefined Behavior: constructing invalid value: encountered a dangling reference (address 0x10 is unallocated)
--> $DIR/dangling_ref1.rs:LL:CC
|
LL | let _x: &i32 = unsafe { mem::transmute(16usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (address 0x10 is unallocated)
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (address 0x10 is unallocated)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered a dangling reference (going beyond the bounds of its allocation)
error: Undefined Behavior: constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
--> $DIR/dangling_ref2.rs:LL:CC
|
LL | let _x: &i32 = unsafe { mem::transmute(ptr) };
| ^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (going beyond the bounds of its allocation)
| ^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered a dangling reference (use-after-free)
error: Undefined Behavior: constructing invalid value: encountered a dangling reference (use-after-free)
--> $DIR/dangling_ref3.rs:LL:CC
|
LL | let _x: &i32 = unsafe { mem::transmute(dangling()) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (use-after-free)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (use-after-free)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered 0x02, but expected a boolean
error: Undefined Behavior: constructing invalid value: encountered 0x02, but expected a boolean
--> $DIR/invalid_bool.rs:LL:CC
|
LL | let _b = unsafe { std::mem::transmute::<u8, bool>(2) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x02, but expected a boolean
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x02, but expected a boolean
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered uninitialized bytes, but expected a boolean
error: Undefined Behavior: constructing invalid value: encountered uninitialized bytes, but expected a boolean
--> $DIR/invalid_bool_uninit.rs:LL:CC
|
LL | let _b = unsafe { MyUninit { init: () }.uninit };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a boolean
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a boolean
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered $HEX, but expected a valid unicode scalar value (in `0..=$HEX` but not in `$HEX..=$HEX`)
error: Undefined Behavior: constructing invalid value: encountered $HEX, but expected a valid unicode scalar value (in `0..=$HEX` but not in `$HEX..=$HEX`)
--> $DIR/invalid_char.rs:LL:CC
|
LL | let _val = match unsafe { std::mem::transmute::<i32, char>(-1) } {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered $HEX, but expected a valid unicode scalar value (in `0..=$HEX` but not in `$HEX..=$HEX`)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered $HEX, but expected a valid unicode scalar value (in `0..=$HEX` but not in `$HEX..=$HEX`)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=$HEX` but not in `$HEX..=$HEX`)
error: Undefined Behavior: constructing invalid value: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=$HEX` but not in `$HEX..=$HEX`)
--> $DIR/invalid_char_uninit.rs:LL:CC
|
LL | let _b = unsafe { MyUninit { init: () }.uninit };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=$HEX` but not in `$HEX..=$HEX`)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=$HEX` but not in `$HEX..=$HEX`)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -7,5 +7,5 @@ pub enum Foo {
}
fn main() {
let _f = unsafe { std::mem::transmute::<i32, Foo>(42) }; //~ ERROR type validation failed at .<enum-tag>: encountered 0x0000002a, but expected a valid enum tag
let _f = unsafe { std::mem::transmute::<i32, Foo>(42) }; //~ ERROR constructing invalid value at .<enum-tag>: encountered 0x0000002a, but expected a valid enum tag
}

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed at .<enum-tag>: encountered $HEX, but expected a valid enum tag
error: Undefined Behavior: constructing invalid value at .<enum-tag>: encountered $HEX, but expected a valid enum tag
--> $DIR/invalid_enum_tag.rs:LL:CC
|
LL | ... { std::mem::transmute::<i32, Foo>(42) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered $HEX, but expected a valid enum tag
LL | let _f = unsafe { std::mem::transmute::<i32, Foo>(42) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered $HEX, but expected a valid enum tag
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -268,5 +268,5 @@ union MyUninit {
}
fn main() {
let _a = unsafe { MyUninit { init: () }.uninit }; //~ ERROR type validation failed at .<enum-tag>: encountered uninitialized bytes, but expected a valid enum tag
let _a = unsafe { MyUninit { init: () }.uninit }; //~ ERROR constructing invalid value at .<enum-tag>: encountered uninitialized bytes, but expected a valid enum tag
}

View File

@ -1,9 +1,9 @@
WARNING: `-Zmiri-allow-uninit-numbers` is deprecated and planned to be removed. Please let us know at <https://github.com/rust-lang/miri/issues/2187> if you rely on this flag.
error: Undefined Behavior: type validation failed at .<enum-tag>: encountered uninitialized bytes, but expected a valid enum tag
error: Undefined Behavior: constructing invalid value at .<enum-tag>: encountered uninitialized bytes, but expected a valid enum tag
--> $DIR/invalid_enum_tag_256variants_uninit.rs:LL:CC
|
LL | let _a = unsafe { MyUninit { init: () }.uninit };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered uninitialized bytes, but expected a valid enum tag
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered uninitialized bytes, but expected a valid enum tag
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered a null function pointer
error: Undefined Behavior: constructing invalid value: encountered a null function pointer
--> $DIR/invalid_fnptr_null.rs:LL:CC
|
LL | let _b: fn() = unsafe { std::mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a null function pointer
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null function pointer
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered uninitialized bytes, but expected a proper pointer or integer value
error: Undefined Behavior: constructing invalid value: encountered uninitialized bytes, but expected a proper pointer or integer value
--> $DIR/invalid_fnptr_uninit.rs:LL:CC
|
LL | let _b = unsafe { MyUninit { init: () }.uninit };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a proper pointer or integer value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a proper pointer or integer value
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered dangling vtable pointer in wide pointer
error: Undefined Behavior: constructing invalid value: encountered dangling vtable pointer in wide pointer
--> $DIR/invalid_wide_raw.rs:LL:CC
|
LL | dbg!(S { x: unsafe { std::mem::transmute((0usize, 0usize)) } });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling vtable pointer in wide pointer
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered dangling vtable pointer in wide pointer
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered 0, but expected something greater or equal to 1
error: Undefined Behavior: constructing invalid value: encountered 0, but expected something greater or equal to 1
--> $DIR/nonzero.rs:LL:CC
|
LL | let _x = Some(unsafe { NonZero(0) });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected something greater or equal to 1
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered a pointer, but expected plain (non-pointer) bytes
error: Undefined Behavior: constructing invalid value: encountered a pointer, but expected plain (non-pointer) bytes
--> $DIR/ptr_integer_array_transmute.rs:LL:CC
|
LL | let _i: [usize; 1] = unsafe { std::mem::transmute(r) };
| ^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected plain (non-pointer) bytes
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a pointer, but expected plain (non-pointer) bytes
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered a box pointing to uninhabited type !
error: Undefined Behavior: constructing invalid value: encountered a box pointing to uninhabited type !
--> $DIR/ref_to_uninhabited1.rs:LL:CC
|
LL | let x: Box<!> = transmute(&mut 42);
| ^^^^^^^^^^^^^^^^^^ type validation failed: encountered a box pointing to uninhabited type !
| ^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a box pointing to uninhabited type !
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered a reference pointing to uninhabited type (i32, Void)
error: Undefined Behavior: constructing invalid value: encountered a reference pointing to uninhabited type (i32, Void)
--> $DIR/ref_to_uninhabited2.rs:LL:CC
|
LL | let _x: &(i32, Void) = transmute(&42);
| ^^^^^^^^^^^^^^ type validation failed: encountered a reference pointing to uninhabited type (i32, Void)
| ^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type (i32, Void)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered invalid reference metadata: slice is bigger than largest supported object
error: Undefined Behavior: constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object
--> $DIR/too-big-slice.rs:LL:CC
|
LL | let _x: &[u8] = mem::transmute((ptr, usize::MAX));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid reference metadata: slice is bigger than largest supported object
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed: encountered invalid reference metadata: total size is bigger than largest supported object
error: Undefined Behavior: constructing invalid value: encountered invalid reference metadata: total size is bigger than largest supported object
--> $DIR/too-big-unsized.rs:LL:CC
|
LL | let _x: &MySlice = mem::transmute((ptr, isize::MAX as usize));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid reference metadata: total size is bigger than largest supported object
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: total size is bigger than largest supported object
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -14,6 +14,6 @@ fn main() {
let mut x = Bool::True;
evil(&mut x);
let y = x; // reading this ought to be enough to trigger validation
//~^ ERROR type validation failed at .<enum-tag>: encountered 0x0000002c, but expected a valid enum tag
//~^ ERROR constructing invalid value at .<enum-tag>: encountered 0x0000002c, but expected a valid enum tag
println!("{:?}", y); // make sure it is used (and not optimized away)
}

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed at .<enum-tag>: encountered $HEX, but expected a valid enum tag
error: Undefined Behavior: constructing invalid value at .<enum-tag>: encountered $HEX, but expected a valid enum tag
--> $DIR/transmute_through_ptr.rs:LL:CC
|
LL | let y = x; // reading this ought to be enough to trigger validation
| ^ type validation failed at .<enum-tag>: encountered $HEX, but expected a valid enum tag
| ^ constructing invalid value at .<enum-tag>: encountered $HEX, but expected a valid enum tag
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -2,5 +2,5 @@
fn main() {
let _val = unsafe { std::mem::MaybeUninit::<f32>::uninit().assume_init() };
//~^ ERROR type validation failed at .value: encountered uninitialized bytes, but expected initialized bytes
//~^ ERROR constructing invalid value at .value: encountered uninitialized bytes, but expected initialized bytes
}

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed at .value: encountered uninitialized bytes, but expected initialized bytes
error: Undefined Behavior: constructing invalid value at .value: encountered uninitialized bytes, but expected initialized bytes
--> $DIR/uninit_float.rs:LL:CC
|
LL | let _val = unsafe { std::mem::MaybeUninit::<f32>::uninit().assume_init() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .value: encountered uninitialized bytes, but expected initialized bytes
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .value: encountered uninitialized bytes, but expected initialized bytes
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -2,5 +2,5 @@
fn main() {
let _val = unsafe { std::mem::MaybeUninit::<usize>::uninit().assume_init() };
//~^ ERROR type validation failed at .value: encountered uninitialized bytes, but expected initialized bytes
//~^ ERROR constructing invalid value at .value: encountered uninitialized bytes, but expected initialized bytes
}

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed at .value: encountered uninitialized bytes, but expected initialized bytes
error: Undefined Behavior: constructing invalid value at .value: encountered uninitialized bytes, but expected initialized bytes
--> $DIR/uninit_integer.rs:LL:CC
|
LL | let _val = unsafe { std::mem::MaybeUninit::<usize>::uninit().assume_init() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .value: encountered uninitialized bytes, but expected initialized bytes
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .value: encountered uninitialized bytes, but expected initialized bytes
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -2,5 +2,5 @@
fn main() {
let _val = unsafe { std::mem::MaybeUninit::<i32>::uninit().assume_init() };
//~^ ERROR type validation failed at .value: encountered uninitialized bytes, but expected initialized bytes
//~^ ERROR constructing invalid value at .value: encountered uninitialized bytes, but expected initialized bytes
}

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: type validation failed at .value: encountered uninitialized bytes, but expected initialized bytes
error: Undefined Behavior: constructing invalid value at .value: encountered uninitialized bytes, but expected initialized bytes
--> $DIR/uninit_integer_signed.rs:LL:CC
|
LL | let _val = unsafe { std::mem::MaybeUninit::<i32>::uninit().assume_init() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .value: encountered uninitialized bytes, but expected initialized bytes
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .value: encountered uninitialized bytes, but expected initialized bytes
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information