-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
A-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bug
Description
rust-analyzer version: 0.3.2735-standalone
rustc version: rustc 1.92.0 (ded5c06cf 2025-12-08)
editor or extension: VSCode + 0.3.2735
relevant settings:
repository link (if public, optional):
code snippet to reproduce:
let y = Some("".to_string());
let closure = || {
if let Some(ref x) = y
&& x.is_empty()
{
false
} else {
true
}
}With above code, RA would hint that closure is impl FnOnce() -> bool = move(y).
If change the if let line to if let Some(x) = y.as_ref(), then hint is impl Fn() -> bool = move(&y).
Seems like RA thought the two closures move different things hence giving them different types. But actually both are impl Fn() -> bool. It should not be FnOnce.
studyingegret and ZXY595
Metadata
Metadata
Assignees
Labels
A-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bug