Open madonuko opened 11 months ago
Yes, it's broken as hell.
😁 😁 😁
Thank you for the feedback. The lint currently does not track lifetimes derived from the original guard but this situation will change once the code is ported to MIR in the next few months.
Summary
This issue seems to happen only on nightly. Not sure about beta.
Clippy will decide to
drop()
guards that are still being indirectly borrowed by another variable that will be later used.Note that I used
cargo +nightly
to run clippy, so the output ofcargo +nightly -vV
is provided instead.Also, the suggestions given by clippy in the reproducer is actually really really buggy for some reason.
Lint Name
significant_drop_tightening
Reproducer
Note: the message below is copy-pasted without changes whatsoever. Yes, it's broken as hell.
I cannot fully reproduce this behaviour by Clippy: I initially found this by running Clippy on my project and it tells me this:
but if you look at the actual code, you actually cannot drop it there because it's still being borrowed by
inner
andinner
is used forstdout.write_fmt()
on the next line. Note that the type ofs
is actually&Arc<Mutex<smartstring::alias::String>>
. I tried to use this type in the reproducer instead but to no avail.Version
Additional Labels
I-suggestion-causes-error
please :3