about summary refs log tree commit diff
path: root/tests/ui/rust-2018/removing-extern-crate-malformed-cfg.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/rust-2018/removing-extern-crate-malformed-cfg.rs')
-rw-r--r--tests/ui/rust-2018/removing-extern-crate-malformed-cfg.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/rust-2018/removing-extern-crate-malformed-cfg.rs b/tests/ui/rust-2018/removing-extern-crate-malformed-cfg.rs
new file mode 100644
index 00000000000..c5b629fa90b
--- /dev/null
+++ b/tests/ui/rust-2018/removing-extern-crate-malformed-cfg.rs
@@ -0,0 +1,17 @@
+//@ edition:2018
+//@ aux-build:../removing-extern-crate.rs
+//@ run-rustfix
+
+#![warn(rust_2018_idioms)]
+
+#[cfg_attr(test, "macro_use")] //~ ERROR expected
+extern crate removing_extern_crate as foo; //~ WARNING unused extern crate
+extern crate core; //~ WARNING unused extern crate
+
+mod another {
+    #[cfg_attr(test)] //~ ERROR expected
+    extern crate removing_extern_crate as foo; //~ WARNING unused extern crate
+    extern crate core; //~ WARNING unused extern crate
+}
+
+fn main() {}