Skip to content

fix: only ref match non-unknown value items#22367

Open
A4-Tacks wants to merge 1 commit into
rust-lang:masterfrom
A4-Tacks:ref-match-only-value
Open

fix: only ref match non-unknown value items#22367
A4-Tacks wants to merge 1 commit into
rust-lang:masterfrom
A4-Tacks:ref-match-only-value

Conversation

@A4-Tacks
Copy link
Copy Markdown
Member

@A4-Tacks A4-Tacks commented May 15, 2026

Fixes #22324

Example

struct S<T>(T);
impl<T> core::ops::Deref for S<T> {
    type Target = T;
}
fn foo<T>(s: &u32) {}
fn main() {
    let ssss = S();
    foo($0);
}

Before this PR

lc ssss S<{unknown}> [local]
lc &ssss [type+local]
st S S<{unknown}> []
st &S [type]
...

After this PR

lc ssss S<{unknown}> [local]
st S S<{unknown}> []
...

Example
---
```rust
struct S<T>(T);
impl<T> core::ops::Deref for S<T> {
    type Target = T;
}
fn foo<T>(s: &u32) {}
fn main() {
    let ssss = S();
    foo($0);
}
```

**Before this PR**

```text
lc ssss S<{unknown}> [local]
lc &ssss [type+local]
st S S<{unknown}> []
st &S [type]
...
```

**After this PR**

```text
lc ssss S<{unknown}> [local]
st S S<{unknown}> []
...
```
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strangly refmatch type

2 participants