From ea3f148d3d3b4fb1d1b49be1be4b025fe17dde26 Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Sun, 5 Mar 2017 19:32:46 +0000 Subject: [PATCH 1/3] Add compile-fail test for unwind_attributes Test copied from src/test/codegen/extern-functions.rs. Refs: https://github.com/rust-lang/rust/issues/39059 --- .../feature-gate-unwind-attributes.rs | 28 +++++++++++++++++++ src/tools/tidy/src/features.rs | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/test/compile-fail/feature-gate-unwind-attributes.rs diff --git a/src/test/compile-fail/feature-gate-unwind-attributes.rs b/src/test/compile-fail/feature-gate-unwind-attributes.rs new file mode 100644 index 00000000000..c8f9cd943cd --- /dev/null +++ b/src/test/compile-fail/feature-gate-unwind-attributes.rs @@ -0,0 +1,28 @@ +// Copyright 2015 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -C no-prepopulate-passes + +#![crate_type = "lib"] + +extern { +// CHECK: Function Attrs: nounwind +// CHECK-NEXT: declare void @extern_fn + fn extern_fn(); +// CHECK-NOT: Function Attrs: nounwind +// CHECK: declare void @unwinding_extern_fn + #[unwind] //~ ERROR #[unwind] is experimental + fn unwinding_extern_fn(); +} + +pub unsafe fn force_declare() { + extern_fn(); + unwinding_extern_fn(); +} diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index 93593b97555..e065fe00bcf 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -167,7 +167,7 @@ pub fn check(path: &Path, bad: &mut bool) { // FIXME get this whitelist empty. let whitelist = vec![ - "cfg_target_thread_local", "unwind_attributes", + "cfg_target_thread_local", ]; // Only check the number of lang features. From cee4ef8e7c6b657b3501a57a789e72c393390f44 Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Sun, 5 Mar 2017 20:10:39 +0000 Subject: [PATCH 2/3] 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 --- .../auxiliary/cfg-target-thread-local.rs | 17 ++++++++++++ .../feature-gate-cfg-target-thread-local.rs | 27 +++++++++++++++++++ src/tools/tidy/src/features.rs | 1 - 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/test/compile-fail/auxiliary/cfg-target-thread-local.rs create mode 100644 src/test/compile-fail/feature-gate-cfg-target-thread-local.rs 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 or the MIT license +// , 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 or the MIT license +// , 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. From 7c88d9e86e86031b6b611d09b6b85f71de044d9e Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Sun, 5 Mar 2017 20:26:23 +0000 Subject: [PATCH 3/3] Remove the compile-fail feature gates whitelist No longer necessary now that the whitelist is empty. Fixes: https://github.com/rust-lang/rust/issues/39059 --- src/tools/tidy/src/features.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index 0206fcb5848..9b323c95fc3 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -165,16 +165,11 @@ pub fn check(path: &Path, bad: &mut bool) { } }); - // FIXME get this whitelist empty. - let whitelist = vec![ - ]; - // Only check the number of lang features. // Obligatory testing for library features is dumb. let gate_untested = features.iter() .filter(|&(_, f)| f.level == Status::Unstable) .filter(|&(_, f)| !f.has_gate_test) - .filter(|&(n, _)| !whitelist.contains(&n.as_str())) .collect::>(); for &(name, _) in gate_untested.iter() {