提交 ae8a1baf 编写于 作者: A asquared31415

Update error message

上级 1ae19b69
......@@ -529,8 +529,8 @@ fn expand_preparsed_asm(
lint::builtin::NAMED_ASM_LABELS,
span,
ecx.current_expansion.lint_node_id,
"do not use named labels in inline assembly",
BuiltinLintDiagnostics::NamedAsmLabel("only GAS local labels of the form `N:` where N is a number may be used in inline asm".to_string()),
"avoid using named labels in inline assembly",
BuiltinLintDiagnostics::NamedAsmLabel("only local labels of the form `<number>:` should be used in inline asm".to_string()),
);
}
} else {
......@@ -539,8 +539,8 @@ fn expand_preparsed_asm(
lint::builtin::NAMED_ASM_LABELS,
template_sp,
ecx.current_expansion.lint_node_id,
"do not use named labels in inline assembly",
BuiltinLintDiagnostics::NamedAsmLabel("only GAS local labels of the form `N:` where N is a number may be used in inline asm".to_string()),
"avoid using named labels in inline assembly",
BuiltinLintDiagnostics::NamedAsmLabel("only local labels of the form `<number>:` should be used in inline asm".to_string()),
);
}
}
......
......@@ -8,42 +8,42 @@
fn main() {
unsafe {
// Basic usage
asm!("bar: nop"); //~ ERROR do not use named labels
asm!("bar: nop"); //~ ERROR avoid using named labels
// No following asm
asm!("abcd:"); //~ ERROR do not use named labels
asm!("abcd:"); //~ ERROR avoid using named labels
// Multiple labels on one line
asm!("foo: bar1: nop");
//~^ ERROR do not use named labels
//~| ERROR do not use named labels
//~^ ERROR avoid using named labels
//~| ERROR avoid using named labels
// Multiple lines
asm!("foo1: nop", "nop"); //~ ERROR do not use named labels
asm!("foo1: nop", "nop"); //~ ERROR avoid using named labels
asm!("foo2: foo3: nop", "nop");
//~^ ERROR do not use named labels
//~| ERROR do not use named labels
asm!("nop", "foo4: nop"); //~ ERROR do not use named labels
//~^ ERROR avoid using named labels
//~| ERROR avoid using named labels
asm!("nop", "foo4: nop"); //~ ERROR avoid using named labels
asm!("foo5: nop", "foo6: nop");
//~^ ERROR do not use named labels
//~| ERROR do not use named labels
//~^ ERROR avoid using named labels
//~| ERROR avoid using named labels
// Statement separator
asm!("foo7: nop; foo8: nop");
//~^ ERROR do not use named labels
//~| ERROR do not use named labels
asm!("foo9: nop; nop"); //~ ERROR do not use named labels
asm!("nop; foo10: nop"); //~ ERROR do not use named labels
//~^ ERROR avoid using named labels
//~| ERROR avoid using named labels
asm!("foo9: nop; nop"); //~ ERROR avoid using named labels
asm!("nop; foo10: nop"); //~ ERROR avoid using named labels
// Escaped newline
asm!("bar2: nop\n bar3: nop");
//~^ ERROR do not use named labels
//~| ERROR do not use named labels
asm!("bar4: nop\n nop"); //~ ERROR do not use named labels
asm!("nop\n bar5: nop"); //~ ERROR do not use named labels
//~^ ERROR avoid using named labels
//~| ERROR avoid using named labels
asm!("bar4: nop\n nop"); //~ ERROR avoid using named labels
asm!("nop\n bar5: nop"); //~ ERROR avoid using named labels
asm!("nop\n bar6: bar7: nop");
//~^ ERROR do not use named labels
//~| ERROR do not use named labels
//~^ ERROR avoid using named labels
//~| ERROR avoid using named labels
// Raw strings
asm!(
......@@ -52,15 +52,15 @@ fn main() {
blah3: nop
"
);
//~^^^^ ERROR do not use named labels
//~^^^^ ERROR do not use named labels
//~^^^^ ERROR avoid using named labels
//~^^^^ ERROR avoid using named labels
asm!(
r###"
nop
nop ; blah4: nop
"###
);
//~^^^ ERROR do not use named labels
//~^^^ ERROR avoid using named labels
// Non-labels
// should not trigger lint, but may be invalid asm
......@@ -71,12 +71,12 @@ fn main() {
asm!("1bar: blah: nop");
// Only `blah1:` should trigger
asm!("blah1: 2bar: nop"); //~ ERROR do not use named labels
asm!("blah1: 2bar: nop"); //~ ERROR avoid using named labels
// Duplicate labels
asm!("def: def: nop"); //~ ERROR do not use named labels
asm!("def: nop\ndef: nop"); //~ ERROR do not use named labels
asm!("def: nop; def: nop"); //~ ERROR do not use named labels
asm!("def: def: nop"); //~ ERROR avoid using named labels
asm!("def: nop\ndef: nop"); //~ ERROR avoid using named labels
asm!("def: nop; def: nop"); //~ ERROR avoid using named labels
// Trying to break parsing
asm!(":");
......@@ -84,16 +84,16 @@ fn main() {
asm!("::::");
// 0x3A is a ':'
asm!("fooo\u{003A} nop"); //~ ERROR do not use named labels
asm!("foooo\x3A nop"); //~ ERROR do not use named labels
asm!("fooo\u{003A} nop"); //~ ERROR avoid using named labels
asm!("foooo\x3A nop"); //~ ERROR avoid using named labels
// 0x0A is a newline
asm!("fooooo:\u{000A} nop"); //~ ERROR do not use named labels
asm!("foooooo:\x0A nop"); //~ ERROR do not use named labels
asm!("fooooo:\u{000A} nop"); //~ ERROR avoid using named labels
asm!("foooooo:\x0A nop"); //~ ERROR avoid using named labels
// Intentionally breaking span finding
// equivalent to "ABC: nop"
asm!("\x41\x42\x43\x3A\x20\x6E\x6F\x70"); //~ ERROR do not use named labels
asm!("\x41\x42\x43\x3A\x20\x6E\x6F\x70"); //~ ERROR avoid using named labels
// Non-label colons - should pass
// (most of these are stolen from other places)
......@@ -108,7 +108,7 @@ fn main() {
// cd: nop
"
);
//~^^^^ ERROR do not use named labels
//~^^^^ ERROR avoid using named labels
// Tests usage of colons in non-label positions
asm!(":lo12:FOO"); // this is apparently valid aarch64
......@@ -116,7 +116,7 @@ fn main() {
asm!(":bbb nop");
// Test include_str in asm
asm!(include_str!("named-asm-labels.s")); //~ ERROR do not use named labels
asm!(include_str!("named-asm-labels.s")); //~ ERROR avoid using named labels
// Test allowing or warning on the lint instead
#[allow(named_asm_labels)]
......@@ -126,7 +126,7 @@ fn main() {
#[warn(named_asm_labels)]
{
asm!("warned: nop"); //~ WARNING do not use named labels
asm!("warned: nop"); //~ WARNING avoid using named labels
}
}
}
......
error: do not use named labels in inline assembly
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using named labels in inline assembly
--> $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
= help: only local labels of the form `<number>:` should 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
error: avoid using 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
= help: only local labels of the form `<number>:` should 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
warning: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:129:19
|
LL | asm!("warned: nop");
......@@ -316,7 +316,7 @@ note: the lint level is defined here
|
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
= help: only local labels of the form `<number>:` should 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册