diff options
| author | Fabian Wolff <fabian.wolff@alumni.ethz.ch> | 2021-09-27 23:06:16 +0200 |
|---|---|---|
| committer | Fabian Wolff <fabian.wolff@alumni.ethz.ch> | 2021-09-28 01:38:54 +0200 |
| commit | cd0873b50276bca8bfcaf8d12beeb28d3fffb692 (patch) | |
| tree | 42e26a139d0d89eeb86da9d7d3fdb6659d8b9b65 /src | |
| parent | a0648eab3686f100c7ab9b0d38472c740079cce4 (diff) | |
| download | rust-cd0873b50276bca8bfcaf8d12beeb28d3fffb692.tar.gz rust-cd0873b50276bca8bfcaf8d12beeb28d3fffb692.zip | |
Add unit assignment to MIR for `asm!()`
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/asm/issue-89305.rs | 14 | ||||
| -rw-r--r-- | src/test/ui/asm/issue-89305.stderr | 15 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/test/ui/asm/issue-89305.rs b/src/test/ui/asm/issue-89305.rs new file mode 100644 index 00000000000..bdcf3f305eb --- /dev/null +++ b/src/test/ui/asm/issue-89305.rs @@ -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` + } +} diff --git a/src/test/ui/asm/issue-89305.stderr b/src/test/ui/asm/issue-89305.stderr new file mode 100644 index 00000000000..9cc127b44d0 --- /dev/null +++ b/src/test/ui/asm/issue-89305.stderr @@ -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 + |
