Open
Description
When I call std::mem::drop
on a mutable reference, this is supposed to consume the reference and make it unavailable to following code. And indeed it does, because any following uses trigger a "use of moved value" error.
But when I do this, I get a warning from the compiler:
warning: calls to
std::mem::drop
with a reference instead of an owned value does nothing
--> foo.rs:1602:13
|
1602 | mem::drop(mutref);
| ^^^^^^^^^^-------------^
| |
| argument has type&mut Foo
|
= note: uselet _ = ...
to ignore the expression or result
= note:#[warn(dropping_references)]
on by default
Meta
rustc --version --verbose
:
rustc 1.80.0-nightly (7c52d2db6 2024-06-03)
binary: rustc
commit-hash: 7c52d2db6348b038276198e88a835125849f322e
commit-date: 2024-06-03
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.6