-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
false positive for if-let-rescope
on enums when the pattern exhaustively matches all cases with significant-drop fields
#137376
Comments
This comment has been minimized.
This comment has been minimized.
Looking back through the actual It looks like none of these 4 warnings really apply to this issue desciption
Instead, these feature 2 different things:
I have no idea if that’s a common case though… (false positives involving Because this example, too, is still a true false positive (the custom drop impl is never called at a different time between editions). At least I’m pretty sure it isn’t. The specific circumstances that might be easy to catch, and common, might be:
|
For the record, the false positives that come from
|
Coming from #133167 (comment) and from this new forum thread, my takeaway of some remaining clear false positives is:
if the
if let
matches on an enum and only some enum variant(s) have fields with potentially-significant destructor, but those are exhaustively matched in the non-else
case of theif let
, then there can be no actual change in behavior, because theelse
case is only reached in case the drop is not significantin the case of
cargo-edit
, this wasif let Some(…irrefutable…) = expr
on anOption<T>
in the urlo thread, I’ve identified the case of
if let Err(…irrefutable…)
on aResult<(), E>
Here’s a simple repro for an
Option
case:Code
Here’s the code in the playground.
Current output
@rustbot label A-edition-2024, A-lints, L-if_let_rescope, C-enhancement
The text was updated successfully, but these errors were encountered: