1
- // only-x86_64
1
+ // needs-asm-support
2
2
3
3
#![ feature( asm_const) ]
4
4
@@ -38,6 +38,9 @@ fn main() {
38
38
//~^ ERROR expected one of
39
39
asm ! ( "{}" , options( ) , const foo) ;
40
40
//~^ ERROR attempt to use a non-constant value in a constant
41
+
42
+ // test that asm!'s clobber_abi doesn't accept non-string literals
43
+ // see also https://github.com/rust-lang/rust/issues/112635
41
44
asm ! ( "" , clobber_abi( ) ) ;
42
45
//~^ ERROR at least one abi must be provided
43
46
asm ! ( "" , clobber_abi( foo) ) ;
@@ -46,6 +49,25 @@ fn main() {
46
49
//~^ ERROR expected one of `)` or `,`, found `foo`
47
50
asm ! ( "" , clobber_abi( "C" , foo) ) ;
48
51
//~^ ERROR expected string literal
52
+ asm ! ( "" , clobber_abi( 1 ) ) ;
53
+ //~^ ERROR expected string literal
54
+ asm ! ( "" , clobber_abi( ( ) ) ) ;
55
+ //~^ ERROR expected string literal
56
+ asm ! ( "" , clobber_abi( uwu) ) ;
57
+ //~^ ERROR expected string literal
58
+ asm ! ( "" , clobber_abi( { } ) ) ;
59
+ //~^ ERROR expected string literal
60
+ asm ! ( "" , clobber_abi( loop { } ) ) ;
61
+ //~^ ERROR expected string literal
62
+ asm ! ( "" , clobber_abi( if ) ) ;
63
+ //~^ ERROR expected string literal
64
+ asm ! ( "" , clobber_abi( do) ) ;
65
+ //~^ ERROR expected string literal
66
+ asm ! ( "" , clobber_abi( <) ) ;
67
+ //~^ ERROR expected string literal
68
+ asm ! ( "" , clobber_abi( . ) ) ;
69
+ //~^ ERROR expected string literal
70
+
49
71
asm ! ( "{}" , clobber_abi( "C" ) , const foo) ;
50
72
//~^ ERROR attempt to use a non-constant value in a constant
51
73
asm ! ( "" , options( ) , clobber_abi( "C" ) ) ;
@@ -56,15 +78,7 @@ fn main() {
56
78
//~^^ ERROR argument never used
57
79
//~^^^ ERROR attempt to use a non-constant value in a constant
58
80
//~^^^^ ERROR attempt to use a non-constant value in a constant
59
- asm ! ( "" , a = in( "eax" ) foo) ;
60
- //~^ ERROR explicit register arguments cannot have names
61
- asm ! ( "{a}" , in( "eax" ) foo, a = const bar) ;
62
- //~^ ERROR attempt to use a non-constant value in a constant
63
- asm ! ( "{a}" , in( "eax" ) foo, a = const bar) ;
64
- //~^ ERROR attempt to use a non-constant value in a constant
65
- asm ! ( "{1}" , in( "eax" ) foo, const bar) ;
66
- //~^ ERROR positional arguments cannot follow named arguments or explicit register arguments
67
- //~^^ ERROR attempt to use a non-constant value in a constant
81
+
68
82
asm ! ( "" , options( ) , "" ) ;
69
83
//~^ ERROR expected one of
70
84
asm ! ( "{}" , in( reg) foo, "{}" , out( reg) foo) ;
0 commit comments