check that even referencing a TLS static during CTFE fails
This commit is contained in:
parent
1d9efbbd8f
commit
debe597a9a
@ -14,4 +14,11 @@ static TEST_BAD: () = {
|
|||||||
//~| NOTE cannot access thread local static
|
//~| NOTE cannot access thread local static
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Make sure we catch taking a reference to thread-local storage.
|
||||||
|
static TEST_BAD_REF: () = {
|
||||||
|
unsafe { let _val = &A; }
|
||||||
|
//~^ ERROR could not evaluate static initializer
|
||||||
|
//~| NOTE cannot access thread local static
|
||||||
|
};
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -4,6 +4,12 @@ error[E0080]: could not evaluate static initializer
|
|||||||
LL | unsafe { let _val = A; }
|
LL | unsafe { let _val = A; }
|
||||||
| ^ cannot access thread local static (DefId(0:4 ~ tls[317d]::A[0]))
|
| ^ cannot access thread local static (DefId(0:4 ~ tls[317d]::A[0]))
|
||||||
|
|
||||||
|
error[E0080]: could not evaluate static initializer
|
||||||
|
--> $DIR/tls.rs:19:26
|
||||||
|
|
|
||||||
|
LL | unsafe { let _val = &A; }
|
||||||
|
| ^ cannot access thread local static (DefId(0:4 ~ tls[317d]::A[0]))
|
||||||
|
|
||||||
warning: skipping const checks
|
warning: skipping const checks
|
||||||
|
|
|
|
||||||
help: skipping check that does not even have a feature gate
|
help: skipping check that does not even have a feature gate
|
||||||
@ -11,7 +17,12 @@ help: skipping check that does not even have a feature gate
|
|||||||
|
|
|
|
||||||
LL | unsafe { let _val = A; }
|
LL | unsafe { let _val = A; }
|
||||||
| ^
|
| ^
|
||||||
|
help: skipping check that does not even have a feature gate
|
||||||
|
--> $DIR/tls.rs:19:26
|
||||||
|
|
|
||||||
|
LL | unsafe { let _val = &A; }
|
||||||
|
| ^
|
||||||
|
|
||||||
error: aborting due to previous error; 1 warning emitted
|
error: aborting due to 2 previous errors; 1 warning emitted
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0080`.
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user