Disable some tests for platforms without registers.

Update new tests to run on aarch64 platforms.
This commit is contained in:
Adam Gemmell 2021-09-06 16:44:19 +01:00
parent 6d218d02d9
commit 27213b0254
17 changed files with 296 additions and 188 deletions

View File

@ -76,6 +76,12 @@ fn main() {
//~^ ERROR asm template must be a string literal
asm!("{1}", format!("{{{}}}", 0), in(reg) foo, out(reg) bar);
//~^ ERROR asm template must be a string literal
asm!("{}", in(reg) _);
//~^ ERROR _ cannot be used for input operands
asm!("{}", inout(reg) _);
//~^ ERROR _ cannot be used for input operands
asm!("{}", inlateout(reg) _);
//~^ ERROR _ cannot be used for input operands
}
}

View File

@ -214,62 +214,80 @@ LL | asm!("{1}", format!("{{{}}}", 0), in(reg) foo, out(reg) bar);
|
= note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
error: _ cannot be used for input operands
--> $DIR/parse-error.rs:79:28
|
LL | asm!("{}", in(reg) _);
| ^
error: _ cannot be used for input operands
--> $DIR/parse-error.rs:81:31
|
LL | asm!("{}", inout(reg) _);
| ^
error: _ cannot be used for input operands
--> $DIR/parse-error.rs:83:35
|
LL | asm!("{}", inlateout(reg) _);
| ^
error: requires at least a template string argument
--> $DIR/parse-error.rs:84:1
--> $DIR/parse-error.rs:90:1
|
LL | global_asm!();
| ^^^^^^^^^^^^^^
error: asm template must be a string literal
--> $DIR/parse-error.rs:86:13
--> $DIR/parse-error.rs:92:13
|
LL | global_asm!(FOO);
| ^^^
error: expected token: `,`
--> $DIR/parse-error.rs:88:18
--> $DIR/parse-error.rs:94:18
|
LL | global_asm!("{}" FOO);
| ^^^ expected `,`
error: expected operand, options, or additional template string
--> $DIR/parse-error.rs:90:19
--> $DIR/parse-error.rs:96:19
|
LL | global_asm!("{}", FOO);
| ^^^ expected operand, options, or additional template string
error: expected expression, found end of macro arguments
--> $DIR/parse-error.rs:92:24
--> $DIR/parse-error.rs:98:24
|
LL | global_asm!("{}", const);
| ^ expected expression
error: expected one of `,`, `.`, `?`, or an operator, found `FOO`
--> $DIR/parse-error.rs:94:30
--> $DIR/parse-error.rs:100:30
|
LL | global_asm!("{}", const(reg) FOO);
| ^^^ expected one of `,`, `.`, `?`, or an operator
error: expected one of `)`, `att_syntax`, or `raw`, found `FOO`
--> $DIR/parse-error.rs:96:25
--> $DIR/parse-error.rs:102:25
|
LL | global_asm!("", options(FOO));
| ^^^ expected one of `)`, `att_syntax`, or `raw`
error: expected one of `)`, `att_syntax`, or `raw`, found `nomem`
--> $DIR/parse-error.rs:98:25
--> $DIR/parse-error.rs:104:25
|
LL | global_asm!("", options(nomem FOO));
| ^^^^^ expected one of `)`, `att_syntax`, or `raw`
error: expected one of `)`, `att_syntax`, or `raw`, found `nomem`
--> $DIR/parse-error.rs:100:25
--> $DIR/parse-error.rs:106:25
|
LL | global_asm!("", options(nomem, FOO));
| ^^^^^ expected one of `)`, `att_syntax`, or `raw`
error: arguments are not allowed after options
--> $DIR/parse-error.rs:102:30
--> $DIR/parse-error.rs:108:30
|
LL | global_asm!("{}", options(), const FOO);
| --------- ^^^^^^^^^ argument
@ -277,25 +295,25 @@ LL | global_asm!("{}", options(), const FOO);
| previous options
error: expected string literal
--> $DIR/parse-error.rs:104:29
--> $DIR/parse-error.rs:110:29
|
LL | global_asm!("", clobber_abi(FOO));
| ^^^ not a string literal
error: expected `)`, found `FOO`
--> $DIR/parse-error.rs:106:33
--> $DIR/parse-error.rs:112:33
|
LL | global_asm!("", clobber_abi("C" FOO));
| ^^^ expected `)`
error: expected `)`, found `,`
--> $DIR/parse-error.rs:108:32
--> $DIR/parse-error.rs:114:32
|
LL | global_asm!("", clobber_abi("C", FOO));
| ^ expected `)`
error: arguments are not allowed after clobber_abi
--> $DIR/parse-error.rs:110:37
--> $DIR/parse-error.rs:116:37
|
LL | global_asm!("{}", clobber_abi("C"), const FOO);
| ---------------- ^^^^^^^^^ argument
@ -303,13 +321,13 @@ LL | global_asm!("{}", clobber_abi("C"), const FOO);
| clobber_abi
error: `clobber_abi` cannot be used with `global_asm!`
--> $DIR/parse-error.rs:110:19
--> $DIR/parse-error.rs:116:19
|
LL | global_asm!("{}", clobber_abi("C"), const FOO);
| ^^^^^^^^^^^^^^^^
error: clobber_abi is not allowed after options
--> $DIR/parse-error.rs:113:28
--> $DIR/parse-error.rs:119:28
|
LL | global_asm!("", options(), clobber_abi("C"));
| --------- ^^^^^^^^^^^^^^^^
@ -317,7 +335,7 @@ LL | global_asm!("", options(), clobber_abi("C"));
| options
error: clobber_abi is not allowed after options
--> $DIR/parse-error.rs:115:30
--> $DIR/parse-error.rs:121:30
|
LL | global_asm!("{}", options(), clobber_abi("C"), const FOO);
| --------- ^^^^^^^^^^^^^^^^
@ -325,7 +343,7 @@ LL | global_asm!("{}", options(), clobber_abi("C"), const FOO);
| options
error: clobber_abi specified multiple times
--> $DIR/parse-error.rs:117:35
--> $DIR/parse-error.rs:123:35
|
LL | global_asm!("", clobber_abi("C"), clobber_abi("C"));
| ---------------- ^^^^^^^^^^^^^^^^
@ -333,7 +351,7 @@ LL | global_asm!("", clobber_abi("C"), clobber_abi("C"));
| clobber_abi previously specified here
error: duplicate argument named `a`
--> $DIR/parse-error.rs:119:35
--> $DIR/parse-error.rs:125:35
|
LL | global_asm!("{a}", a = const FOO, a = const BAR);
| ------------- ^^^^^^^^^^^^^ duplicate argument
@ -341,7 +359,7 @@ LL | global_asm!("{a}", a = const FOO, a = const BAR);
| previously here
error: argument never used
--> $DIR/parse-error.rs:119:35
--> $DIR/parse-error.rs:125:35
|
LL | global_asm!("{a}", a = const FOO, a = const BAR);
| ^^^^^^^^^^^^^ argument never used
@ -349,19 +367,19 @@ LL | global_asm!("{a}", a = const FOO, a = const BAR);
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {1} */"`
error: expected one of `clobber_abi`, `const`, or `options`, found `""`
--> $DIR/parse-error.rs:122:28
--> $DIR/parse-error.rs:128:28
|
LL | global_asm!("", options(), "");
| ^^ expected one of `clobber_abi`, `const`, or `options`
error: expected one of `clobber_abi`, `const`, or `options`, found `"{}"`
--> $DIR/parse-error.rs:124:30
--> $DIR/parse-error.rs:130:30
|
LL | global_asm!("{}", const FOO, "{}", const FOO);
| ^^^^ expected one of `clobber_abi`, `const`, or `options`
error: asm template must be a string literal
--> $DIR/parse-error.rs:126:13
--> $DIR/parse-error.rs:132:13
|
LL | global_asm!(format!("{{{}}}", 0), const FOO);
| ^^^^^^^^^^^^^^^^^^^^
@ -369,7 +387,7 @@ LL | global_asm!(format!("{{{}}}", 0), const FOO);
= note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
error: asm template must be a string literal
--> $DIR/parse-error.rs:128:20
--> $DIR/parse-error.rs:134:20
|
LL | global_asm!("{1}", format!("{{{}}}", 0), const FOO, const BAR);
| ^^^^^^^^^^^^^^^^^^^^
@ -439,6 +457,6 @@ LL | let mut bar = 0;
LL | asm!("{1}", in("x0") foo, const bar);
| ^^^ non-constant value
error: aborting due to 63 previous errors
error: aborting due to 66 previous errors
For more information about this error, try `rustc --explain E0435`.

