diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/codegen/asm-sanitize-llvm.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/asm/named-asm-labels.rs (renamed from src/test/ui/asm/named_asm_labels.rs) | 14 | ||||
| -rw-r--r-- | src/test/ui/asm/named-asm-labels.s | 5 | ||||
| -rw-r--r-- | src/test/ui/asm/named-asm-labels.stderr (renamed from src/test/ui/asm/named_asm_labels.stderr) | 223 |
4 files changed, 143 insertions, 100 deletions
diff --git a/src/test/codegen/asm-sanitize-llvm.rs b/src/test/codegen/asm-sanitize-llvm.rs index 135177016bf..6dcacd08cac 100644 --- a/src/test/codegen/asm-sanitize-llvm.rs +++ b/src/test/codegen/asm-sanitize-llvm.rs @@ -7,6 +7,7 @@ #![no_core] #![feature(no_core, lang_items, rustc_attrs)] #![crate_type = "rlib"] +#![allow(named_asm_labels)] #[rustc_builtin_macro] macro_rules! asm { diff --git a/src/test/ui/asm/named_asm_labels.rs b/src/test/ui/asm/named-asm-labels.rs index db7d9a17b05..2a2d6e5cc78 100644 --- a/src/test/ui/asm/named_asm_labels.rs +++ b/src/test/ui/asm/named-asm-labels.rs @@ -114,6 +114,20 @@ fn main() { asm!(":lo12:FOO"); // this is apparently valid aarch64 // is there an example that is valid x86 for this test? asm!(":bbb nop"); + + // Test include_str in asm + asm!(include_str!("named-asm-labels.s")); //~ ERROR do not use named labels + + // Test allowing or warning on the lint instead + #[allow(named_asm_labels)] + { + asm!("allowed: nop"); // Should not emit anything + } + + #[warn(named_asm_labels)] + { + asm!("warned: nop"); //~ WARNING do not use named labels + } } } diff --git a/src/test/ui/asm/named-asm-labels.s b/src/test/ui/asm/named-asm-labels.s new file mode 100644 index 00000000000..071356d75a0 --- /dev/null +++ b/src/test/ui/asm/named-asm-labels.s @@ -0,0 +1,5 @@ +lab1: nop +// do more things +lab2: nop // does bar +// a: b +lab3: nop; lab4: nop diff --git a/src/test/ui/asm/named_asm_labels.stderr b/src/test/ui/asm/named-asm-labels.stderr index 42641db603c..2e1258d127d 100644 --- a/src/test/ui/asm/named_asm_labels.stderr +++ b/src/test/ui/asm/named-asm-labels.stderr @@ -1,300 +1,323 @@ error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:11:15 + --> $DIR/named-asm-labels.rs:11:15 | LL | asm!("bar: nop"); | ^^^ | = note: `#[deny(named_asm_labels)]` on by default - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:14:15 + --> $DIR/named-asm-labels.rs:14:15 | LL | asm!("abcd:"); | ^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:17:15 + --> $DIR/named-asm-labels.rs:17:15 | LL | asm!("foo: bar1: nop"); | ^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:17:20 + --> $DIR/named-asm-labels.rs:17:20 | LL | asm!("foo: bar1: nop"); | ^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:22:15 + --> $DIR/named-asm-labels.rs:22:15 | LL | asm!("foo1: nop", "nop"); | ^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:23:15 + --> $DIR/named-asm-labels.rs:23:15 | LL | asm!("foo2: foo3: nop", "nop"); | ^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:23:21 + --> $DIR/named-asm-labels.rs:23:21 | LL | asm!("foo2: foo3: nop", "nop"); | ^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:26:22 + --> $DIR/named-asm-labels.rs:26:22 | LL | asm!("nop", "foo4: nop"); | ^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:27:15 + --> $DIR/named-asm-labels.rs:27:15 | LL | asm!("foo5: nop", "foo6: nop"); | ^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:27:28 + --> $DIR/named-asm-labels.rs:27:28 | LL | asm!("foo5: nop", "foo6: nop"); | ^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:32:15 + --> $DIR/named-asm-labels.rs:32:15 | LL | asm!("foo7: nop; foo8: nop"); | ^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:32:26 + --> $DIR/named-asm-labels.rs:32:26 | LL | asm!("foo7: nop; foo8: nop"); | ^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:35:15 + --> $DIR/named-asm-labels.rs:35:15 | LL | asm!("foo9: nop; nop"); | ^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:36:20 + --> $DIR/named-asm-labels.rs:36:20 | LL | asm!("nop; foo10: nop"); | ^^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:39:15 + --> $DIR/named-asm-labels.rs:39:15 | LL | asm!("bar2: nop\n bar3: nop"); | ^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:39:27 + --> $DIR/named-asm-labels.rs:39:27 | LL | asm!("bar2: nop\n bar3: nop"); | ^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:42:15 + --> $DIR/named-asm-labels.rs:42:15 | LL | asm!("bar4: nop\n nop"); | ^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:43:21 + --> $DIR/named-asm-labels.rs:43:21 | LL | asm!("nop\n bar5: nop"); | ^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:44:21 + --> $DIR/named-asm-labels.rs:44:21 | LL | asm!("nop\n bar6: bar7: nop"); | ^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:44:27 + --> $DIR/named-asm-labels.rs:44:27 | LL | asm!("nop\n bar6: bar7: nop"); | ^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:51:13 + --> $DIR/named-asm-labels.rs:51:13 | LL | blah2: nop | ^^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:52:13 + --> $DIR/named-asm-labels.rs:52:13 | LL | blah3: nop | ^^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:60:19 + --> $DIR/named-asm-labels.rs:60:19 | LL | nop ; blah4: nop | ^^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:74:15 + --> $DIR/named-asm-labels.rs:74:15 | LL | asm!("blah1: 2bar: nop"); | ^^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:77:15 + --> $DIR/named-asm-labels.rs:77:15 | LL | asm!("def: def: nop"); | ^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:78:15 + --> $DIR/named-asm-labels.rs:78:15 | LL | asm!("def: nop\ndef: nop"); | ^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:79:15 + --> $DIR/named-asm-labels.rs:79:15 | LL | asm!("def: nop; def: nop"); | ^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:87:15 + --> $DIR/named-asm-labels.rs:87:15 | LL | asm!("fooo\u{003A} nop"); | ^^^^^^^^^^^^^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:88:15 + --> $DIR/named-asm-labels.rs:88:15 | LL | asm!("foooo\x3A nop"); | ^^^^^^^^^^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:91:15 + --> $DIR/named-asm-labels.rs:91:15 | LL | asm!("fooooo:\u{000A} nop"); | ^^^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:92:15 + --> $DIR/named-asm-labels.rs:92:15 | LL | asm!("foooooo:\x0A nop"); | ^^^^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:96:14 + --> $DIR/named-asm-labels.rs:96:14 | LL | asm!("\x41\x42\x43\x3A\x20\x6E\x6F\x70"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information error: do not use named labels in inline assembly - --> $DIR/named_asm_labels.rs:107:13 + --> $DIR/named-asm-labels.rs:107:13 | LL | ab: nop // ab: does foo | ^^ | - = help: Only GAS local labels of the form `N:` where N is a number may be used in inline asm - = note: See the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information -error: aborting due to 33 previous errors +error: do not use named labels in inline assembly + --> $DIR/named-asm-labels.rs:119:14 + | +LL | asm!(include_str!("named-asm-labels.s")); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + +warning: do not use named labels in inline assembly + --> $DIR/named-asm-labels.rs:129:19 + | +LL | asm!("warned: nop"); + | ^^^^^^ + | +note: the lint level is defined here + --> $DIR/named-asm-labels.rs:127:16 + | +LL | #[warn(named_asm_labels)] + | ^^^^^^^^^^^^^^^^ + = help: only GAS local labels of the form `N:` where N is a number may be used in inline asm + = note: see the asm section of the unstable book <https://doc.rust-lang.org/nightly/unstable-book/library-features/asm.html#labels> for more information + +error: aborting due to 34 previous errors; 1 warning emitted |
