Skip to content

fix: no suggest ref match when expected generic ref#22409

Merged
ChayimFriedman2 merged 1 commit into
rust-lang:masterfrom
A4-Tacks:no-suggest-ref-generic-ref
May 25, 2026
Merged

fix: no suggest ref match when expected generic ref#22409
ChayimFriedman2 merged 1 commit into
rust-lang:masterfrom
A4-Tacks:no-suggest-ref-generic-ref

Conversation

@A4-Tacks

Copy link
Copy Markdown
Member

Example

fn foo<T>(s: &T) {}
fn main() {
    let ssss = &mut 2i32;
    foo($0);
}

Before this PR

lc ssss &mut i32 [type_could_unify+local]
lc &ssss [type+local]
md core::  []
fn foo(…) fn(&T) []
fn &foo(…) [type]
fn main() fn() []
fn &main() [type]

After this PR

lc ssss &mut i32 [type_could_unify+local]
md core::  []
fn foo(…) fn(&T) []
fn &foo(…) [type]
fn main() fn() []
fn &main() [type]

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 20, 2026
@A4-Tacks A4-Tacks force-pushed the no-suggest-ref-generic-ref branch from 5129796 to f71e804 Compare May 20, 2026 09:31
@rustbot

This comment has been minimized.

Example
---
```rust
fn foo<T>(s: &T) {}
fn main() {
    let ssss = &mut 2i32;
    foo($0);
}
```

**Before this PR**

```text
lc ssss &mut i32 [type_could_unify+local]
lc &ssss [type+local]
md core::  []
fn foo(…) fn(&T) []
fn &foo(…) [type]
fn main() fn() []
fn &main() [type]
```

**After this PR**

```text
lc ssss &mut i32 [type_could_unify+local]
md core::  []
fn foo(…) fn(&T) []
fn &foo(…) [type]
fn main() fn() []
fn &main() [type]
```
@A4-Tacks A4-Tacks force-pushed the no-suggest-ref-generic-ref branch from f71e804 to 3c7db60 Compare May 24, 2026 01:34
@rustbot

rustbot commented May 24, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@ChayimFriedman2 ChayimFriedman2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth thinking whether we should check coercion instead, which will also fix that.

Also, we might want to omit the &foo() and &main() suggestions, given that they return () (and in general any &() suggestion)

View changes since this review

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue May 25, 2026
Merged via the queue into rust-lang:master with commit 70ca498 May 25, 2026
18 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 25, 2026
@A4-Tacks A4-Tacks deleted the no-suggest-ref-generic-ref branch May 25, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants