Rustfmt resolve_implementation.

This commit is contained in:
Camille GILLOT 2022-06-05 17:31:49 +02:00
parent 228def7e20
commit 80c6a1f275

View file

@ -2112,12 +2112,25 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
) {
debug!("resolve_implementation");
// If applicable, create a rib for the type parameters.
self.with_generic_param_rib(&generics.params, ItemRibKind(HasGenericParams::Yes), LifetimeRibKind::Generics { span: generics.span, binder: item_id, kind: LifetimeBinderKind::ImplBlock }, |this| {
self.with_generic_param_rib(
&generics.params,
ItemRibKind(HasGenericParams::Yes),
LifetimeRibKind::Generics {
span: generics.span,
binder: item_id,
kind: LifetimeBinderKind::ImplBlock
},
|this| {
// Dummy self type for better errors if `Self` is used in the trait path.
this.with_self_rib(Res::SelfTy { trait_: None, alias_to: None }, |this| {
this.with_lifetime_rib(LifetimeRibKind::AnonymousCreateParameter(item_id), |this| {
this.with_lifetime_rib(
LifetimeRibKind::AnonymousCreateParameter(item_id),
|this| {
// Resolve the trait reference, if necessary.
this.with_optional_trait_ref(opt_trait_reference.as_ref(), self_type, |this, trait_id| {
this.with_optional_trait_ref(
opt_trait_reference.as_ref(),
self_type,
|this, trait_id| {
let item_def_id = this.r.local_def_id(item_id);
// Register the trait definitions from here.
@ -2126,8 +2139,10 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
}
let item_def_id = item_def_id.to_def_id();
let res =
Res::SelfTy { trait_: trait_id, alias_to: Some((item_def_id, false)) };
let res = Res::SelfTy {
trait_: trait_id,
alias_to: Some((item_def_id, false)),
};
this.with_self_rib(res, |this| {
if let Some(trait_ref) = opt_trait_reference.as_ref() {
// Resolve type arguments in the trait path.
@ -2152,10 +2167,13 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
},
);
});
},
);
},
);
});
});
});
});
},
);
}
fn resolve_impl_item(&mut self, item: &'ast AssocItem) {