Add unit assignment to MIR for asm!()
This commit is contained in:
parent
a0648eab36
commit
cd0873b502
3 changed files with 35 additions and 3 deletions
14
src/test/ui/asm/issue-89305.rs
Normal file
14
src/test/ui/asm/issue-89305.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// Regression test for #89305, where a variable was erroneously reported
|
||||
// as both unused and possibly-uninitialized.
|
||||
|
||||
// check-pass
|
||||
|
||||
#![feature(asm)]
|
||||
#![warn(unused)]
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
let x: () = asm!("nop");
|
||||
//~^ WARNING: unused variable: `x`
|
||||
}
|
||||
}
|
||||
15
src/test/ui/asm/issue-89305.stderr
Normal file
15
src/test/ui/asm/issue-89305.stderr
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
warning: unused variable: `x`
|
||||
--> $DIR/issue-89305.rs:11:13
|
||||
|
|
||||
LL | let x: () = asm!("nop");
|
||||
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-89305.rs:7:9
|
||||
|
|
||||
LL | #![warn(unused)]
|
||||
| ^^^^^^
|
||||
= note: `#[warn(unused_variables)]` implied by `#[warn(unused)]`
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue