-
Notifications
You must be signed in to change notification settings - Fork 13.6k
builtin_macros: Fix use of interpolated identifiers in asm!
#77595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// only-x86_64 | ||
|
||
#![feature(asm)] | ||
|
||
macro_rules! m { | ||
($in:ident $out:ident $lateout:ident $inout:ident $inlateout:ident $const:ident $sym:ident | ||
$pure:ident $nomem:ident $readonly:ident $preserves_flags:ident | ||
$noreturn:ident $nostack:ident $att_syntax:ident $options:ident) => { | ||
unsafe { | ||
asm!("", $in(x) x, $out(x) x, $lateout(x) x, $inout(x) x, $inlateout(x) x, | ||
//~^ ERROR asm outputs are not allowed with the `noreturn` option | ||
const x, sym x, | ||
$options($pure, $nomem, $readonly, $preserves_flags, $noreturn, $nostack, $att_syntax)); | ||
//~^ ERROR the `nomem` and `readonly` options are mutually exclusive | ||
//~| ERROR the `pure` and `noreturn` options are mutually exclusive | ||
} | ||
}; | ||
} | ||
|
||
fn main() { | ||
m!(in out lateout inout inlateout const sym | ||
pure nomem readonly preserves_flags | ||
noreturn nostack att_syntax options); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
error: the `nomem` and `readonly` options are mutually exclusive | ||
--> $DIR/interpolated-idents.rs:13:13 | ||
| | ||
LL | $options($pure, $nomem, $readonly, $preserves_flags, $noreturn, $nostack, $att_syntax)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
... | ||
LL | / m!(in out lateout inout inlateout const sym | ||
LL | | pure nomem readonly preserves_flags | ||
LL | | noreturn nostack att_syntax options); | ||
| |____________________________________________- in this macro invocation | ||
| | ||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: the `pure` and `noreturn` options are mutually exclusive | ||
--> $DIR/interpolated-idents.rs:13:13 | ||
| | ||
LL | $options($pure, $nomem, $readonly, $preserves_flags, $noreturn, $nostack, $att_syntax)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
... | ||
LL | / m!(in out lateout inout inlateout const sym | ||
LL | | pure nomem readonly preserves_flags | ||
LL | | noreturn nostack att_syntax options); | ||
| |____________________________________________- in this macro invocation | ||
| | ||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: asm outputs are not allowed with the `noreturn` option | ||
--> $DIR/interpolated-idents.rs:10:32 | ||
| | ||
LL | asm!("", $in(x) x, $out(x) x, $lateout(x) x, $inout(x) x, $inlateout(x) x, | ||
| ^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^^^ | ||
... | ||
LL | m!(in out lateout inout inlateout const sym | ||
| _____- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh wow... cc @rust-lang/wg-diagnostics we should probably deduplicate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we do this already, but it's intentionally disabled for UI tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Aaron1011 |
||
| |_____| | ||
| |_____| | ||
| |_____| | ||
| | | ||
LL | | pure nomem readonly preserves_flags | ||
LL | | noreturn nostack att_syntax options); | ||
| | - | ||
| |____________________________________________| | ||
| |____________________________________________in this macro invocation | ||
| |____________________________________________in this macro invocation | ||
| |____________________________________________in this macro invocation | ||
| in this macro invocation | ||
| | ||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 3 previous errors | ||
|
Uh oh!
There was an error while loading. Please reload this page.