about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-10-23 06:20:24 +0000
committerbors <bors@rust-lang.org>2022-10-23 06:20:24 +0000
commitfaab68eb29121f25b577b50e2e00e33bafc60a36 (patch)
treef60ad6322423365c1d9a70a5faf05a261627f2ea /compiler/rustc_hir_analysis/src
parent6c9c2d862dd10718ba2b2a320c3390995ad414bc (diff)
parent25e02d6efcac6bd25131e64b80aaf270f380dd8f (diff)
downloadrust-faab68eb29121f25b577b50e2e00e33bafc60a36.tar.gz
rust-faab68eb29121f25b577b50e2e00e33bafc60a36.zip
Auto merge of #103426 - matthiaskrgr:rollup-n6dqdy8, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #103123 (Introduce `subst_iter` and `subst_iter_copied` on `EarlyBinder` )
 - #103328 (Do not suggest trivially false const predicates)
 - #103354 (Escape string literals when fixing overlong char literal)
 - #103355 (Handle return-position `impl Trait` in traits properly in `register_hidden_type`)
 - #103368 (Delay ambiguity span bug in normalize query iff not rustdoc)
 - #103388 (rustdoc: remove unused CSS class `.result-description`)
 - #103399 (Change `unknown_lint` applicability to `MaybeIncorrect`)
 - #103401 (Use functions for headings rustdoc GUI test)
 - #103412 (Fix typo in docs of `String::leak`.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
-rw-r--r--compiler/rustc_hir_analysis/src/check/compare_method.rs16
1 files changed, 4 insertions, 12 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/compare_method.rs b/compiler/rustc_hir_analysis/src/check/compare_method.rs
index 60eaad9b498..3469ec4767b 100644
--- a/compiler/rustc_hir_analysis/src/check/compare_method.rs
+++ b/compiler/rustc_hir_analysis/src/check/compare_method.rs
@@ -664,10 +664,7 @@ impl<'tcx> TypeFolder<'tcx> for ImplTraitInTraitCollector<'_, 'tcx> {
             });
             self.types.insert(proj.item_def_id, (infer_ty, proj.substs));
             // Recurse into bounds
-            for pred in self.tcx().bound_explicit_item_bounds(proj.item_def_id).transpose_iter() {
-                let pred_span = pred.0.1;
-
-                let pred = pred.map_bound(|(pred, _)| *pred).subst(self.tcx(), proj.substs);
+            for (pred, pred_span) in self.tcx().bound_explicit_item_bounds(proj.item_def_id).subst_iter_copied(self.tcx(), proj.substs) {
                 let pred = pred.fold_with(self);
                 let pred = self.ocx.normalize(
                     ObligationCause::misc(self.span, self.body_id),
@@ -1752,15 +1749,10 @@ pub fn check_type_bounds<'tcx>(
 
     let obligations = tcx
         .bound_explicit_item_bounds(trait_ty.def_id)
-        .transpose_iter()
-        .map(|e| e.map_bound(|e| *e).transpose_tuple2())
-        .map(|(bound, span)| {
-            debug!(?bound);
-            // this is where opaque type is found
-            let concrete_ty_bound = bound.subst(tcx, rebased_substs);
+        .subst_iter_copied(tcx, rebased_substs)
+        .map(|(concrete_ty_bound, span)| {
             debug!("check_type_bounds: concrete_ty_bound = {:?}", concrete_ty_bound);
-
-            traits::Obligation::new(mk_cause(span.0), param_env, concrete_ty_bound)
+            traits::Obligation::new(mk_cause(span), param_env, concrete_ty_bound)
         })
         .collect();
     debug!("check_type_bounds: item_bounds={:?}", obligations);