File tree 2 files changed +19
-1
lines changed
src/test/ui/consts/miri_unleashed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -14,4 +14,11 @@ static TEST_BAD: () = {
14
14
//~| NOTE cannot access thread local static
15
15
} ;
16
16
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
+
17
24
fn main ( ) { }
Original file line number Diff line number Diff line change @@ -4,14 +4,25 @@ error[E0080]: could not evaluate static initializer
4
4
LL | unsafe { let _val = A; }
5
5
| ^ cannot access thread local static (DefId(0:4 ~ tls[317d]::A[0]))
6
6
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
+
7
13
warning: skipping const checks
8
14
|
9
15
help: skipping check that does not even have a feature gate
10
16
--> $DIR/tls.rs:12:25
11
17
|
12
18
LL | unsafe { let _val = A; }
13
19
| ^
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
+ | ^
14
25
15
- error: aborting due to previous error ; 1 warning emitted
26
+ error: aborting due to 2 previous errors ; 1 warning emitted
16
27
17
28
For more information about this error, try `rustc --explain E0080`.
You can’t perform that action at this time.
0 commit comments