diff options
| author | Gibson Fahnestock <gibfahn@gmail.com> | 2017-03-05 20:10:39 +0000 |
|---|---|---|
| committer | Gibson Fahnestock <gibfahn@gmail.com> | 2017-03-05 20:17:47 +0000 |
| commit | cee4ef8e7c6b657b3501a57a789e72c393390f44 (patch) | |
| tree | ad9fdea0698772da9541e53fbd8032bde3c33456 /src | |
| parent | ea3f148d3d3b4fb1d1b49be1be4b025fe17dde26 (diff) | |
| download | rust-cee4ef8e7c6b657b3501a57a789e72c393390f44.tar.gz rust-cee4ef8e7c6b657b3501a57a789e72c393390f44.zip | |
Add compile-fail test for cfg_target_thread_local
Test copied from src/test/run-pass/thread-local-extern-static.rs. Refs: https://github.com/rust-lang/rust/issues/39059
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/compile-fail/auxiliary/cfg-target-thread-local.rs | 17 | ||||
| -rw-r--r-- | src/test/compile-fail/feature-gate-cfg-target-thread-local.rs | 27 | ||||
| -rw-r--r-- | src/tools/tidy/src/features.rs | 1 |
3 files changed, 44 insertions, 1 deletions
diff --git a/src/test/compile-fail/auxiliary/cfg-target-thread-local.rs b/src/test/compile-fail/auxiliary/cfg-target-thread-local.rs new file mode 100644 index 00000000000..d1971a5e1ae --- /dev/null +++ b/src/test/compile-fail/auxiliary/cfg-target-thread-local.rs @@ -0,0 +1,17 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(thread_local)] +#![feature(cfg_target_thread_local)] +#![crate_type = "lib"] + +#[no_mangle] +#[cfg_attr(target_thread_local, thread_local)] +pub static FOO: u32 = 3; diff --git a/src/test/compile-fail/feature-gate-cfg-target-thread-local.rs b/src/test/compile-fail/feature-gate-cfg-target-thread-local.rs new file mode 100644 index 00000000000..985bd8320e0 --- /dev/null +++ b/src/test/compile-fail/feature-gate-cfg-target-thread-local.rs @@ -0,0 +1,27 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// ignore-windows +// aux-build:cfg-target-thread-local.rs + +#![feature(thread_local)] + +extern crate cfg_target_thread_local; + +extern { + #[cfg_attr(target_thread_local, thread_local)] + //~^ `cfg(target_thread_local)` is experimental and subject to change (see issue #29594) + + static FOO: u32; +} + +fn main() { + assert_eq!(FOO, 3); +} diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index e065fe00bcf..0206fcb5848 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -167,7 +167,6 @@ pub fn check(path: &Path, bad: &mut bool) { // FIXME get this whitelist empty. let whitelist = vec![ - "cfg_target_thread_local", ]; // Only check the number of lang features. |
