add mut_below_shr test
This commit is contained in:
parent
d4a85f6305
commit
e214e6db98
@ -16,6 +16,7 @@ fn main() {
|
||||
disjoint_mutable_subborrows();
|
||||
raw_ref_to_part();
|
||||
array_casts();
|
||||
mut_below_shr();
|
||||
}
|
||||
|
||||
// Make sure that reading from an `&mut` does, like reborrowing to `&`,
|
||||
@ -186,3 +187,12 @@ fn array_casts() {
|
||||
let p = &x as *const usize;
|
||||
assert_eq!(unsafe { *p.add(1) }, 1);
|
||||
}
|
||||
|
||||
/// Transmuting &&i32 to &&mut i32 is fine.
|
||||
fn mut_below_shr() {
|
||||
let x = 0;
|
||||
let y = &x;
|
||||
let p = unsafe { core::mem::transmute::<&&i32,&&mut i32>(&y) };
|
||||
let r = &**p;
|
||||
let _val = *r;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user