We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d4a85f6 commit 5100b44Copy full SHA for 5100b44
tests/run-pass/stacked-borrows/stacked-borrows.rs
@@ -16,6 +16,7 @@ fn main() {
16
disjoint_mutable_subborrows();
17
raw_ref_to_part();
18
array_casts();
19
+ mut_below_shr();
20
}
21
22
// Make sure that reading from an `&mut` does, like reborrowing to `&`,
@@ -186,3 +187,12 @@ fn array_casts() {
186
187
let p = &x as *const usize;
188
assert_eq!(unsafe { *p.add(1) }, 1);
189
190
+
191
+/// Transmuting &&i32 to &&mut i32 is fine.
192
+fn mut_below_shr() {
193
+ let x = 0;
194
+ let y = &x;
195
+ let p = unsafe { core::mem::transmute::<&&i32,&&mut i32>(&y) };
196
+ let r = &**p;
197
+ let _val = *r;
198
+}
0 commit comments