Skip to content
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

"argument never used" in new asm! syntax #72965

Closed
cesarb opened this issue Jun 4, 2020 · 1 comment
Closed

"argument never used" in new asm! syntax #72965

cesarb opened this issue Jun 4, 2020 · 1 comment
Labels
A-inline-assembly Area: inline asm!(..) C-bug Category: This is a bug. F-asm `#![feature(asm)]` (not `llvm_asm`) requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@cesarb
Copy link
Contributor

cesarb commented Jun 4, 2020

When trying to use the new asm! syntax to implement something similar to std::hint::black_box, it fails with an "argument never used" error. For example (https://godbolt.org/z/mG9AMg):

#![feature(asm)]

pub fn black_box(dummy: i32) -> i32 {
    unsafe {
        asm!("", in(reg) &dummy, options(nostack));
        dummy
    }
}
error: argument never used

 --> <source>:5:18

  |

5 |         asm!("", in(reg) &dummy, options(nostack));

  |                  ^^^^^^^^^^^^^^ argument never used


error: aborting due to previous error


Compiler returned: 1

This makes it impossible to use the new asm! syntax in one of my crates (cesarb/clear_on_drop@43cd2be with CI output at https://travis-ci.org/github/cesarb/clear_on_drop/jobs/694467164).

cesarb added a commit to cesarb/clear_on_drop that referenced this issue Jun 4, 2020
The new asm! syntax is currently unable to do this trick, see
rust-lang/rust#72965 for details.
@jonas-schievink jonas-schievink added A-inline-assembly Area: inline asm!(..) F-asm `#![feature(asm)]` (not `llvm_asm`) C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. requires-nightly This issue requires a nightly compiler in some way. labels Jun 4, 2020
@Amanieu
Copy link
Member

Amanieu commented Jun 12, 2020

Fixed by #73230

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inline-assembly Area: inline asm!(..) C-bug Category: This is a bug. F-asm `#![feature(asm)]` (not `llvm_asm`) requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants