]> git.lizzy.rs Git - rust.git/commitdiff
Add test, and fix the other tests
authorest31 <MTest31@outlook.com>
Fri, 12 May 2017 07:53:58 +0000 (09:53 +0200)
committerest31 <MTest31@outlook.com>
Sat, 13 May 2017 14:02:29 +0000 (16:02 +0200)
17 files changed:
src/test/compile-fail-fulldeps/proc-macro/resolve-error.rs
src/test/compile-fail/feature-gate-allow-internal-unstable-nested-macro.rs
src/test/compile-fail/feature-gate-allow-internal-unstable.rs
src/test/compile-fail/invalid-macro-matcher.rs
src/test/compile-fail/issue-21356.rs
src/test/compile-fail/issue-39388.rs
src/test/compile-fail/issue-39404.rs
src/test/compile-fail/issue-5067.rs
src/test/compile-fail/macro-expansion-tests.rs
src/test/compile-fail/macro-follow.rs
src/test/compile-fail/macro-followed-by-seq-bad.rs
src/test/compile-fail/macro-input-future-proofing.rs
src/test/compile-fail/macro-shadowing.rs
src/test/compile-fail/unused-macro-with-bad-frag-spec.rs
src/test/compile-fail/unused-macro-with-follow-violation.rs
src/test/compile-fail/unused-macro.rs [new file with mode: 0644]
src/test/compile-fail/user-defined-macro-rules.rs

index e0066dd43be89f13cb3d8ec3a8abf80d302ce5a6..ddd8631f02e62b4c0f4974539847f41b7afadb9a 100644 (file)
@@ -14,6 +14,7 @@
 // aux-build:bang_proc_macro.rs
 
 #![feature(proc_macro)]
+#![allow(unused_macros)]
 
 #[macro_use]
 extern crate derive_foo;
index 1aabe6b87dff58107870358f47adb266823c8f66..9af501b141955f97d777a210afcf40c1e0a4914e 100644 (file)
@@ -10,6 +10,8 @@
 
 // gate-test-allow_internal_unstable
 
+#![allow(unused_macros)]
+
 macro_rules! bar {
     () => {
         // more layers don't help:
index 8a2d8dddac0741fdaff21fdcb8e4e1343637ba86..61a362cb37fb2c0d8d674447ba9af2b348bcf586 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(unused_macros)]
+
 #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps
 macro_rules! foo {
     () => {}
index a0ac5d4c7204104237b06da36a47513b8e31d482..d710f5647dd9f97591f57c0740993bc551b3e4c7 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(unused_macros)]
+
 macro_rules! invalid {
     _ => (); //~ ERROR invalid macro matcher
 }
index fefd432e22982c66c47b60f5d8ffdf56311c053b..f66c09291cc9e4b74539de7bde5193c9f7310225 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(unused_macros)]
+
 macro_rules! test { ($wrong:t_ty ..) => () }
                   //~^ ERROR: invalid fragment specifier `t_ty`
 
index 6994d2199d276d4f7b18ff31e491659c4be83ab7..15eef429eab974667e3ea77daaada669acb10ccc 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(unused_macros)]
+
 macro_rules! assign {
     (($($a:tt)*) = ($($b:tt))*) => { //~ ERROR expected `*` or `+`
         $($a)* = $($b)*
index 0168ae7d910179ecf8a059ba923e25a7d8d4a13e..8b49772494a6687e1f34a106ec6bb5ab4ed87b91 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![deny(missing_fragment_specifier)] //~ NOTE lint level defined here
+#![allow(unused_macros)]
 
 macro_rules! m { ($i) => {} }
 //~^ ERROR missing fragment specifier
index 1c543a5fdacbba3deac22b7a66372fdb67fc4059..267362f902d720faeed69655bb5cc382215bd4db 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(unused_macros)]
+
 macro_rules! foo {
     ( $()* ) => {};
     //~^ ERROR repetition matches empty token tree
index ada06b0b3f452cdb3c97859e3ba551d05d4d706b..06f2d86e5d9bae93be3b5e23dbeea9ba5d34aaa8 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(unused_macros)]
+
 mod macros_cant_escape_fns {
     fn f() {
         macro_rules! m { () => { 3 + 4 } }
index 001bc42274b4daea014bfc5a56f584e27f9dff19..6e80e9b574bcfae9c3932c8551a2cecc5e621ad9 100644 (file)
@@ -10,6 +10,8 @@
 //
 // Check the macro follow sets (see corresponding rpass test).
 
+#![allow(unused_macros)]
+
 // FOLLOW(pat) = {FatArrow, Comma, Eq, Or, Ident(if), Ident(in)}
 macro_rules! follow_pat {
     ($p:pat ()) => {};       //~ERROR  `$p:pat` is followed by `(`
index 0ee2221bbc14b9658c9f5010c94be25821b54f7b..21cc946ded60563a48b5fa7ab8f713a841c23d98 100644 (file)
@@ -11,6 +11,8 @@
 // Regression test for issue #25436: check that things which can be
 // followed by any token also permit X* to come afterwards.
 
+#![allow(unused_macros)]
+
 macro_rules! foo {
   ( $a:expr $($b:tt)* ) => { }; //~ ERROR not allowed for `expr` fragments
   ( $a:ty $($b:tt)* ) => { };   //~ ERROR not allowed for `ty` fragments
index fe758a4a6310fbfe925eeb75d0a1e9c234d0209c..e5fdba63b0f152859c0a1f82614d57515b10716f 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(unused_macros)]
+
 macro_rules! errors_everywhere {
     ($ty:ty <) => (); //~ ERROR `$ty:ty` is followed by `<`, which is not allowed for `ty`
     ($ty:ty < foo ,) => (); //~ ERROR `$ty:ty` is followed by `<`, which is not allowed for `ty`
index 8381dc34a6a15f695630b44de9be358fdbdfc825..f5e7305e4ea9e61ba37d0429cfe9a1f5e58d4ca5 100644 (file)
@@ -10,6 +10,8 @@
 
 // aux-build:two_macros.rs
 
+#![allow(unused_macros)]
+
 macro_rules! foo { () => {} }
 macro_rules! macro_one { () => {} }
 #[macro_use(macro_two)] extern crate two_macros;
index b868b79365d9f683755398adf8b5dc2d496d7292..28a69e6f9e29beb5f900c78dbac33655681e0a95 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(unused_macros)]
+
 // Issue #21370
 
 macro_rules! test {
index e9d09bb6ad9cd739a7a4a700e9063a5e0ef4165f..dda0d3fc9557dd79afd0b0e895691892a816af06 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(unused_macros)]
+
 macro_rules! test {
     ($e:expr +) => () //~ ERROR not allowed for `expr` fragments
 }
diff --git a/src/test/compile-fail/unused-macro.rs b/src/test/compile-fail/unused-macro.rs
new file mode 100644 (file)
index 0000000..5e401c0
--- /dev/null
@@ -0,0 +1,39 @@
+// Copyright 2017 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.
+
+#![deny(unused_macros)]
+
+// Most simple case
+macro_rules! unused { //~ ERROR: unused macro definition
+    () => {};
+}
+
+// Test macros created by macros
+macro_rules! create_macro {
+    () => {
+        macro_rules! m { //~ ERROR: unused macro definition
+            () => {};
+        }
+    };
+}
+create_macro!();
+
+#[allow(unused_macros)]
+mod bar {
+    // Test that putting the #[deny] close to the macro's definition
+    // works.
+
+    #[deny(unused_macros)]
+    macro_rules! unused { //~ ERROR: unused macro definition
+        () => {};
+    }
+}
+
+fn main() {}
index d55cef434f8d3eeafd44d3e07bbe1245077df14b..02e1a585fa89d054d267c206ca636f4ff4f5c093 100644 (file)
@@ -8,4 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(unused_macros)]
+
 macro_rules! macro_rules { () => {} } //~ ERROR user-defined macros may not be named `macro_rules`