Skip to content

Commit d54568a

Browse files
committed
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
2 parents 5405cbf + ca06229 commit d54568a

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

clippy_utils/src/ty.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -657,21 +657,18 @@ fn sig_for_projection<'tcx>(cx: &LateContext<'tcx>, ty: ProjectionTy<'tcx>) -> O
657657
let mut output = None;
658658
let lang_items = cx.tcx.lang_items();
659659

660-
for pred in cx
660+
for (pred, _) in cx
661661
.tcx
662662
.bound_explicit_item_bounds(ty.item_def_id)
663-
.transpose_iter()
664-
.map(|x| x.map_bound(|(p, _)| p))
663+
.subst_iter_copied(cx.tcx, ty.substs)
665664
{
666-
match pred.0.kind().skip_binder() {
665+
match pred.kind().skip_binder() {
667666
PredicateKind::Trait(p)
668667
if (lang_items.fn_trait() == Some(p.def_id())
669668
|| lang_items.fn_mut_trait() == Some(p.def_id())
670669
|| lang_items.fn_once_trait() == Some(p.def_id())) =>
671670
{
672-
let i = pred
673-
.map_bound(|pred| pred.kind().rebind(p.trait_ref.substs.type_at(1)))
674-
.subst(cx.tcx, ty.substs);
671+
let i = pred.kind().rebind(p.trait_ref.substs.type_at(1));
675672

676673
if inputs.map_or(false, |inputs| inputs != i) {
677674
// Multiple different fn trait impls. Is this even allowed?
@@ -684,10 +681,7 @@ fn sig_for_projection<'tcx>(cx: &LateContext<'tcx>, ty: ProjectionTy<'tcx>) -> O
684681
// Multiple different fn trait impls. Is this even allowed?
685682
return None;
686683
}
687-
output = Some(
688-
pred.map_bound(|pred| pred.kind().rebind(p.term.ty().unwrap()))
689-
.subst(cx.tcx, ty.substs),
690-
);
684+
output = pred.kind().rebind(p.term.ty()).transpose();
691685
},
692686
_ => (),
693687
}

0 commit comments

Comments
 (0)