Closed
Description
I tried this code:
unsafe fn rep_movsb(mut dest: *mut u8, mut src: *const u8, mut n: usize) -> *mut u8 {
while n != 0 {
asm!(
"rep movsb",
inout("rcx") n,
inout("rsi") src,
inout("rdi") dest,
);
}
return dest;
}
I expected to see this happen:
Compiler doesn't generate any warnings
Instead, this happened:
Rustc says that src
is unused, even though it is declared as inout
in asm.
Adding arrows (inout("rsi") src => src
) fixes it
Meta
rustc --version --verbose
:
rustc 1.49.0-nightly (8dae8cdcc 2020-10-12)
binary: rustc
commit-hash: 8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306
commit-date: 2020-10-12
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0