diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index bef2a067ae3..1d6e749b9e3 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -3027,6 +3027,11 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { span, format!("`{assoc}` changed to `{ty}` here"), )); + } else { + span_labels.push(( + span, + format!("`{assoc}` remains `{ty}` here"), + )); } } (Some((span, (assoc, ty))), None) => { diff --git a/src/test/ui/iterators/invalid-iterator-chain.stderr b/src/test/ui/iterators/invalid-iterator-chain.stderr index 0505dd86af3..14e430726f6 100644 --- a/src/test/ui/iterators/invalid-iterator-chain.stderr +++ b/src/test/ui/iterators/invalid-iterator-chain.stderr @@ -58,9 +58,9 @@ LL | .map(|x| x as f64) LL | .map(|x| x as i64) | ^^^^^^^^^^^^^^^^^ `std::iter::Iterator::Item` changed to `i64` here LL | .filter(|x| *x > 0) - | ------------------ + | ------------------ `std::iter::Iterator::Item` remains `i64` here LL | .map(|x| { x + 1 }) - | ------------------ + | ------------------ `std::iter::Iterator::Item` remains `i64` here LL | .map(|x| { x; }) | ^^^^^^^^^^^^^^^ `std::iter::Iterator::Item` changed to `()` here note: required by a bound in `std::iter::Iterator::sum` @@ -136,16 +136,16 @@ LL | let a = vec![0]; LL | let b = a.into_iter(); | ^^^^^^^^^^^ `std::iter::Iterator::Item` is `{integer}` here LL | let c = b.map(|x| x + 1); - | -------------- + | -------------- `std::iter::Iterator::Item` remains `{integer}` here LL | let d = c.filter(|x| *x > 10 ); - | -------------------- + | -------------------- `std::iter::Iterator::Item` remains `{integer}` here LL | let e = d.map(|x| { | _______________^ LL | | x + 1; LL | | }); | |______^ `std::iter::Iterator::Item` changed to `()` here LL | let f = e.filter(|_| false); - | ----------------- + | ----------------- `std::iter::Iterator::Item` remains `()` here note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL |