File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
src/tools/rust-analyzer/crates/ide-completion/src Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -630,7 +630,8 @@ fn compute_ref_match(
630630 return None ;
631631 }
632632 if let Some ( expected_without_ref) = & expected_without_ref
633- && completion_without_ref. is_none ( )
633+ && ( completion_without_ref. is_none ( )
634+ || completion_ty. could_unify_with ( ctx. db , expected_without_ref) )
634635 && completion_ty. autoderef ( ctx. db ) . any ( |ty| ty == * expected_without_ref)
635636 {
636637 cov_mark:: hit!( suggest_ref) ;
@@ -2232,6 +2233,24 @@ fn main() {
22322233 fn main() fn() []
22332234 "# ] ] ,
22342235 ) ;
2236+ check_relevance (
2237+ r#"
2238+ struct S;
2239+ fn foo(s: &&S) {}
2240+ fn main() {
2241+ let mut ssss = &S;
2242+ foo($0);
2243+ }
2244+ "# ,
2245+ expect ! [ [ r#"
2246+ st S S []
2247+ lc ssss &S [local]
2248+ lc &ssss [type+local]
2249+ st S S []
2250+ fn foo(…) fn(&&S) []
2251+ fn main() fn() []
2252+ "# ] ] ,
2253+ ) ;
22352254 }
22362255
22372256 #[ test]
You can’t perform that action at this time.
0 commit comments