Format all the let chains in compiler
This commit is contained in:
parent
2763ca50da
commit
b2d2184ede
206 changed files with 3120 additions and 2228 deletions
|
@ -184,9 +184,10 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ImplTraitInTraitFinder<'_, 'tcx> {
|
|||
|
||||
fn visit_ty(&mut self, ty: Ty<'tcx>) -> std::ops::ControlFlow<Self::BreakTy> {
|
||||
if let ty::Alias(ty::Projection, unshifted_alias_ty) = *ty.kind()
|
||||
&& let Some(ty::ImplTraitInTraitData::Trait { fn_def_id, .. }
|
||||
| ty::ImplTraitInTraitData::Impl { fn_def_id, .. })
|
||||
= self.tcx.opt_rpitit_info(unshifted_alias_ty.def_id)
|
||||
&& let Some(
|
||||
ty::ImplTraitInTraitData::Trait { fn_def_id, .. }
|
||||
| ty::ImplTraitInTraitData::Impl { fn_def_id, .. },
|
||||
) = self.tcx.opt_rpitit_info(unshifted_alias_ty.def_id)
|
||||
&& fn_def_id == self.fn_def_id
|
||||
&& self.seen.insert(unshifted_alias_ty.def_id)
|
||||
{
|
||||
|
@ -202,7 +203,11 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ImplTraitInTraitFinder<'_, 'tcx> {
|
|||
"we shouldn't walk non-predicate binders with `impl Trait`...",
|
||||
);
|
||||
}
|
||||
ty::Region::new_late_bound(self.tcx, index.shifted_out_to_binder(self.depth), bv)
|
||||
ty::Region::new_late_bound(
|
||||
self.tcx,
|
||||
index.shifted_out_to_binder(self.depth),
|
||||
bv,
|
||||
)
|
||||
} else {
|
||||
re
|
||||
}
|
||||
|
@ -211,12 +216,21 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ImplTraitInTraitFinder<'_, 'tcx> {
|
|||
// If we're lowering to associated item, install the opaque type which is just
|
||||
// the `type_of` of the trait's associated item. If we're using the old lowering
|
||||
// strategy, then just reinterpret the associated type like an opaque :^)
|
||||
let default_ty = self.tcx.type_of(shifted_alias_ty.def_id).instantiate(self.tcx, shifted_alias_ty.args);
|
||||
let default_ty = self
|
||||
.tcx
|
||||
.type_of(shifted_alias_ty.def_id)
|
||||
.instantiate(self.tcx, shifted_alias_ty.args);
|
||||
|
||||
self.predicates.push(ty::Binder::bind_with_vars(
|
||||
ty::ProjectionPredicate { projection_ty: shifted_alias_ty, term: default_ty.into() },
|
||||
self.bound_vars,
|
||||
).to_predicate(self.tcx));
|
||||
self.predicates.push(
|
||||
ty::Binder::bind_with_vars(
|
||||
ty::ProjectionPredicate {
|
||||
projection_ty: shifted_alias_ty,
|
||||
term: default_ty.into(),
|
||||
},
|
||||
self.bound_vars,
|
||||
)
|
||||
.to_predicate(self.tcx),
|
||||
);
|
||||
|
||||
// We walk the *un-shifted* alias ty, because we're tracking the de bruijn
|
||||
// binder depth, and if we were to walk `shifted_alias_ty` instead, we'd
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue