From 1fe705ca709cd81d3ce8735e992cd4333c1404fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Tue, 13 Jan 2026 16:59:03 +0000 Subject: [PATCH] Mention the type in the label, to avoid confusion at the cost of redundancy --- library/core/src/iter/range.rs | 2 +- .../run-make/missing-unstable-trait-bound/missing-bound.stderr | 2 +- tests/ui/range/range-1.stderr | 2 +- tests/ui/trait-bounds/unstable-trait-suggestion.stderr | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/core/src/iter/range.rs b/library/core/src/iter/range.rs index 7880e18d7d31..a6ab2e4d8b7d 100644 --- a/library/core/src/iter/range.rs +++ b/library/core/src/iter/range.rs @@ -23,7 +23,7 @@ unsafe_impl_trusted_step![AsciiChar char i8 i16 i32 i64 i128 isize u8 u16 u32 u6 #[rustc_diagnostic_item = "range_step"] #[rustc_on_unimplemented( message = "`std::ops::Range<{Self}>` is not an iterator", - label = "not an iterator", + label = "`Range<{Self}>` is not an iterator", note = "`Range` only implements `Iterator` for select types in the standard library, \ particularly integers; to see the full list of types, see the documentation for the \ unstable `Step` trait" diff --git a/tests/run-make/missing-unstable-trait-bound/missing-bound.stderr b/tests/run-make/missing-unstable-trait-bound/missing-bound.stderr index d503751a2e93..d680ae1aca1d 100644 --- a/tests/run-make/missing-unstable-trait-bound/missing-bound.stderr +++ b/tests/run-make/missing-unstable-trait-bound/missing-bound.stderr @@ -2,7 +2,7 @@ error[E0277]: `std::ops::Range` is not an iterator --> missing-bound.rs:2:14 | 2 | for _ in t {} - | ^ not an iterator + | ^ `Range` is not an iterator | = note: `Range` only implements `Iterator` for select types in the standard library, particularly integers; to see the full list of types, see the documentation for the unstable `Step` trait = note: required for `std::ops::Range` to implement `Iterator` diff --git a/tests/ui/range/range-1.stderr b/tests/ui/range/range-1.stderr index 9682122539c5..d7d0f87ac991 100644 --- a/tests/ui/range/range-1.stderr +++ b/tests/ui/range/range-1.stderr @@ -8,7 +8,7 @@ error[E0277]: `std::ops::Range` is not an iterator --> $DIR/range-1.rs:9:14 | LL | for i in false..true {} - | ^^^^^^^^^^^ not an iterator + | ^^^^^^^^^^^ `Range` is not an iterator | = help: the nightly-only, unstable trait `Step` is not implemented for `bool` = note: `Range` only implements `Iterator` for select types in the standard library, particularly integers; to see the full list of types, see the documentation for the unstable `Step` trait diff --git a/tests/ui/trait-bounds/unstable-trait-suggestion.stderr b/tests/ui/trait-bounds/unstable-trait-suggestion.stderr index 5edaed0f4dfe..9ae209d5aa96 100644 --- a/tests/ui/trait-bounds/unstable-trait-suggestion.stderr +++ b/tests/ui/trait-bounds/unstable-trait-suggestion.stderr @@ -20,7 +20,7 @@ error[E0277]: `std::ops::Range` is not an iterator --> $DIR/unstable-trait-suggestion.rs:17:14 | LL | for _ in t {} - | ^ not an iterator + | ^ `Range` is not an iterator | = note: `Range` only implements `Iterator` for select types in the standard library, particularly integers; to see the full list of types, see the documentation for the unstable `Step` trait = note: required for `std::ops::Range` to implement `Iterator`