]> git.lizzy.rs Git - rust.git/blob - test/errors.rs
8faff149167e9ba3071d4585333ad99f76160a19
[rust.git] / test / errors.rs
1 #![feature(custom_attribute)]
2 #![allow(dead_code, unused_attributes)]
3
4 #[miri_run]
5 fn overwriting_part_of_relocation_makes_the_rest_undefined() -> i32 {
6     let mut p = &42;
7     unsafe {
8         let ptr: *mut _ = &mut p;
9         *(ptr as *mut u32) = 123;
10     }
11     *p
12 }
13
14 #[miri_run]
15 fn pointers_to_different_allocations_are_unorderable() -> bool {
16     let x: *const u8 = &1;
17     let y: *const u8 = &2;
18     x < y
19 }