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 b217fab commit 3cd0b46Copy full SHA for 3cd0b46
src/test/ui/consts/const-mut-refs/mut_ref_in_final.rs
@@ -9,9 +9,8 @@ const A: *const i32 = &4;
9
// as that would be an enormous footgun in oli-obk's opinion.
10
const B: *mut i32 = &mut 4; //~ ERROR mutable references are not allowed
11
12
-// Could be ok, but the same analysis that prevents the mutable one above will also bail out here
13
-// Using a block with some complex content, because just `&45` would get promoted,
14
-// which is not what we want to test here.
+// Ok, because no references to mutable data exist here, since the `{}` moves
+// its value and then takes a reference to that.
15
const C: *const i32 = &{
16
let mut x = 42;
17
x += 3;
0 commit comments