review comments
- reword messages - apply custom comments to all types of ranges - fix indentation
This commit is contained in:
parent
a0fd68b088
commit
c71228e2f4
7 changed files with 46 additions and 22 deletions
|
@ -33,8 +33,32 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item=()>) {}
|
||||||
on(
|
on(
|
||||||
_Self="[std::ops::Range<Idx>; 1]",
|
_Self="[std::ops::Range<Idx>; 1]",
|
||||||
label="if you meant to iterate between two values, remove the square brackets",
|
label="if you meant to iterate between two values, remove the square brackets",
|
||||||
note="`[start..end]` is an array of one `Range`, you might have meant to have a `Range`: \
|
note="`[start..end]` is an array of one `Range`; you might have meant to have a `Range` \
|
||||||
`start..end`"
|
without the brackets: `start..end`"
|
||||||
|
),
|
||||||
|
on(
|
||||||
|
_Self="[std::ops::RangeFrom<Idx>; 1]",
|
||||||
|
label="if you meant to iterate from a value onwards, remove the square brackets",
|
||||||
|
note="`[start..]` is an array of one `RangeFrom`; you might have meant to have a \
|
||||||
|
`RangeFrom` without the brackets: `start..`"
|
||||||
|
),
|
||||||
|
on(
|
||||||
|
_Self="[std::ops::RangeTo<Idx>; 1]",
|
||||||
|
label="if you meant to iterate until a value, remove the square brackets",
|
||||||
|
note="`[..end]` is an array of one `RangeTo`; you might have meant to have a \
|
||||||
|
`RangeTo` without the brackets: `..end`"
|
||||||
|
),
|
||||||
|
on(
|
||||||
|
_Self="[std::ops::RangeInclusive<Idx>; 1]",
|
||||||
|
label="if you meant to iterate between two values, remove the square brackets",
|
||||||
|
note="`[start..=end]` is an array of one `RangeInclusive`; you might have meant to have a \
|
||||||
|
`RangeInclusive` without the brackets: `start..=end`"
|
||||||
|
),
|
||||||
|
on(
|
||||||
|
_Self="[std::ops::RangeToInclusive<Idx>; 1]",
|
||||||
|
label="if you meant to iterate until a value, remove the square brackets",
|
||||||
|
note="`[..=end]` is an array of one `RangeToInclusive`; you might have meant to have a \
|
||||||
|
`RangeToInclusive` without the brackets: `..=end`"
|
||||||
),
|
),
|
||||||
on(
|
on(
|
||||||
_Self="&str",
|
_Self="&str",
|
||||||
|
@ -51,8 +75,8 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item=()>) {}
|
||||||
),
|
),
|
||||||
on(
|
on(
|
||||||
_Self="{integral}",
|
_Self="{integral}",
|
||||||
note="if you want to iterate between `0` until a value `end`, use the range syntax: \
|
note="if you want to iterate between `start` until a value `end`, use the exclusive range \
|
||||||
`0..end`"
|
syntax `start..end` or the inclusive range syntax `start..=end`"
|
||||||
),
|
),
|
||||||
label="`{Self}` is not an iterator",
|
label="`{Self}` is not an iterator",
|
||||||
message="`{Self}` is not an iterator"
|
message="`{Self}` is not an iterator"
|
||||||
|
|
|
@ -351,7 +351,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
||||||
trait_ref: ty::PolyTraitRef<'tcx>,
|
trait_ref: ty::PolyTraitRef<'tcx>,
|
||||||
obligation: &PredicateObligation<'tcx>,
|
obligation: &PredicateObligation<'tcx>,
|
||||||
) -> OnUnimplementedNote {
|
) -> OnUnimplementedNote {
|
||||||
let def_id = self.impl_similar_to(trait_ref, obligation)
|
let def_id = self.impl_similar_to(trait_ref, obligation)
|
||||||
.unwrap_or(trait_ref.def_id());
|
.unwrap_or(trait_ref.def_id());
|
||||||
let trait_ref = *trait_ref.skip_binder();
|
let trait_ref = *trait_ref.skip_binder();
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ LL | | }
|
||||||
| |_^ `i32` is not an iterator
|
| |_^ `i32` is not an iterator
|
||||||
|
|
|
|
||||||
= help: the trait `std::iter::Iterator` is not implemented for `i32`
|
= help: the trait `std::iter::Iterator` is not implemented for `i32`
|
||||||
= note: if you want to iterate between `0` until a value `end`, use the range syntax: `0..end`
|
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||||
= help: see issue #48214
|
= help: see issue #48214
|
||||||
= help: add #![feature(trivial_bounds)] to the crate attributes to enable
|
= help: add #![feature(trivial_bounds)] to the crate attributes to enable
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ LL | struct Foo(NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^ `i32` is not an iterator
|
| ^^^^^^^^^^^^^^^^^^^^^^^ `i32` is not an iterator
|
||||||
|
|
|
|
||||||
= help: the trait `std::iter::Iterator` is not implemented for `i32`
|
= help: the trait `std::iter::Iterator` is not implemented for `i32`
|
||||||
= note: if you want to iterate between `0` until a value `end`, use the range syntax: `0..end`
|
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||||
|
|
||||||
error[E0204]: the trait `Copy` may not be implemented for this type
|
error[E0204]: the trait `Copy` may not be implemented for this type
|
||||||
--> $DIR/issue-50480.rs:11:17
|
--> $DIR/issue-50480.rs:11:17
|
||||||
|
|
|
@ -5,7 +5,7 @@ LL | for _ in [0..1] {}
|
||||||
| ^^^^^^ if you meant to iterate between two values, remove the square brackets
|
| ^^^^^^ if you meant to iterate between two values, remove the square brackets
|
||||||
|
|
|
|
||||||
= help: the trait `std::iter::Iterator` is not implemented for `[std::ops::Range<{integer}>; 1]`
|
= help: the trait `std::iter::Iterator` is not implemented for `[std::ops::Range<{integer}>; 1]`
|
||||||
= note: `[start..end]` is an array of one `Range`, you might have meant to have a `Range`: `start..end`
|
= note: `[start..end]` is an array of one `Range`; you might have meant to have a `Range` without the brackets: `start..end`
|
||||||
= note: required by `std::iter::IntoIterator::into_iter`
|
= note: required by `std::iter::IntoIterator::into_iter`
|
||||||
|
|
||||||
error[E0277]: `[std::ops::Range<{integer}>; 1]` is not an iterator
|
error[E0277]: `[std::ops::Range<{integer}>; 1]` is not an iterator
|
||||||
|
@ -15,7 +15,7 @@ LL | for _ in [start..end] {}
|
||||||
| ^^^^^^^^^^^^ if you meant to iterate between two values, remove the square brackets
|
| ^^^^^^^^^^^^ if you meant to iterate between two values, remove the square brackets
|
||||||
|
|
|
|
||||||
= help: the trait `std::iter::Iterator` is not implemented for `[std::ops::Range<{integer}>; 1]`
|
= help: the trait `std::iter::Iterator` is not implemented for `[std::ops::Range<{integer}>; 1]`
|
||||||
= note: `[start..end]` is an array of one `Range`, you might have meant to have a `Range`: `start..end`
|
= note: `[start..end]` is an array of one `Range`; you might have meant to have a `Range` without the brackets: `start..end`
|
||||||
= note: required by `std::iter::IntoIterator::into_iter`
|
= note: required by `std::iter::IntoIterator::into_iter`
|
||||||
|
|
||||||
error[E0277]: `[std::ops::Range<{integer}>; 1]` is not an iterator
|
error[E0277]: `[std::ops::Range<{integer}>; 1]` is not an iterator
|
||||||
|
@ -25,7 +25,7 @@ LL | for _ in array_of_range {}
|
||||||
| ^^^^^^^^^^^^^^ if you meant to iterate between two values, remove the square brackets
|
| ^^^^^^^^^^^^^^ if you meant to iterate between two values, remove the square brackets
|
||||||
|
|
|
|
||||||
= help: the trait `std::iter::Iterator` is not implemented for `[std::ops::Range<{integer}>; 1]`
|
= help: the trait `std::iter::Iterator` is not implemented for `[std::ops::Range<{integer}>; 1]`
|
||||||
= note: `[start..end]` is an array of one `Range`, you might have meant to have a `Range`: `start..end`
|
= note: `[start..end]` is an array of one `Range`; you might have meant to have a `Range` without the brackets: `start..end`
|
||||||
= note: required by `std::iter::IntoIterator::into_iter`
|
= note: required by `std::iter::IntoIterator::into_iter`
|
||||||
|
|
||||||
error[E0277]: `[std::ops::Range<{integer}>; 2]` is not an iterator
|
error[E0277]: `[std::ops::Range<{integer}>; 2]` is not an iterator
|
||||||
|
|
|
@ -5,7 +5,7 @@ LL | struct T(S<u8>);
|
||||||
| ^^^^^ `u8` is not an iterator
|
| ^^^^^ `u8` is not an iterator
|
||||||
|
|
|
|
||||||
= help: the trait `std::iter::Iterator` is not implemented for `u8`
|
= help: the trait `std::iter::Iterator` is not implemented for `u8`
|
||||||
= note: if you want to iterate between `0` until a value `end`, use the range syntax: `0..end`
|
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||||
note: required by `S`
|
note: required by `S`
|
||||||
--> $DIR/bound.rs:1:1
|
--> $DIR/bound.rs:1:1
|
||||||
|
|
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ LL | for _ in 42 {}
|
||||||
| ^^ `{integer}` is not an iterator
|
| ^^ `{integer}` is not an iterator
|
||||||
|
|
|
|
||||||
= help: the trait `std::iter::Iterator` is not implemented for `{integer}`
|
= help: the trait `std::iter::Iterator` is not implemented for `{integer}`
|
||||||
= note: if you want to iterate between `0` until a value `end`, use the range syntax: `0..end`
|
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||||
= note: required by `std::iter::IntoIterator::into_iter`
|
= note: required by `std::iter::IntoIterator::into_iter`
|
||||||
|
|
||||||
error[E0277]: `u8` is not an iterator
|
error[E0277]: `u8` is not an iterator
|
||||||
|
@ -15,7 +15,7 @@ LL | for _ in 42 as u8 {}
|
||||||
| ^^^^^^^^ `u8` is not an iterator
|
| ^^^^^^^^ `u8` is not an iterator
|
||||||
|
|
|
|
||||||
= help: the trait `std::iter::Iterator` is not implemented for `u8`
|
= help: the trait `std::iter::Iterator` is not implemented for `u8`
|
||||||
= note: if you want to iterate between `0` until a value `end`, use the range syntax: `0..end`
|
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||||
= note: required by `std::iter::IntoIterator::into_iter`
|
= note: required by `std::iter::IntoIterator::into_iter`
|
||||||
|
|
||||||
error[E0277]: `i8` is not an iterator
|
error[E0277]: `i8` is not an iterator
|
||||||
|
@ -25,7 +25,7 @@ LL | for _ in 42 as i8 {}
|
||||||
| ^^^^^^^^ `i8` is not an iterator
|
| ^^^^^^^^ `i8` is not an iterator
|
||||||
|
|
|
|
||||||
= help: the trait `std::iter::Iterator` is not implemented for `i8`
|
= help: the trait `std::iter::Iterator` is not implemented for `i8`
|
||||||
= note: if you want to iterate between `0` until a value `end`, use the range syntax: `0..end`
|
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||||
= note: required by `std::iter::IntoIterator::into_iter`
|
= note: required by `std::iter::IntoIterator::into_iter`
|
||||||
|
|
||||||
error[E0277]: `u16` is not an iterator
|
error[E0277]: `u16` is not an iterator
|
||||||
|
@ -35,7 +35,7 @@ LL | for _ in 42 as u16 {}
|
||||||
| ^^^^^^^^^ `u16` is not an iterator
|
| ^^^^^^^^^ `u16` is not an iterator
|
||||||
|
|
|
|
||||||
= help: the trait `std::iter::Iterator` is not implemented for `u16`
|
= help: the trait `std::iter::Iterator` is not implemented for `u16`
|
||||||
= note: if you want to iterate between `0` until a value `end`, use the range syntax: `0..end`
|
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||||
= note: required by `std::iter::IntoIterator::into_iter`
|
= note: required by `std::iter::IntoIterator::into_iter`
|
||||||
|
|
||||||
error[E0277]: `i16` is not an iterator
|
error[E0277]: `i16` is not an iterator
|
||||||
|
@ -45,7 +45,7 @@ LL | for _ in 42 as i16 {}
|
||||||
| ^^^^^^^^^ `i16` is not an iterator
|
| ^^^^^^^^^ `i16` is not an iterator
|
||||||
|
|
|
|
||||||
= help: the trait `std::iter::Iterator` is not implemented for `i16`
|
= help: the trait `std::iter::Iterator` is not implemented for `i16`
|
||||||
= note: if you want to iterate between `0` until a value `end`, use the range syntax: `0..end`
|
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||||
= note: required by `std::iter::IntoIterator::into_iter`
|
= note: required by `std::iter::IntoIterator::into_iter`
|
||||||
|
|
||||||
error[E0277]: `u32` is not an iterator
|
error[E0277]: `u32` is not an iterator
|
||||||
|
@ -55,7 +55,7 @@ LL | for _ in 42 as u32 {}
|
||||||
| ^^^^^^^^^ `u32` is not an iterator
|
| ^^^^^^^^^ `u32` is not an iterator
|
||||||
|
|
|
|
||||||
= help: the trait `std::iter::Iterator` is not implemented for `u32`
|
= help: the trait `std::iter::Iterator` is not implemented for `u32`
|
||||||
= note: if you want to iterate between `0` until a value `end`, use the range syntax: `0..end`
|
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||||
= note: required by `std::iter::IntoIterator::into_iter`
|
= note: required by `std::iter::IntoIterator::into_iter`
|
||||||
|
|
||||||
error[E0277]: `i32` is not an iterator
|
error[E0277]: `i32` is not an iterator
|
||||||
|
@ -65,7 +65,7 @@ LL | for _ in 42 as i32 {}
|
||||||
| ^^^^^^^^^ `i32` is not an iterator
|
| ^^^^^^^^^ `i32` is not an iterator
|
||||||
|
|
|
|
||||||
= help: the trait `std::iter::Iterator` is not implemented for `i32`
|
= help: the trait `std::iter::Iterator` is not implemented for `i32`
|
||||||
= note: if you want to iterate between `0` until a value `end`, use the range syntax: `0..end`
|
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||||
= note: required by `std::iter::IntoIterator::into_iter`
|
= note: required by `std::iter::IntoIterator::into_iter`
|
||||||
|
|
||||||
error[E0277]: `u64` is not an iterator
|
error[E0277]: `u64` is not an iterator
|
||||||
|
@ -75,7 +75,7 @@ LL | for _ in 42 as u64 {}
|
||||||
| ^^^^^^^^^ `u64` is not an iterator
|
| ^^^^^^^^^ `u64` is not an iterator
|
||||||
|
|
|
|
||||||
= help: the trait `std::iter::Iterator` is not implemented for `u64`
|
= help: the trait `std::iter::Iterator` is not implemented for `u64`
|
||||||
= note: if you want to iterate between `0` until a value `end`, use the range syntax: `0..end`
|
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||||
= note: required by `std::iter::IntoIterator::into_iter`
|
= note: required by `std::iter::IntoIterator::into_iter`
|
||||||
|
|
||||||
error[E0277]: `i64` is not an iterator
|
error[E0277]: `i64` is not an iterator
|
||||||
|
@ -85,7 +85,7 @@ LL | for _ in 42 as i64 {}
|
||||||
| ^^^^^^^^^ `i64` is not an iterator
|
| ^^^^^^^^^ `i64` is not an iterator
|
||||||
|
|
|
|
||||||
= help: the trait `std::iter::Iterator` is not implemented for `i64`
|
= help: the trait `std::iter::Iterator` is not implemented for `i64`
|
||||||
= note: if you want to iterate between `0` until a value `end`, use the range syntax: `0..end`
|
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||||
= note: required by `std::iter::IntoIterator::into_iter`
|
= note: required by `std::iter::IntoIterator::into_iter`
|
||||||
|
|
||||||
error[E0277]: `usize` is not an iterator
|
error[E0277]: `usize` is not an iterator
|
||||||
|
@ -95,7 +95,7 @@ LL | for _ in 42 as usize {}
|
||||||
| ^^^^^^^^^^^ `usize` is not an iterator
|
| ^^^^^^^^^^^ `usize` is not an iterator
|
||||||
|
|
|
|
||||||
= help: the trait `std::iter::Iterator` is not implemented for `usize`
|
= help: the trait `std::iter::Iterator` is not implemented for `usize`
|
||||||
= note: if you want to iterate between `0` until a value `end`, use the range syntax: `0..end`
|
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||||
= note: required by `std::iter::IntoIterator::into_iter`
|
= note: required by `std::iter::IntoIterator::into_iter`
|
||||||
|
|
||||||
error[E0277]: `isize` is not an iterator
|
error[E0277]: `isize` is not an iterator
|
||||||
|
@ -105,7 +105,7 @@ LL | for _ in 42 as isize {}
|
||||||
| ^^^^^^^^^^^ `isize` is not an iterator
|
| ^^^^^^^^^^^ `isize` is not an iterator
|
||||||
|
|
|
|
||||||
= help: the trait `std::iter::Iterator` is not implemented for `isize`
|
= help: the trait `std::iter::Iterator` is not implemented for `isize`
|
||||||
= note: if you want to iterate between `0` until a value `end`, use the range syntax: `0..end`
|
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||||
= note: required by `std::iter::IntoIterator::into_iter`
|
= note: required by `std::iter::IntoIterator::into_iter`
|
||||||
|
|
||||||
error[E0277]: `{float}` is not an iterator
|
error[E0277]: `{float}` is not an iterator
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue