File: mut_ref_in_final_dynamic_check.stderr

package info (click to toggle)
rustc 1.70.0%2Bdfsg1-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 722,120 kB
  • sloc: xml: 147,962; javascript: 10,210; sh: 8,590; python: 8,220; ansic: 5,901; cpp: 4,635; makefile: 4,001; asm: 2,856
file content (26 lines) | stat: -rw-r--r-- 882 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
error[E0080]: evaluation of constant value failed
  --> $DIR/mut_ref_in_final_dynamic_check.rs:13:10
   |
LL |     Some(&mut *(42 as *mut i32))
   |          ^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: 0x2a[noalloc] is a dangling pointer (it has no provenance)
   |
note: inside `helper`
  --> $DIR/mut_ref_in_final_dynamic_check.rs:13:10
   |
LL |     Some(&mut *(42 as *mut i32))
   |          ^^^^^^^^^^^^^^^^^^^^^^
note: inside `A`
  --> $DIR/mut_ref_in_final_dynamic_check.rs:18:29
   |
LL | const A: Option<&mut i32> = helper();
   |                             ^^^^^^^^

error: encountered dangling pointer in final constant
  --> $DIR/mut_ref_in_final_dynamic_check.rs:25:1
   |
LL | const B: Option<&mut i32> = helper2();
   | ^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0080`.