about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <arielb1@mail.tau.ac.il>2017-03-08 20:53:57 +0200
committerGitHub <noreply@github.com>2017-03-08 20:53:57 +0200
commit006c74432d82259802bdd17f206d7edddb3b64b8 (patch)
tree45af0b11fb4960a7d8b9f8c752ce06b1cc59b86e /src/test
parent4eb7a335c0f6f2dd7b94b92701f46b5ae2a0081b (diff)
parent7c88d9e86e86031b6b611d09b6b85f71de044d9e (diff)
downloadrust-006c74432d82259802bdd17f206d7edddb3b64b8.tar.gz
rust-006c74432d82259802bdd17f206d7edddb3b64b8.zip
Rollup merge of #40279 - gibfahn:test-unwind, r=est31
Add compile-fail tests for remaining items in whitelist and remove it

Add compile-fail tests for `cfg_target_thread_local` and `unwind_attributes`, and remove the whitelist.

Let me know if I should clean up the tests (or if I've done anything else wrong, this is my first contribution to rust).

cc/ @est31
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/auxiliary/cfg-target-thread-local.rs17
-rw-r--r--src/test/compile-fail/feature-gate-cfg-target-thread-local.rs27
-rw-r--r--src/test/compile-fail/feature-gate-unwind-attributes.rs28
3 files changed, 72 insertions, 0 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/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 <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.
+
+// 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();
+}