address review comments
This commit is contained in:
parent
b344c7171e
commit
b9a201c6df
@ -523,7 +523,7 @@ impl<T> SliceExt for [T] {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "slice indices are of type usize"]
|
||||
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
|
||||
impl<T> ops::Index<usize> for [T] {
|
||||
type Output = T;
|
||||
|
||||
@ -534,7 +534,7 @@ impl<T> ops::Index<usize> for [T] {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "slice indices are of type usize"]
|
||||
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
|
||||
impl<T> ops::IndexMut<usize> for [T] {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, index: usize) -> &mut T {
|
||||
@ -568,7 +568,7 @@ fn slice_index_order_fail(index: usize, end: usize) -> ! {
|
||||
/// Requires that `begin <= end` and `end <= self.len()`,
|
||||
/// otherwise slicing will panic.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "slice indices are of type usize"]
|
||||
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
|
||||
impl<T> ops::Index<ops::Range<usize>> for [T] {
|
||||
type Output = [T];
|
||||
|
||||
@ -595,7 +595,7 @@ impl<T> ops::Index<ops::Range<usize>> for [T] {
|
||||
///
|
||||
/// Equivalent to `&self[0 .. end]`
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "slice indices are of type usize"]
|
||||
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
|
||||
impl<T> ops::Index<ops::RangeTo<usize>> for [T] {
|
||||
type Output = [T];
|
||||
|
||||
@ -611,7 +611,7 @@ impl<T> ops::Index<ops::RangeTo<usize>> for [T] {
|
||||
///
|
||||
/// Equivalent to `&self[begin .. self.len()]`
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "slice indices are of type usize"]
|
||||
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
|
||||
impl<T> ops::Index<ops::RangeFrom<usize>> for [T] {
|
||||
type Output = [T];
|
||||
|
||||
@ -637,7 +637,7 @@ impl<T> ops::Index<RangeFull> for [T] {
|
||||
}
|
||||
|
||||
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
|
||||
#[rustc_on_unimplemented = "slice indices are of type usize"]
|
||||
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
|
||||
impl<T> ops::Index<ops::RangeInclusive<usize>> for [T] {
|
||||
type Output = [T];
|
||||
|
||||
@ -653,7 +653,7 @@ impl<T> ops::Index<ops::RangeInclusive<usize>> for [T] {
|
||||
}
|
||||
}
|
||||
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
|
||||
#[rustc_on_unimplemented = "slice indices are of type usize"]
|
||||
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
|
||||
impl<T> ops::Index<ops::RangeToInclusive<usize>> for [T] {
|
||||
type Output = [T];
|
||||
|
||||
@ -674,7 +674,7 @@ impl<T> ops::Index<ops::RangeToInclusive<usize>> for [T] {
|
||||
/// Requires that `begin <= end` and `end <= self.len()`,
|
||||
/// otherwise slicing will panic.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "slice indices are of type usize"]
|
||||
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
|
||||
impl<T> ops::IndexMut<ops::Range<usize>> for [T] {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, index: ops::Range<usize>) -> &mut [T] {
|
||||
@ -699,7 +699,7 @@ impl<T> ops::IndexMut<ops::Range<usize>> for [T] {
|
||||
///
|
||||
/// Equivalent to `&mut self[0 .. end]`
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "slice indices are of type usize"]
|
||||
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
|
||||
impl<T> ops::IndexMut<ops::RangeTo<usize>> for [T] {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut [T] {
|
||||
@ -713,7 +713,7 @@ impl<T> ops::IndexMut<ops::RangeTo<usize>> for [T] {
|
||||
///
|
||||
/// Equivalent to `&mut self[begin .. self.len()]`
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "slice indices are of type usize"]
|
||||
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
|
||||
impl<T> ops::IndexMut<ops::RangeFrom<usize>> for [T] {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut [T] {
|
||||
@ -736,7 +736,7 @@ impl<T> ops::IndexMut<RangeFull> for [T] {
|
||||
}
|
||||
|
||||
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
|
||||
#[rustc_on_unimplemented = "slice indices are of type usize"]
|
||||
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
|
||||
impl<T> ops::IndexMut<ops::RangeInclusive<usize>> for [T] {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, index: ops::RangeInclusive<usize>) -> &mut [T] {
|
||||
@ -750,7 +750,7 @@ impl<T> ops::IndexMut<ops::RangeInclusive<usize>> for [T] {
|
||||
}
|
||||
}
|
||||
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
|
||||
#[rustc_on_unimplemented = "slice indices are of type usize"]
|
||||
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
|
||||
impl<T> ops::IndexMut<ops::RangeToInclusive<usize>> for [T] {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, index: ops::RangeToInclusive<usize>) -> &mut [T] {
|
||||
|
@ -18,7 +18,7 @@ use std::ops::Index;
|
||||
fn main() {
|
||||
let x = &[1, 2, 3] as &[i32];
|
||||
x[1i32]; //~ ERROR E0277
|
||||
//~| NOTE slice indices are of type usize
|
||||
//~| NOTE slice indices are of type `usize`
|
||||
x[..1i32]; //~ ERROR E0277
|
||||
//~| NOTE slice indices are of type usize
|
||||
//~| NOTE slice indices are of type `usize`
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user