diff options
author | Florian Diebold <[email protected]> | 2021-04-29 19:21:50 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-04-29 19:23:02 +0100 |
commit | c2aefd5b95adb9e07919a11cdfcca45de79b5324 (patch) | |
tree | e16281e3b3f694775a88b6ed39e5a37db7125183 /crates/hir_ty/src/lower.rs | |
parent | 2d20ab7eaf928dfaf3e1823707a3b6b84e918d07 (diff) |
Don't look in super traits for <T as Trait>::Assoc
This isn't actually how it works, you have to specify the exact trait
that has the associated type.
Fixes #8686.
Diffstat (limited to 'crates/hir_ty/src/lower.rs')
-rw-r--r-- | crates/hir_ty/src/lower.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index d01933e6b..c99dd8d0a 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs | |||
@@ -414,17 +414,16 @@ impl<'a> TyLoweringContext<'a> { | |||
414 | self.lower_trait_ref_from_resolved_path(trait_, resolved_segment, self_ty); | 414 | self.lower_trait_ref_from_resolved_path(trait_, resolved_segment, self_ty); |
415 | let ty = if remaining_segments.len() == 1 { | 415 | let ty = if remaining_segments.len() == 1 { |
416 | let segment = remaining_segments.first().unwrap(); | 416 | let segment = remaining_segments.first().unwrap(); |
417 | let found = associated_type_by_name_including_super_traits( | 417 | let found = self |
418 | self.db, | 418 | .db |
419 | trait_ref, | 419 | .trait_data(trait_ref.hir_trait_id()) |
420 | &segment.name, | 420 | .associated_type_by_name(&segment.name); |
421 | ); | ||
422 | match found { | 421 | match found { |
423 | Some((super_trait_ref, associated_ty)) => { | 422 | Some(associated_ty) => { |
424 | // FIXME handle type parameters on the segment | 423 | // FIXME handle type parameters on the segment |
425 | TyKind::Alias(AliasTy::Projection(ProjectionTy { | 424 | TyKind::Alias(AliasTy::Projection(ProjectionTy { |
426 | associated_ty_id: to_assoc_type_id(associated_ty), | 425 | associated_ty_id: to_assoc_type_id(associated_ty), |
427 | substitution: super_trait_ref.substitution, | 426 | substitution: trait_ref.substitution, |
428 | })) | 427 | })) |
429 | .intern(&Interner) | 428 | .intern(&Interner) |
430 | } | 429 | } |