about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/asm/inline-syntax.x86_64.stderr16
-rw-r--r--src/test/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.rs24
-rw-r--r--src/test/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr29
3 files changed, 46 insertions, 23 deletions
diff --git a/src/test/ui/asm/inline-syntax.x86_64.stderr b/src/test/ui/asm/inline-syntax.x86_64.stderr
index dcbc17bb260..a0e2a5ea0ef 100644
--- a/src/test/ui/asm/inline-syntax.x86_64.stderr
+++ b/src/test/ui/asm/inline-syntax.x86_64.stderr
@@ -1,16 +1,10 @@
 warning: avoid using `.intel_syntax`, Intel syntax is the default
-  --> $DIR/inline-syntax.rs:57:14
-   |
-LL | global_asm!(".intel_syntax noprefix", "nop");
-   |              ^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: `#[warn(bad_asm_style)]` on by default
-
-warning: avoid using `.intel_syntax`, Intel syntax is the default
   --> $DIR/inline-syntax.rs:31:15
    |
 LL |         asm!(".intel_syntax noprefix", "nop");
    |               ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(bad_asm_style)]` on by default
 
 warning: avoid using `.intel_syntax`, Intel syntax is the default
   --> $DIR/inline-syntax.rs:34:15
@@ -42,5 +36,11 @@ warning: avoid using `.intel_syntax`, Intel syntax is the default
 LL |             .intel_syntax noprefix
    |             ^^^^^^^^^^^^^^^^^^^^^^
 
+warning: avoid using `.intel_syntax`, Intel syntax is the default
+  --> $DIR/inline-syntax.rs:57:14
+   |
+LL | global_asm!(".intel_syntax noprefix", "nop");
+   |              ^^^^^^^^^^^^^^^^^^^^^^
+
 warning: 7 warnings emitted
 
diff --git a/src/test/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.rs b/src/test/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.rs
index 0bbd7dc6c8a..fff380934e8 100644
--- a/src/test/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.rs
+++ b/src/test/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.rs
@@ -1,14 +1,17 @@
 // check-pass
 // edition:2018
+#![feature(stmt_expr_attributes)]
 #![warn(semicolon_in_expressions_from_macros)]
 
 #[allow(dead_code)]
 macro_rules! foo {
     ($val:ident) => {
-        true; //~ WARN trailing
-              //~| WARN this was previously
-              //~| WARN trailing
-              //~| WARN this was previously
+        true; //~  WARN trailing semicolon in macro
+              //~| WARN this was previously accepted
+              //~| WARN trailing semicolon in macro
+              //~| WARN this was previously accepted
+              //~| WARN trailing semicolon in macro
+              //~| WARN this was previously accepted
     }
 }
 
@@ -18,17 +21,14 @@ async fn bar() {
 }
 
 fn main() {
-    // This `allow` doesn't work
     #[allow(semicolon_in_expressions_from_macros)]
     let _ = {
         foo!(first)
     };
 
-    // This 'allow' doesn't work either
     #[allow(semicolon_in_expressions_from_macros)]
     let _ = foo!(second);
 
-    // But this 'allow' does
     #[allow(semicolon_in_expressions_from_macros)]
     fn inner() {
         let _ = foo!(third);
@@ -38,4 +38,14 @@ fn main() {
     async {
         let _ = foo!(fourth);
     };
+
+    let _ = {
+        foo!(warn_in_block)
+    };
+
+    let _ = foo!(warn_in_expr);
+
+    // This `#[allow]` does not work, since the attribute gets dropped
+    // when we expand the macro
+    let _ = #[allow(semicolon_in_expressions_from_macros)] foo!(allow_does_not_work);
 }
diff --git a/src/test/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr b/src/test/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr
index 111ebea61dd..c00c3d77dce 100644
--- a/src/test/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr
+++ b/src/test/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr
@@ -1,14 +1,14 @@
 warning: trailing semicolon in macro used in expression position
-  --> $DIR/semicolon-in-expressions-from-macros.rs:8:13
+  --> $DIR/semicolon-in-expressions-from-macros.rs:9:13
    |
 LL |         true;
    |             ^
 ...
-LL |         foo!(first)
-   |         ----------- in this macro invocation
+LL |         foo!(warn_in_block)
+   |         ------------------- in this macro invocation
    |
 note: the lint level is defined here
-  --> $DIR/semicolon-in-expressions-from-macros.rs:3:9
+  --> $DIR/semicolon-in-expressions-from-macros.rs:4:9
    |
 LL | #![warn(semicolon_in_expressions_from_macros)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -17,17 +17,30 @@ LL | #![warn(semicolon_in_expressions_from_macros)]
    = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: trailing semicolon in macro used in expression position
-  --> $DIR/semicolon-in-expressions-from-macros.rs:8:13
+  --> $DIR/semicolon-in-expressions-from-macros.rs:9:13
    |
 LL |         true;
    |             ^
 ...
-LL |     let _ = foo!(second);
-   |             ------------ in this macro invocation
+LL |     let _ = foo!(warn_in_expr);
+   |             ------------------ in this macro invocation
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
    = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-warning: 2 warnings emitted
+warning: trailing semicolon in macro used in expression position
+  --> $DIR/semicolon-in-expressions-from-macros.rs:9:13
+   |
+LL |         true;
+   |             ^
+...
+LL |     let _ = #[allow(semicolon_in_expressions_from_macros)] foo!(allow_does_not_work);
+   |                                                            ------------------------- in this macro invocation
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
+   = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+warning: 3 warnings emitted