Change:
<!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
Minimized via  and some manual item deletion: I can take a quick look into this one I guess. claim

Discussion:
// Convert the bounds into obligations. let impl_obligations = traits::predicates_for_generics( <del> |_idx, span| { let misc = traits::ObligationCause::misc(span, self.body_id); let parent_trait_pred = ty::Binder::dummy(ty::TraitPredicate { trait_ref: ty::TraitRef::from_method(self.tcx, impl_def_id, substs), constness: ty::BoundConstness::NotConst, polarity: ty::ImplPolarity::Positive, }); misc.derived_cause(parent_trait_pred, |derived| { traits::ImplDerivedObligation(Box::new( traits::ImplDerivedObligationCause { derived, impl_or_alias_def_id: impl_def_id, impl_def_predicate_index: None, span, }, )) }) </del> <ins> |idx, span| { let code = if span.is_dummy() { traits::ExprItemObligation(impl_def_id, self.scope_expr_id, idx) } else { traits::ExprBindingObligation( impl_def_id, span, self.scope_expr_id, idx, ) }; ObligationCause::new(self.span, self.body_id, code) </ins> }, self.param_env, impl_bounds,

// Find all the requirements that come from a local `impl` block. let mut skip_list: FxHashSet<_> = Default::default(); let mut spanned_predicates = FxHashMap::default(); <del> for (p, parent_p, impl_def_id, cause) in unsatisfied_predicates .iter() .filter_map(|(p, parent, c)| c.as_ref().map(|c| (p, parent, c))) .filter_map(|(p, parent, c)| match c.code() { ObligationCauseCode::ImplDerivedObligation(data) if matches!(p.kind().skip_binder(), ty::PredicateKind::Clause(_)) => { Some((p, parent, data.impl_or_alias_def_id, data)) </del> <ins> for (p, parent_p, cause) in unsatisfied_predicates { // Extract the predicate span and parent def id of the cause, // if we have one. let (item_def_id, cause_span) = match cause.as_ref().map(|cause| cause.code()) { Some(ObligationCauseCode::ImplDerivedObligation(data)) => { (data.impl_or_alias_def_id, data.span) </ins> } <del> _ => None, }) { match self.tcx.hir().get_if_local(impl_def_id) { </del> <ins> Some( ObligationCauseCode::ExprBindingObligation(def_id, span, _, _) | ObligationCauseCode::BindingObligation(def_id, span), ) => (*def_id, *span), _ => continue, }; // Don't point out the span of `WellFormed` predicates. if !matches!(p.kind().skip_binder(), ty::PredicateKind::Clause(_)) { continue; }; match self.tcx.hir().get_if_local(item_def_id) { </ins> // Unmet obligation comes from a `derive` macro, point at it once to // avoid multiple span labels pointing at the same place. Some(Node::Item(hir::Item {

} }); for param in generics.params { <del> if param.span == cause.span && sized_pred { </del> <ins> if param.span == cause_span && sized_pred { </ins> let (sp, sugg) = match param.colon_span { Some(sp) => (sp.shrink_to_hi(), " ?Sized +"), None => (param.span.shrink_to_hi(), ": ?Sized"),

(FxHashSet::default(), FxHashSet::default(), Vec::new()) }); entry.2.push(p); <del> if cause.span != *item_span { entry.0.insert(cause.span); entry.1.insert((cause.span, "unsatisfied trait bound introduced here")); </del> <ins> if cause_span != *item_span { entry.0.insert(cause_span); entry.1.insert((cause_span, "unsatisfied trait bound introduced here")); </ins> } else { if let Some(trait_ref) = of_trait { entry.0.insert(trait_ref.path.span);

let entry = entry.or_insert_with(|| { (FxHashSet::default(), FxHashSet::default(), Vec::new()) }); <del> entry.0.insert(cause.span); </del> <ins> entry.0.insert(cause_span); </ins> entry.1.insert((ident.span, "")); <del> entry.1.insert((cause.span, "unsatisfied trait bound introduced here")); </del> <ins> entry.1.insert((cause_span, "unsatisfied trait bound introduced here")); </ins> entry.2.push(p); } Some(node) => unreachable!("encountered `{node:?}`"),

<ins> // normalize-stderr-test: "long-type-d+" -> "long-type-hash" // Fixes #110131 // // The issue is that we were constructing an `ImplDerived` cause code for the // `&'a T: IntoIterator<Item = &'a u8>` obligation for `Helper::new`, which is // incorrect because derived obligations are only expected to come from *traits*. struct SeqBuffer<'a, T> where &'a T: IntoIterator<Item = &'a u8>, { iter: <&'a T as IntoIterator>::IntoIter, } struct Helper<'a, T> where &'a T: IntoIterator<Item = &'a u8>, { buf: SeqBuffer<'a, T>, } impl<'a, T> Helper<'a, T> where &'a T: IntoIterator<Item = &'a u8>, { fn new(sq: &'a T) -> Self { loop {} } } struct BitReaderWrapper<T>(T); impl<'a, T> IntoIterator for &'a BitReaderWrapper<T> where &'a T: IntoIterator<Item = &'a u8>, { type Item = u32; type IntoIter = Helper<'a, T>; //~^ ERROR `Helper<'a, T>` is not an iterator fn into_iter(self) -> Self::IntoIter { Helper::new(&self.0) //~^ ERROR overflow evaluating the requirement `&_: IntoIterator` } } fn main() {} </ins>

<ins> error[E0277]: `Helper<'a, T>` is not an iterator --> $DIR/inherent-bound-in-probe.rs:40:21 | LL |     type IntoIter = Helper<'a, T>; |                     ^^^^^^^^^^^^^ `Helper<'a, T>` is not an iterator | = help: the trait `Iterator` is not implemented for `Helper<'a, T>` note: required by a bound in `std::iter::IntoIterator::IntoIter` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL error[E0275]: overflow evaluating the requirement `&_: IntoIterator` --> $DIR/inherent-bound-in-probe.rs:44:17 | LL |         Helper::new(&self.0) |                 ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_bound_in_probe`) note: required for `&BitReaderWrapper<_>` to implement `IntoIterator` --> $DIR/inherent-bound-in-probe.rs:34:13 | LL | impl<'a, T> IntoIterator for &'a BitReaderWrapper<T> |             ^^^^^^^^^^^^     ^^^^^^^^^^^^^^^^^^^^^^^ LL | where LL |     &'a T: IntoIterator<Item = &'a u8>, |                         ------------- unsatisfied trait bound introduced here = note: 126 redundant requirements hidden = note: required for `&BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<...>>>>>` to implement `IntoIterator` = note: the full type name has been written to '$TEST_BUILD_DIR/methods/inherent-bound-in-probe/inherent-bound-in-probe.long-type-hash.txt' note: required by a bound in `Helper<'a, T>` --> $DIR/inherent-bound-in-probe.rs:25:25 | LL |     &'a T: IntoIterator<Item = &'a u8>, |                         ^^^^^^^^^^^^^ required by this bound in `Helper<'a, T>` error: aborting due to 2 previous errors Some errors have detailed explanations: E0275, E0277. For more information about an error, try `rustc --explain E0275`. </ins>