diff options
| author | bors <bors@rust-lang.org> | 2020-12-19 10:13:52 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-12-19 10:13:52 +0000 |
| commit | 8bb302d34dde36cc78a288cb5beb4af7fe30ba41 (patch) | |
| tree | 61b64b211aa67a08b0bbc1cbaf7a8059bdbdc9cb /src | |
| parent | e461b8137f8f7277147e3ec8ec0b7f0f31d32d0b (diff) | |
| parent | 5e7095850c3577666a6b8e628760dea7cccb46b7 (diff) | |
| download | rust-8bb302d34dde36cc78a288cb5beb4af7fe30ba41.tar.gz rust-8bb302d34dde36cc78a288cb5beb4af7fe30ba41.zip | |
Auto merge of #80106 - jackh726:binder-refactor-part-2, r=lcnr
A lot of refactoring to remove more `Binder::bind`s Split out from #76814
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 18 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/await_holding_invalid.rs | 2 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 07255168d06..1c9b19e6b87 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -469,8 +469,9 @@ impl Clean<WherePredicate> for hir::WherePredicate<'_> { impl<'a> Clean<Option<WherePredicate>> for ty::Predicate<'a> { fn clean(&self, cx: &DocContext<'_>) -> Option<WherePredicate> { - match self.skip_binders() { - ty::PredicateAtom::Trait(pred, _) => Some(ty::Binder::bind(pred).clean(cx)), + let bound_predicate = self.bound_atom(); + match bound_predicate.skip_binder() { + ty::PredicateAtom::Trait(pred, _) => Some(bound_predicate.rebind(pred).clean(cx)), ty::PredicateAtom::RegionOutlives(pred) => pred.clean(cx), ty::PredicateAtom::TypeOutlives(pred) => pred.clean(cx), ty::PredicateAtom::Projection(pred) => Some(pred.clean(cx)), @@ -733,7 +734,8 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx .flat_map(|(p, _)| { let mut projection = None; let param_idx = (|| { - match p.skip_binders() { + let bound_p = p.bound_atom(); + match bound_p.skip_binder() { ty::PredicateAtom::Trait(pred, _constness) => { if let ty::Param(param) = pred.self_ty().kind() { return Some(param.index); @@ -746,7 +748,7 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx } ty::PredicateAtom::Projection(p) => { if let ty::Param(param) = p.projection_ty.self_ty().kind() { - projection = Some(ty::Binder::bind(p)); + projection = Some(bound_p.rebind(p)); return Some(param.index); } } @@ -1659,12 +1661,10 @@ impl<'tcx> Clean<Type> for Ty<'tcx> { .filter_map(|bound| { // Note: The substs of opaque types can contain unbound variables, // meaning that we have to use `ignore_quantifiers_with_unbound_vars` here. - let trait_ref = match bound - .bound_atom_with_opt_escaping(cx.tcx) - .skip_binder() - { + let bound_predicate = bound.bound_atom_with_opt_escaping(cx.tcx); + let trait_ref = match bound_predicate.skip_binder() { ty::PredicateAtom::Trait(tr, _constness) => { - ty::Binder::bind(tr.trait_ref) + bound_predicate.rebind(tr.trait_ref) } ty::PredicateAtom::TypeOutlives(ty::OutlivesPredicate(_ty, reg)) => { if let Some(r) = reg.clean(cx) { diff --git a/src/tools/clippy/clippy_lints/src/await_holding_invalid.rs b/src/tools/clippy/clippy_lints/src/await_holding_invalid.rs index 58892024ce2..cfade9cbc46 100644 --- a/src/tools/clippy/clippy_lints/src/await_holding_invalid.rs +++ b/src/tools/clippy/clippy_lints/src/await_holding_invalid.rs @@ -99,7 +99,7 @@ impl LateLintPass<'_> for AwaitHolding { }; let def_id = cx.tcx.hir().body_owner_def_id(body_id); let typeck_results = cx.tcx.typeck(def_id); - check_interior_types(cx, &typeck_results.generator_interior_types, body.value.span); + check_interior_types(cx, &typeck_results.generator_interior_types.as_ref().skip_binder(), body.value.span); } } } |
