mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
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.
This commit is contained in:
parent
2d20ab7eaf
commit
c2aefd5b95
2 changed files with 14 additions and 7 deletions
|
@ -414,17 +414,16 @@ impl<'a> TyLoweringContext<'a> {
|
||||||
self.lower_trait_ref_from_resolved_path(trait_, resolved_segment, self_ty);
|
self.lower_trait_ref_from_resolved_path(trait_, resolved_segment, self_ty);
|
||||||
let ty = if remaining_segments.len() == 1 {
|
let ty = if remaining_segments.len() == 1 {
|
||||||
let segment = remaining_segments.first().unwrap();
|
let segment = remaining_segments.first().unwrap();
|
||||||
let found = associated_type_by_name_including_super_traits(
|
let found = self
|
||||||
self.db,
|
.db
|
||||||
trait_ref,
|
.trait_data(trait_ref.hir_trait_id())
|
||||||
&segment.name,
|
.associated_type_by_name(&segment.name);
|
||||||
);
|
|
||||||
match found {
|
match found {
|
||||||
Some((super_trait_ref, associated_ty)) => {
|
Some(associated_ty) => {
|
||||||
// FIXME handle type parameters on the segment
|
// FIXME handle type parameters on the segment
|
||||||
TyKind::Alias(AliasTy::Projection(ProjectionTy {
|
TyKind::Alias(AliasTy::Projection(ProjectionTy {
|
||||||
associated_ty_id: to_assoc_type_id(associated_ty),
|
associated_ty_id: to_assoc_type_id(associated_ty),
|
||||||
substitution: super_trait_ref.substitution,
|
substitution: trait_ref.substitution,
|
||||||
}))
|
}))
|
||||||
.intern(&Interner)
|
.intern(&Interner)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1039,6 +1039,14 @@ fn test() {
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
|
144..152 'residual': R
|
||||||
|
365..366 'r': ControlFlow<B, !>
|
||||||
|
395..410 '{ ControlFlow }': ControlFlow<B, C>
|
||||||
|
397..408 'ControlFlow': ControlFlow<B, C>
|
||||||
|
424..482 '{ ...!>); }': ()
|
||||||
|
430..456 'Contro...sidual': fn from_residual<ControlFlow<u32, {unknown}>, ControlFlow<u32, !>>(ControlFlow<u32, !>) -> ControlFlow<u32, {unknown}>
|
||||||
|
430..479 'Contro...2, !>)': ControlFlow<u32, {unknown}>
|
||||||
|
457..478 'Contro...32, !>': ControlFlow<u32, !>
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue