We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 173ad36 commit d5d1b1eCopy full SHA for d5d1b1e
tests/run-pass/stacked-borrows.rs
@@ -9,6 +9,7 @@ fn main() {
9
mut_raw_mut();
10
partially_invalidate_mut();
11
drop_after_sharing();
12
+ direct_mut_to_const_raw();
13
}
14
15
// Deref a raw ptr to access a field of a large struct, where the field
@@ -112,3 +113,13 @@ fn drop_after_sharing() {
112
113
let x = String::from("hello!");
114
let _len = x.len();
115
116
+
117
+// Make sure that coercing &mut T to *const T produces a writeable pointer.
118
+fn direct_mut_to_const_raw() {
119
+ // FIXME: This is currently disabled, waiting on a fix for <https://github.com/rust-lang/rust/issues/56604>
120
+ /*let x = &mut 0;
121
+ let y: *const i32 = x;
122
+ unsafe { *(y as *mut i32) = 1; }
123
+ assert_eq!(*x, 1);
124
+ */
125
+}
0 commit comments