Skip to content

Commit 45edce2

Browse files
committed
Update rustc_on_unimplemented message for Step
1 parent 89713fc commit 45edce2

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

library/core/src/iter/range.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ unsafe_impl_trusted_step![AsciiChar char i8 i16 i32 i64 i128 isize u8 u16 u32 u6
2222
/// The *predecessor* operation moves towards values that compare lesser.
2323
#[rustc_diagnostic_item = "range_step"]
2424
#[rustc_on_unimplemented(
25+
message = "`std::ops::Range<{Self}>` is not an iterator",
2526
note = "`Range` only implements `Iterator` for select types in the standard library, \
2627
particularly integers; to see the full list of types, see the documentation for the \
2728
unstable `Step` trait"

tests/ui/range/range-1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub fn main() {
77

88
// Bool => does not implement iterator.
99
for i in false..true {}
10-
//~^ ERROR `bool: Step` is not satisfied
10+
//~^ ERROR `std::ops::Range<bool>` is not an iterator
1111

1212
// Unsized type.
1313
let arr: &[_] = &[1, 2, 3];

tests/ui/range/range-1.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
44
LL | let _ = 0u32..10i32;
55
| ^^^^^ expected `u32`, found `i32`
66

7-
error[E0277]: the trait bound `bool: Step` is not satisfied
7+
error[E0277]: `std::ops::Range<bool>` is not an iterator
88
--> $DIR/range-1.rs:9:14
99
|
1010
LL | for i in false..true {}

tests/ui/trait-bounds/unstable-trait-suggestion.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ help: consider restricting type parameter `T` with unstable trait `Unstable`
1616
LL | pub fn bar<T: Unstable>(t: T) {
1717
| ++++++++++
1818

19-
error[E0277]: the trait bound `T: Step` is not satisfied
19+
error[E0277]: `std::ops::Range<T>` is not an iterator
2020
--> $DIR/unstable-trait-suggestion.rs:17:14
2121
|
2222
LL | for _ in t {}

0 commit comments

Comments
 (0)