diff --git a/tests/ui/asm/type-check-1.rs b/tests/ui/asm/type-check-1.rs index b0f1362f54334..09aa4a584ce12 100644 --- a/tests/ui/asm/type-check-1.rs +++ b/tests/ui/asm/type-check-1.rs @@ -55,11 +55,12 @@ fn main() { asm!("{}", const 0i32); asm!("{}", const 0i128); asm!("{}", const 0f32); - //~^ ERROR mismatched types + //~^ ERROR invalid type for `const` operand asm!("{}", const 0 as *mut u8); - //~^ ERROR mismatched types - asm!("{}", const &0); - //~^ ERROR mismatched types + //~^ ERROR invalid type for `const` operand + + // FIXME: Currently ICEs due to #96304 + //asm!("{}", const &0); } } @@ -73,6 +74,6 @@ global_asm!("{}", const 0); global_asm!("{}", const 0i32); global_asm!("{}", const 0i128); global_asm!("{}", const 0f32); -//~^ ERROR mismatched types +//~^ ERROR invalid type for `const` operand global_asm!("{}", const 0 as *mut u8); -//~^ ERROR mismatched types +//~^ ERROR invalid type for `const` operand diff --git a/tests/ui/asm/type-check-1.stderr b/tests/ui/asm/type-check-1.stderr index 1852623211813..30cd7fb42952e 100644 --- a/tests/ui/asm/type-check-1.stderr +++ b/tests/ui/asm/type-check-1.stderr @@ -39,6 +39,26 @@ LL | asm!("{}", sym x); | = help: `sym` operands must refer to either a function or a static +error: invalid type for `const` operand + --> $DIR/type-check-1.rs:76:19 + | +LL | global_asm!("{}", const 0f32); + | ^^^^^^---- + | | + | is an `f32` + | + = help: `const` operands must be of an integer type + +error: invalid type for `const` operand + --> $DIR/type-check-1.rs:78:19 + | +LL | global_asm!("{}", const 0 as *mut u8); + | ^^^^^^------------ + | | + | is a `*mut u8` + | + = help: `const` operands must be of an integer type + error: invalid asm output --> $DIR/type-check-1.rs:14:29 | @@ -102,49 +122,27 @@ LL | asm!("{}", inout(reg) v[..]); | = note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly -error[E0308]: mismatched types - --> $DIR/type-check-1.rs:57:26 +error: invalid type for `const` operand + --> $DIR/type-check-1.rs:57:20 | LL | asm!("{}", const 0f32); - | ^^^^ expected integer, found `f32` - -error[E0308]: mismatched types - --> $DIR/type-check-1.rs:59:26 - | -LL | asm!("{}", const 0 as *mut u8); - | ^^^^^^^^^^^^ expected integer, found `*mut u8` + | ^^^^^^---- + | | + | is an `f32` | - = note: expected type `{integer}` - found raw pointer `*mut u8` + = help: `const` operands must be of an integer type -error[E0308]: mismatched types - --> $DIR/type-check-1.rs:61:26 +error: invalid type for `const` operand + --> $DIR/type-check-1.rs:59:20 | -LL | asm!("{}", const &0); - | ^^ expected integer, found `&{integer}` - | -help: consider removing the borrow - | -LL - asm!("{}", const &0); -LL + asm!("{}", const 0); - | - -error[E0308]: mismatched types - --> $DIR/type-check-1.rs:75:25 - | -LL | global_asm!("{}", const 0f32); - | ^^^^ expected integer, found `f32` - -error[E0308]: mismatched types - --> $DIR/type-check-1.rs:77:25 - | -LL | global_asm!("{}", const 0 as *mut u8); - | ^^^^^^^^^^^^ expected integer, found `*mut u8` +LL | asm!("{}", const 0 as *mut u8); + | ^^^^^^------------ + | | + | is a `*mut u8` | - = note: expected type `{integer}` - found raw pointer `*mut u8` + = help: `const` operands must be of an integer type -error: aborting due to 17 previous errors +error: aborting due to 16 previous errors -Some errors have detailed explanations: E0277, E0308, E0435. +Some errors have detailed explanations: E0277, E0435. For more information about an error, try `rustc --explain E0277`.