Skip to content

Commit cee4ef8

Browse files
committed
Add compile-fail test for cfg_target_thread_local
Test copied from src/test/run-pass/thread-local-extern-static.rs. Refs: rust-lang#39059
1 parent ea3f148 commit cee4ef8

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(thread_local)]
12+
#![feature(cfg_target_thread_local)]
13+
#![crate_type = "lib"]
14+
15+
#[no_mangle]
16+
#[cfg_attr(target_thread_local, thread_local)]
17+
pub static FOO: u32 = 3;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// ignore-windows
12+
// aux-build:cfg-target-thread-local.rs
13+
14+
#![feature(thread_local)]
15+
16+
extern crate cfg_target_thread_local;
17+
18+
extern {
19+
#[cfg_attr(target_thread_local, thread_local)]
20+
//~^ `cfg(target_thread_local)` is experimental and subject to change (see issue #29594)
21+
22+
static FOO: u32;
23+
}
24+
25+
fn main() {
26+
assert_eq!(FOO, 3);
27+
}

src/tools/tidy/src/features.rs

-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ pub fn check(path: &Path, bad: &mut bool) {
167167

168168
// FIXME get this whitelist empty.
169169
let whitelist = vec![
170-
"cfg_target_thread_local",
171170
];
172171

173172
// Only check the number of lang features.

0 commit comments

Comments
 (0)