-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
A-inlay-hintsinlay/inline hintsinlay/inline hintsA-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bug
Description
Can't find a similar issue, but in this function, the (inlay) hints are behaving weirdly.
As far as I can tell, this is just a visual issue.
rust-analyzer version: 0.3.2539-standalone
rustc version: rustc 1.87.0 (17067e9ac 2025-05-09)
editor or extension: VSCode + rust-lang.rust-analyzer 0.3.2539
code snippet to reproduce:
fn check_tostr_eq<L, R>(left: L, right: R)
where
L: ExactSizeIterator,
L::Item: ToString,
R: ExactSizeIterator,
R::Item: ToString,
{
use std::collections::HashSet;
assert_eq!(left.len(), right.len());
let l_strings: HashSet<_> = left.map(|s| s.to_string()).collect();
let r_strings: HashSet<_> = right.map(|s| s.to_string()).collect();
assert_eq!(l_strings, r_strings);
}
expected result:
s
in the closures should be shown asimpl ToString
result:
s
in the closures is shown to beimpl ToString + ToString
s
is always shown to beimpl L::Item + R::Item
, in that order- e.g., if
L::Item
in thewhere
is changed toClone
, boths
are shown asimpl Clone + ToString
instead - even though the hints say
s
implementsToString
, in that example thes.to_string()
is correctly identified to be erroneous by other checks - the names of the closure params don't seem to make any difference
ChayimFriedman2 and roife
Metadata
Metadata
Assignees
Labels
A-inlay-hintsinlay/inline hintsinlay/inline hintsA-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bug