File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
src/test/ui/consts/miri_unleashed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -14,4 +14,11 @@ static TEST_BAD: () = {
1414 //~| NOTE cannot access thread local static
1515} ;
1616
17+ // Make sure we catch taking a reference to thread-local storage.
18+ static TEST_BAD_REF : ( ) = {
19+ unsafe { let _val = & A ; }
20+ //~^ ERROR could not evaluate static initializer
21+ //~| NOTE cannot access thread local static
22+ } ;
23+
1724fn main ( ) { }
Original file line number Diff line number Diff line change @@ -4,14 +4,25 @@ error[E0080]: could not evaluate static initializer
44LL | unsafe { let _val = A; }
55 | ^ cannot access thread local static (DefId(0:4 ~ tls[317d]::A[0]))
66
7+ error[E0080]: could not evaluate static initializer
8+ --> $DIR/tls.rs:19:26
9+ |
10+ LL | unsafe { let _val = &A; }
11+ | ^ cannot access thread local static (DefId(0:4 ~ tls[317d]::A[0]))
12+
713warning: skipping const checks
814 |
915help: skipping check that does not even have a feature gate
1016 --> $DIR/tls.rs:12:25
1117 |
1218LL | unsafe { let _val = A; }
1319 | ^
20+ help: skipping check that does not even have a feature gate
21+ --> $DIR/tls.rs:19:26
22+ |
23+ LL | unsafe { let _val = &A; }
24+ | ^
1425
15- error: aborting due to previous error ; 1 warning emitted
26+ error: aborting due to 2 previous errors ; 1 warning emitted
1627
1728For more information about this error, try `rustc --explain E0080`.
You can’t perform that action at this time.
0 commit comments