]> git.lizzy.rs Git - rust.git/commitdiff
Add UI test for duplicate `asm!` options warning
authorCamelid <camelidcamel@gmail.com>
Sun, 14 Jun 2020 00:59:13 +0000 (17:59 -0700)
committerCamelid <camelidcamel@gmail.com>
Sat, 20 Jun 2020 18:12:42 +0000 (11:12 -0700)
src/test/ui/asm/duplicate-options.rs [new file with mode: 0644]
src/test/ui/asm/duplicate-options.stderr [new file with mode: 0644]

diff --git a/src/test/ui/asm/duplicate-options.rs b/src/test/ui/asm/duplicate-options.rs
new file mode 100644 (file)
index 0000000..9c44745
--- /dev/null
@@ -0,0 +1,19 @@
+// only-x86_64
+// build-pass
+
+#![feature(asm)]
+
+fn main() {
+    unsafe {
+        asm!("", options(nomem, nomem));
+        //~^ WARNING the `nomem` option was already provided
+        asm!("", options(att_syntax, att_syntax));
+        //~^ WARNING the `att_syntax` option was already provided
+        asm!("", options(nostack, att_syntax), options(nostack));
+        //~^ WARNING the `nostack` option was already provided
+        asm!("", options(nostack, nostack), options(nostack), options(nostack));
+        //~^ WARNING the `nostack` option was already provided
+        //~| WARNING the `nostack` option was already provided
+        //~| WARNING the `nostack` option was already provided
+    }
+}
diff --git a/src/test/ui/asm/duplicate-options.stderr b/src/test/ui/asm/duplicate-options.stderr
new file mode 100644 (file)
index 0000000..113aca8
--- /dev/null
@@ -0,0 +1,38 @@
+warning: the `nomem` option was already provided
+  --> $DIR/duplicate-options.rs:8:33
+   |
+LL |         asm!("", options(nomem, nomem));
+   |                                 ^^^^^ help: remove this option
+
+warning: the `att_syntax` option was already provided
+  --> $DIR/duplicate-options.rs:10:38
+   |
+LL |         asm!("", options(att_syntax, att_syntax));
+   |                                      ^^^^^^^^^^ help: remove this option
+
+warning: the `nostack` option was already provided
+  --> $DIR/duplicate-options.rs:12:56
+   |
+LL |         asm!("", options(nostack, att_syntax), options(nostack));
+   |                                                        ^^^^^^^ help: remove this option
+
+warning: the `nostack` option was already provided
+  --> $DIR/duplicate-options.rs:14:35
+   |
+LL |         asm!("", options(nostack, nostack), options(nostack), options(nostack));
+   |                                   ^^^^^^^ help: remove this option
+
+warning: the `nostack` option was already provided
+  --> $DIR/duplicate-options.rs:14:53
+   |
+LL |         asm!("", options(nostack, nostack), options(nostack), options(nostack));
+   |                                                     ^^^^^^^ help: remove this option
+
+warning: the `nostack` option was already provided
+  --> $DIR/duplicate-options.rs:14:71
+   |
+LL |         asm!("", options(nostack, nostack), options(nostack), options(nostack));
+   |                                                                       ^^^^^^^ help: remove this option
+
+warning: 6 warnings emitted
+