View File

@ -1,4 +1,7 @@
// only-x86_64
// needs-asm-support
// ignore-nvptx64
// ignore-spirv
// ignore-wasm32
// Make sure rustc doesn't ICE on asm! when output type is !.
#![feature(asm)]

View File

@ -1,5 +1,5 @@
error: cannot use value of type `!` for inline assembly
--> $DIR/issue-87802.rs:9:36
--> $DIR/issue-87802.rs:12:36
|
LL | asm!("/* {0} */", out(reg) x);
| ^

View File

@ -1,5 +1,5 @@
// check-pass
// only-x86_64
// needs-asm-support
#![feature(asm)]
#![feature(naked_functions)]
#![crate_type = "lib"]

View File

@ -0,0 +1,69 @@
error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:15:32
|
LL | pub extern "C" fn function(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a`
|
note: the lint level is defined here
--> $DIR/naked-functions-unused.rs:4:9
|
LL | #![deny(unused)]
| ^^^^^^
= note: `#[deny(unused_variables)]` implied by `#[deny(unused)]`
error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:15:42
|
LL | pub extern "C" fn function(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:24:38
|
LL | pub extern "C" fn associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:24:48
|
LL | pub extern "C" fn associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:30:41
|
LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:30:51
|
LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:38:40
|
LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:38:50
|
LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:44:43
|
LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:44:53
|
LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: aborting due to 10 previous errors

View File

@ -1,16 +1,18 @@
// only-x86_64
// revisions: x86_64 aarch64
//[x86_64] only-x86_64
//[aarch64] only-aarch64
#![deny(unused)]
#![feature(asm)]
#![feature(naked_functions)]
#![crate_type = "lib"]
pub trait Trait {
extern "sysv64" fn trait_associated(a: usize, b: usize) -> usize;
extern "sysv64" fn trait_method(&self, a: usize, b: usize) -> usize;
extern "C" fn trait_associated(a: usize, b: usize) -> usize;
extern "C" fn trait_method(&self, a: usize, b: usize) -> usize;
}
pub mod normal {
pub extern "sysv64" fn function(a: usize, b: usize) -> usize {
pub extern "C" fn function(a: usize, b: usize) -> usize {
//~^ ERROR unused variable: `a`
//~| ERROR unused variable: `b`
unsafe { asm!("", options(noreturn)); }
@ -19,13 +21,13 @@ pub mod normal {
pub struct Normal;
impl Normal {
pub extern "sysv64" fn associated(a: usize, b: usize) -> usize {
pub extern "C" fn associated(a: usize, b: usize) -> usize {
//~^ ERROR unused variable: `a`
//~| ERROR unused variable: `b`
unsafe { asm!("", options(noreturn)); }
}
pub extern "sysv64" fn method(&self, a: usize, b: usize) -> usize {
pub extern "C" fn method(&self, a: usize, b: usize) -> usize {
//~^ ERROR unused variable: `a`
//~| ERROR unused variable: `b`
unsafe { asm!("", options(noreturn)); }
@ -33,13 +35,13 @@ pub mod normal {
}
impl super::Trait for Normal {
extern "sysv64" fn trait_associated(a: usize, b: usize) -> usize {
extern "C" fn trait_associated(a: usize, b: usize) -> usize {
//~^ ERROR unused variable: `a`
//~| ERROR unused variable: `b`
unsafe { asm!("", options(noreturn)); }
}
extern "sysv64" fn trait_method(&self, a: usize, b: usize) -> usize {
extern "C" fn trait_method(&self, a: usize, b: usize) -> usize {
//~^ ERROR unused variable: `a`
//~| ERROR unused variable: `b`
unsafe { asm!("", options(noreturn)); }
@ -49,7 +51,7 @@ pub mod normal {
pub mod naked {
#[naked]
pub extern "sysv64" fn function(a: usize, b: usize) -> usize {
pub extern "C" fn function(a: usize, b: usize) -> usize {
unsafe { asm!("", options(noreturn)); }
}
@ -57,24 +59,24 @@ pub mod naked {
impl Naked {
#[naked]
pub extern "sysv64" fn associated(a: usize, b: usize) -> usize {
pub extern "C" fn associated(a: usize, b: usize) -> usize {
unsafe { asm!("", options(noreturn)); }
}
#[naked]
pub extern "sysv64" fn method(&self, a: usize, b: usize) -> usize {
pub extern "C" fn method(&self, a: usize, b: usize) -> usize {
unsafe { asm!("", options(noreturn)); }
}
}
impl super::Trait for Naked {
#[naked]
extern "sysv64" fn trait_associated(a: usize, b: usize) -> usize {
extern "C" fn trait_associated(a: usize, b: usize) -> usize {
unsafe { asm!("", options(noreturn)); }
}
#[naked]
extern "sysv64" fn trait_method(&self, a: usize, b: usize) -> usize {
extern "C" fn trait_method(&self, a: usize, b: usize) -> usize {
unsafe { asm!("", options(noreturn)); }
}
}

View File

@ -1,69 +0,0 @@
error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:13:37
|
LL | pub extern "sysv64" fn function(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a`
|
note: the lint level is defined here
--> $DIR/naked-functions-unused.rs:2:9
|
LL | #![deny(unused)]
| ^^^^^^
= note: `#[deny(unused_variables)]` implied by `#[deny(unused)]`
error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:13:47
|
LL | pub extern "sysv64" fn function(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:22:43
|
LL | pub extern "sysv64" fn associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:22:53
|
LL | pub extern "sysv64" fn associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:28:46
|
LL | pub extern "sysv64" fn method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:28:56
|
LL | pub extern "sysv64" fn method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:36:45
|
LL | extern "sysv64" fn trait_associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:36:55
|
LL | extern "sysv64" fn trait_associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:42:48
|
LL | extern "sysv64" fn trait_method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:42:58
|
LL | extern "sysv64" fn trait_method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: aborting due to 10 previous errors

View File

@ -0,0 +1,69 @@
error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:15:32
|
LL | pub extern "C" fn function(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a`
|
note: the lint level is defined here
--> $DIR/naked-functions-unused.rs:4:9
|
LL | #![deny(unused)]
| ^^^^^^
= note: `#[deny(unused_variables)]` implied by `#[deny(unused)]`
error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:15:42
|
LL | pub extern "C" fn function(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:24:38
|
LL | pub extern "C" fn associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:24:48
|
LL | pub extern "C" fn associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:30:41
|
LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:30:51
|
LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:38:40
|
LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:38:50
|
LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:44:43
|
LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:44:53
|
LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: aborting due to 10 previous errors

View File

@ -1,4 +1,8 @@
// needs-asm-support
// ignore-nvptx64
// ignore-spirv
// ignore-wasm32
#![feature(asm)]
#![feature(llvm_asm)]
#![feature(naked_functions)]

View File

@ -1,35 +1,35 @@
error: asm with the `pure` option must have at least one output
--> $DIR/naked-functions.rs:127:14
--> $DIR/naked-functions.rs:131:14
|
LL | asm!("", options(readonly, nostack), options(pure));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^
error: patterns not allowed in naked function parameters
--> $DIR/naked-functions.rs:14:5
--> $DIR/naked-functions.rs:18:5
|
LL | mut a: u32,
| ^^^^^
error: patterns not allowed in naked function parameters
--> $DIR/naked-functions.rs:16:5
--> $DIR/naked-functions.rs:20:5
|
LL | &b: &i32,
| ^^
error: patterns not allowed in naked function parameters
--> $DIR/naked-functions.rs:18:6
--> $DIR/naked-functions.rs:22:6
|
LL | (None | Some(_)): Option<std::ptr::NonNull<u8>>,
| ^^^^^^^^^^^^^^
error: patterns not allowed in naked function parameters
--> $DIR/naked-functions.rs:20:5
--> $DIR/naked-functions.rs:24:5
|
LL | P { x, y }: P,
| ^^^^^^^^^^
error: referencing function parameters is not allowed in naked functions
--> $DIR/naked-functions.rs:30:5
--> $DIR/naked-functions.rs:34:5
|
LL | a + 1
| ^
@ -37,7 +37,7 @@ LL | a + 1
= help: follow the calling convention in asm block to use parameters
warning: naked functions must contain a single asm block
--> $DIR/naked-functions.rs:27:1
--> $DIR/naked-functions.rs:31:1
|
LL | / pub unsafe extern "C" fn inc(a: u32) -> u32 {
LL | |
@ -53,7 +53,7 @@ LL | | }
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
error: referencing function parameters is not allowed in naked functions
--> $DIR/naked-functions.rs:36:31
--> $DIR/naked-functions.rs:40:31
|
LL | asm!("/* {0} */", in(reg) a, options(noreturn));
| ^
@ -61,7 +61,7 @@ LL | asm!("/* {0} */", in(reg) a, options(noreturn));
= help: follow the calling convention in asm block to use parameters
warning: only `const` and `sym` operands are supported in naked functions
--> $DIR/naked-functions.rs:36:23
--> $DIR/naked-functions.rs:40:23
|
LL | asm!("/* {0} */", in(reg) a, options(noreturn));
| ^^^^^^^^^
@ -70,7 +70,7 @@ LL | asm!("/* {0} */", in(reg) a, options(noreturn));
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: naked functions must contain a single asm block
--> $DIR/naked-functions.rs:43:1
--> $DIR/naked-functions.rs:47:1
|
LL | / pub unsafe extern "C" fn inc_closure(a: u32) -> u32 {
LL | |
@ -84,7 +84,7 @@ LL | | }
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: only `const` and `sym` operands are supported in naked functions
--> $DIR/naked-functions.rs:63:10
--> $DIR/naked-functions.rs:67:10
|
LL | in(reg) a,
| ^^^^^^^^^
@ -102,7 +102,7 @@ LL | out(reg) e,
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: asm in naked functions must use `noreturn` option
--> $DIR/naked-functions.rs:60:5
--> $DIR/naked-functions.rs:64:5
|
LL | / asm!("/* {0} {1} {2} {3} {4} {5} {6} */",
LL | |
@ -117,7 +117,7 @@ LL | | );
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: naked functions must contain a single asm block
--> $DIR/naked-functions.rs:50:1
--> $DIR/naked-functions.rs:54:1
|
LL | / pub unsafe extern "C" fn unsupported_operands() {
LL | |
@ -141,7 +141,7 @@ LL | | }
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: naked functions must contain a single asm block
--> $DIR/naked-functions.rs:76:1
--> $DIR/naked-functions.rs:80:1
|
LL | / pub extern "C" fn missing_assembly() {
LL | |
@ -153,7 +153,7 @@ LL | | }
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: asm in naked functions must use `noreturn` option
--> $DIR/naked-functions.rs:85:5
--> $DIR/naked-functions.rs:89:5
|
LL | asm!("");
| ^^^^^^^^^
@ -162,7 +162,7 @@ LL | asm!("");
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: asm in naked functions must use `noreturn` option
--> $DIR/naked-functions.rs:88:5
--> $DIR/naked-functions.rs:92:5
|
LL | asm!("");
| ^^^^^^^^^
@ -171,7 +171,7 @@ LL | asm!("");
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: asm in naked functions must use `noreturn` option
--> $DIR/naked-functions.rs:91:5
--> $DIR/naked-functions.rs:95:5
|
LL | asm!("");
| ^^^^^^^^^
@ -180,7 +180,7 @@ LL | asm!("");
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: naked functions must contain a single asm block
--> $DIR/naked-functions.rs:82:1
--> $DIR/naked-functions.rs:86:1
|
LL | / pub extern "C" fn too_many_asm_blocks() {
LL | |
@ -202,7 +202,7 @@ LL | | }
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
error: referencing function parameters is not allowed in naked functions
--> $DIR/naked-functions.rs:102:11
--> $DIR/naked-functions.rs:106:11
|
LL | *&y
| ^
@ -210,7 +210,7 @@ LL | *&y
= help: follow the calling convention in asm block to use parameters
warning: naked functions must contain a single asm block
--> $DIR/naked-functions.rs:99:5
--> $DIR/naked-functions.rs:103:5
|
LL | / pub extern "C" fn inner(y: usize) -> usize {
LL | |
@ -225,7 +225,7 @@ LL | | }
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: the LLVM-style inline assembly is unsupported in naked functions
--> $DIR/naked-functions.rs:112:5
--> $DIR/naked-functions.rs:116:5
|
LL | llvm_asm!("");
| ^^^^^^^^^^^^^^
@ -236,7 +236,7 @@ LL | llvm_asm!("");
= note: this warning originates in the macro `llvm_asm` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: naked functions must contain a single asm block
--> $DIR/naked-functions.rs:109:1
--> $DIR/naked-functions.rs:113:1
|
LL | / unsafe extern "C" fn llvm() -> ! {
LL | |
@ -252,7 +252,7 @@ LL | | }
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: asm options unsupported in naked functions: `nomem`, `preserves_flags`
--> $DIR/naked-functions.rs:120:5
--> $DIR/naked-functions.rs:124:5
|
LL | asm!("", options(nomem, preserves_flags, noreturn));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -261,7 +261,7 @@ LL | asm!("", options(nomem, preserves_flags, noreturn));
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: asm options unsupported in naked functions: `nostack`, `pure`, `readonly`
--> $DIR/naked-functions.rs:127:5
--> $DIR/naked-functions.rs:131:5
|
LL | asm!("", options(readonly, nostack), options(pure));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -270,7 +270,7 @@ LL | asm!("", options(readonly, nostack), options(pure));
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: asm in naked functions must use `noreturn` option
--> $DIR/naked-functions.rs:127:5
--> $DIR/naked-functions.rs:131:5
|
LL | asm!("", options(readonly, nostack), options(pure));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -279,7 +279,7 @@ LL | asm!("", options(readonly, nostack), options(pure));
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: Rust ABI is unsupported in naked functions
--> $DIR/naked-functions.rs:136:15
--> $DIR/naked-functions.rs:140:15
|
LL | pub unsafe fn default_abi() {
| ^^^^^^^^^^^
@ -287,13 +287,13 @@ LL | pub unsafe fn default_abi() {
= note: `#[warn(undefined_naked_function_abi)]` on by default
warning: Rust ABI is unsupported in naked functions
--> $DIR/naked-functions.rs:142:29
--> $DIR/naked-functions.rs:146:29
|
LL | pub unsafe extern "Rust" fn rust_abi() {
| ^^^^^^^^
warning: naked functions cannot be inlined
--> $DIR/naked-functions.rs:176:1
--> $DIR/naked-functions.rs:180:1
|
LL | #[inline]
| ^^^^^^^^^
@ -302,7 +302,7 @@ LL | #[inline]
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: naked functions cannot be inlined
--> $DIR/naked-functions.rs:184:1
--> $DIR/naked-functions.rs:188:1
|
LL | #[inline(always)]
| ^^^^^^^^^^^^^^^^^
@ -311,7 +311,7 @@ LL | #[inline(always)]
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: naked functions cannot be inlined
--> $DIR/naked-functions.rs:192:1
--> $DIR/naked-functions.rs:196:1
|
LL | #[inline(never)]
| ^^^^^^^^^^^^^^^^
@ -320,7 +320,7 @@ LL | #[inline(never)]
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: naked functions cannot be inlined
--> $DIR/naked-functions.rs:200:1
--> $DIR/naked-functions.rs:204:1
|
LL | #[inline]
| ^^^^^^^^^
@ -329,7 +329,7 @@ LL | #[inline]
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: naked functions cannot be inlined
--> $DIR/naked-functions.rs:203:1
--> $DIR/naked-functions.rs:207:1
|
LL | #[inline(always)]
| ^^^^^^^^^^^^^^^^^
@ -338,7 +338,7 @@ LL | #[inline(always)]
= note: for more information, see issue #32408 <https://github.com/rust-lang/rust/issues/32408>
warning: naked functions cannot be inlined
--> $DIR/naked-functions.rs:206:1
--> $DIR/naked-functions.rs:210:1
|
LL | #[inline(never)]
| ^^^^^^^^^^^^^^^^

View File

@ -1,4 +1,7 @@
// only-x86_64
// needs-asm-support
// ignore-nvptx64
// ignore-spirv
// ignore-wasm32
// Tests that the use of named labels in the `asm!` macro are linted against
// except for in `#[naked]` fns.
@ -99,9 +102,6 @@ fn main() {
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)
asm!("{:l}", in(reg) 0i64);
asm!("{:e}", in(reg) 0f32);
asm!("mov rax, qword ptr fs:[0]");
// Comments

View File

@ -1,5 +1,5 @@
error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:19:15
--> $DIR/named-asm-labels.rs:22:15
|
LL | asm!("bar: nop");
| ^^^
@ -9,7 +9,7 @@ LL | asm!("bar: nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:22:15
--> $DIR/named-asm-labels.rs:25:15
|
LL | asm!("abcd:");
| ^^^^
@ -18,7 +18,7 @@ LL | asm!("abcd:");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:25:15
--> $DIR/named-asm-labels.rs:28:15
|
LL | asm!("foo: bar1: nop");
| ^^^ ^^^^
@ -27,7 +27,7 @@ LL | asm!("foo: bar1: nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:29:15
--> $DIR/named-asm-labels.rs:32:15
|
LL | asm!("foo1: nop", "nop");
| ^^^^
@ -36,7 +36,7 @@ LL | asm!("foo1: nop", "nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:30:15
--> $DIR/named-asm-labels.rs:33:15
|
LL | asm!("foo2: foo3: nop", "nop");
| ^^^^ ^^^^
@ -45,7 +45,7 @@ LL | asm!("foo2: foo3: nop", "nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:32:22
--> $DIR/named-asm-labels.rs:35:22
|
LL | asm!("nop", "foo4: nop");
| ^^^^
@ -54,7 +54,7 @@ LL | asm!("nop", "foo4: nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:33:15
--> $DIR/named-asm-labels.rs:36:15
|
LL | asm!("foo5: nop", "foo6: nop");
| ^^^^
@ -63,7 +63,7 @@ LL | asm!("foo5: nop", "foo6: nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:33:28
--> $DIR/named-asm-labels.rs:36:28
|
LL | asm!("foo5: nop", "foo6: nop");
| ^^^^
@ -72,7 +72,7 @@ LL | asm!("foo5: nop", "foo6: nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:38:15
--> $DIR/named-asm-labels.rs:41:15
|
LL | asm!("foo7: nop; foo8: nop");
| ^^^^ ^^^^
@ -81,7 +81,7 @@ LL | asm!("foo7: nop; foo8: nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:40:15
--> $DIR/named-asm-labels.rs:43:15
|
LL | asm!("foo9: nop; nop");
| ^^^^
@ -90,7 +90,7 @@ LL | asm!("foo9: nop; nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:41:20
--> $DIR/named-asm-labels.rs:44:20
|
LL | asm!("nop; foo10: nop");
| ^^^^^
@ -99,7 +99,7 @@ LL | asm!("nop; foo10: nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:44:15
--> $DIR/named-asm-labels.rs:47:15
|
LL | asm!("bar2: nop\n bar3: nop");
| ^^^^ ^^^^
@ -108,7 +108,7 @@ LL | asm!("bar2: nop\n bar3: nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:46:15
--> $DIR/named-asm-labels.rs:49:15
|
LL | asm!("bar4: nop\n nop");
| ^^^^
@ -117,7 +117,7 @@ LL | asm!("bar4: nop\n nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:47:21
--> $DIR/named-asm-labels.rs:50:21
|
LL | asm!("nop\n bar5: nop");
| ^^^^
@ -126,7 +126,7 @@ LL | asm!("nop\n bar5: nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:48:21
--> $DIR/named-asm-labels.rs:51:21
|
LL | asm!("nop\n bar6: bar7: nop");
| ^^^^ ^^^^
@ -135,7 +135,7 @@ LL | asm!("nop\n bar6: bar7: nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:54:13
--> $DIR/named-asm-labels.rs:57:13
|
LL | blah2: nop
| ^^^^^
@ -146,7 +146,7 @@ LL | blah3: nop
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:63:19
--> $DIR/named-asm-labels.rs:66:19
|
LL | nop ; blah4: nop
| ^^^^^
@ -155,7 +155,7 @@ LL | nop ; blah4: nop
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:77:15
--> $DIR/named-asm-labels.rs:80:15
|
LL | asm!("blah1: 2bar: nop");
| ^^^^^
@ -164,7 +164,7 @@ LL | asm!("blah1: 2bar: nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:80:15
--> $DIR/named-asm-labels.rs:83:15
|
LL | asm!("def: def: nop");
| ^^^
@ -173,7 +173,7 @@ LL | asm!("def: def: nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:81:15
--> $DIR/named-asm-labels.rs:84:15
|
LL | asm!("def: nop\ndef: nop");
| ^^^
@ -182,7 +182,7 @@ LL | asm!("def: nop\ndef: nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:82:15
--> $DIR/named-asm-labels.rs:85:15
|
LL | asm!("def: nop; def: nop");
| ^^^
@ -191,7 +191,7 @@ LL | asm!("def: nop; def: nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:90:15
--> $DIR/named-asm-labels.rs:93:15
|
LL | asm!("fooo\u{003A} nop");
| ^^^^^^^^^^^^^^^^
@ -200,7 +200,7 @@ LL | asm!("fooo\u{003A} nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:91:15
--> $DIR/named-asm-labels.rs:94:15
|
LL | asm!("foooo\x3A nop");
| ^^^^^^^^^^^^^
@ -209,7 +209,7 @@ LL | asm!("foooo\x3A nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:94:15
--> $DIR/named-asm-labels.rs:97:15
|
LL | asm!("fooooo:\u{000A} nop");
| ^^^^^^
@ -218,7 +218,7 @@ LL | asm!("fooooo:\u{000A} nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:95:15
--> $DIR/named-asm-labels.rs:98:15
|
LL | asm!("foooooo:\x0A nop");
| ^^^^^^^
@ -227,7 +227,7 @@ LL | asm!("foooooo:\x0A nop");
= 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: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:99:14
--> $DIR/named-asm-labels.rs:102:14
|
LL | asm!("\x41\x42\x43\x3A\x20\x6E\x6F\x70");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,4 +1,7 @@
// needs-asm-support
// ignore-nvptx64
// ignore-spirv
// ignore-wasm32
#![feature(asm, global_asm)]

View File

@ -1,5 +1,5 @@
error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/type-check-1.rs:34:26
--> $DIR/type-check-1.rs:37:26
|
LL | let x = 0;
| ----- help: consider using `const` instead of `let`: `const x`
@ -8,7 +8,7 @@ LL | asm!("{}", const x);
| ^ non-constant value
error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/type-check-1.rs:37:36
--> $DIR/type-check-1.rs:40:36
|
LL | let x = 0;
| ----- help: consider using `const` instead of `let`: `const x`
@ -17,7 +17,7 @@ LL | asm!("{}", const const_foo(x));
| ^ non-constant value
error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/type-check-1.rs:40:36
--> $DIR/type-check-1.rs:43:36
|
LL | let x = 0;
| ----- help: consider using `const` instead of `let`: `const x`
@ -26,13 +26,13 @@ LL | asm!("{}", const const_bar(x));
| ^ non-constant value
error[E0308]: mismatched types
--> $DIR/type-check-1.rs:48:26
--> $DIR/type-check-1.rs:51:26
|
LL | asm!("{}", const 0f32);
| ^^^^ expected integer, found `f32`
error[E0308]: mismatched types
--> $DIR/type-check-1.rs:50:26
--> $DIR/type-check-1.rs:53:26
|
LL | asm!("{}", const 0 as *mut u8);
| ^^^^^^^^^^^^ expected integer, found *-ptr
@ -41,7 +41,7 @@ LL | asm!("{}", const 0 as *mut u8);
found raw pointer `*mut u8`
error[E0308]: mismatched types
--> $DIR/type-check-1.rs:54:26
--> $DIR/type-check-1.rs:55:26
|
LL | asm!("{}", const &0);
| ^^ expected integer, found `&{integer}`
@ -53,19 +53,19 @@ LL + asm!("{}", const 0);
|
error: invalid asm output
--> $DIR/type-check-1.rs:10:29
--> $DIR/type-check-1.rs:13:29
|
LL | asm!("{}", out(reg) 1 + 2);
| ^^^^^ cannot assign to this expression
error: invalid asm output
--> $DIR/type-check-1.rs:12:31
--> $DIR/type-check-1.rs:15:31
|
LL | asm!("{}", inout(reg) 1 + 2);
| ^^^^^ cannot assign to this expression
error[E0277]: the size for values of type `[u64]` cannot be known at compilation time
--> $DIR/type-check-1.rs:18:28
--> $DIR/type-check-1.rs:21:28
|
LL | asm!("{}", in(reg) v[..]);
| ^^^^^ doesn't have a size known at compile-time
@ -74,7 +74,7 @@ LL | asm!("{}", in(reg) v[..]);
= note: all inline asm arguments must have a statically known size
error[E0277]: the size for values of type `[u64]` cannot be known at compilation time
--> $DIR/type-check-1.rs:20:29
--> $DIR/type-check-1.rs:23:29
|
LL | asm!("{}", out(reg) v[..]);
| ^^^^^ doesn't have a size known at compile-time
@ -83,7 +83,7 @@ LL | asm!("{}", out(reg) v[..]);
= note: all inline asm arguments must have a statically known size
error[E0277]: the size for values of type `[u64]` cannot be known at compilation time
--> $DIR/type-check-1.rs:22:31
--> $DIR/type-check-1.rs:25:31
|
LL | asm!("{}", inout(reg) v[..]);
| ^^^^^ doesn't have a size known at compile-time
@ -92,13 +92,13 @@ LL | asm!("{}", inout(reg) v[..]);
= note: all inline asm arguments must have a statically known size
error[E0308]: mismatched types
--> $DIR/type-check-1.rs:60:25
--> $DIR/type-check-1.rs:65:25
|
LL | global_asm!("{}", const 0f32);
| ^^^^ expected integer, found `f32`
error[E0308]: mismatched types
--> $DIR/type-check-1.rs:64:25
--> $DIR/type-check-1.rs:67:25
|
LL | global_asm!("{}", const 0 as *mut u8);
| ^^^^^^^^^^^^ expected integer, found *-ptr

View File

@ -1,4 +1,7 @@
// needs-asm-support
// ignore-nvptx64
// ignore-spirv
// ignore-wasm32
#![feature(asm)]

View File

@ -1,5 +1,5 @@
error[E0506]: cannot assign to `a` because it is borrowed
--> $DIR/type-check-4.rs:11:9
--> $DIR/type-check-4.rs:14:9
|
LL | let p = &a;
| -- borrow of `a` occurs here
@ -10,7 +10,7 @@ LL | println!("{}", p);
| - borrow later used here
error[E0503]: cannot use `a` because it was mutably borrowed
--> $DIR/type-check-4.rs:19:28
--> $DIR/type-check-4.rs:22:28
|
LL | let p = &mut a;
| ------ borrow of `a` occurs here