Fix bound var resolution for trait aliases
Handle DefKind::TraitAlias in resolve_bound_vars so that associated item constraints and return type notation work through trait aliases.
This commit is contained in:
parent
8c5605e130
commit
7c5ea7ffd6
3 changed files with 30 additions and 2 deletions
|
|
@ -1695,7 +1695,8 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
|
|||
| DefKind::Union
|
||||
| DefKind::Enum
|
||||
| DefKind::TyAlias
|
||||
| DefKind::Trait,
|
||||
| DefKind::Trait
|
||||
| DefKind::TraitAlias,
|
||||
def_id,
|
||||
) if depth == 0 => Some(def_id),
|
||||
_ => None,
|
||||
|
|
@ -1865,7 +1866,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
|
|||
if constraint.gen_args.parenthesized == hir::GenericArgsParentheses::ReturnTypeNotation
|
||||
{
|
||||
let bound_vars = if let Some(type_def_id) = type_def_id
|
||||
&& self.tcx.def_kind(type_def_id) == DefKind::Trait
|
||||
&& let DefKind::Trait | DefKind::TraitAlias = self.tcx.def_kind(type_def_id)
|
||||
&& let Some((mut bound_vars, assoc_fn)) = BoundVarContext::supertrait_hrtb_vars(
|
||||
self.tcx,
|
||||
type_def_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue