-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Add a "raw" option for asm! which ignores format string specifiers #86599
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
I don't think I should be reviewing this. r? @nagisa maybe? |
Huh, this is an interesting artifact of the fact that we do not require the assembly fragments to be a literal string. I do wonder, however, if it would perhaps make more sense to automatically consider assembly to be "raw" if the assembly doesn't come from string literals? I think the ability to interpolate |
We do require that asm fragments are string literals: |
Hm, confusing, because fn main() {
println!(include_str("format"), 42); // where `format` contains `{}`
} does not work and compiler demands a literal string literal:
I wonder why the discrepancy. I bet it'll have something to do with macro expansion order perhaps? |
There's a typo in your code, you forgot the |
Ah, silly me. @bors r+ |
📌 Commit d0443bb has been approved by |
☀️ Test successful - checks-actions |
As reported in issue cloud-hypervisor#143, recent nightly rustc fails to compile the assembly file because it uses AT&T syntax. It is also suggested that use raw option when using `include_str!` macro. https://rust-lang.github.io/rfcs/2873-inline-asm.html#options-1 rust-lang/rust#86599 Signed-off-by: Akira Moroo <retrage01@gmail.com>
As reported in issue #143, recent nightly rustc fails to compile the assembly file because it uses AT&T syntax. It is also suggested that use raw option when using `include_str!` macro. https://rust-lang.github.io/rfcs/2873-inline-asm.html#options-1 rust-lang/rust#86599 Signed-off-by: Akira Moroo <retrage01@gmail.com>
This is useful when including raw assembly snippets using
include_str!
.