mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-02 21:04:18 +00:00
Fix detection of ref patterns for path patterns
I was wrong on #19127, I thought hir-def resolver is enough for them, but it turns out not because of paths like `<Enum>::Variant` and `Type::AssocThatIsEnum::Variant`.
This commit is contained in:
parent
09db657439
commit
eb69d3734c
4 changed files with 64 additions and 17 deletions
|
|
@ -1235,4 +1235,25 @@ fn f() {
|
|||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn complex_enum_variant_non_ref_pat() {
|
||||
check_diagnostics(
|
||||
r#"
|
||||
enum Enum { Variant }
|
||||
|
||||
trait Trait {
|
||||
type Assoc;
|
||||
}
|
||||
impl Trait for () {
|
||||
type Assoc = Enum;
|
||||
}
|
||||
|
||||
fn foo(v: &Enum) {
|
||||
let <Enum>::Variant = v;
|
||||
let <() as Trait>::Assoc::Variant = v;
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue