Skip to content

Commit b9a201c

Browse files
committed
address review comments
1 parent b344c71 commit b9a201c

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/libcore/slice.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ impl<T> SliceExt for [T] {
523523
}
524524

525525
#[stable(feature = "rust1", since = "1.0.0")]
526-
#[rustc_on_unimplemented = "slice indices are of type usize"]
526+
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
527527
impl<T> ops::Index<usize> for [T] {
528528
type Output = T;
529529

@@ -534,7 +534,7 @@ impl<T> ops::Index<usize> for [T] {
534534
}
535535

536536
#[stable(feature = "rust1", since = "1.0.0")]
537-
#[rustc_on_unimplemented = "slice indices are of type usize"]
537+
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
538538
impl<T> ops::IndexMut<usize> for [T] {
539539
#[inline]
540540
fn index_mut(&mut self, index: usize) -> &mut T {
@@ -568,7 +568,7 @@ fn slice_index_order_fail(index: usize, end: usize) -> ! {
568568
/// Requires that `begin <= end` and `end <= self.len()`,
569569
/// otherwise slicing will panic.
570570
#[stable(feature = "rust1", since = "1.0.0")]
571-
#[rustc_on_unimplemented = "slice indices are of type usize"]
571+
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
572572
impl<T> ops::Index<ops::Range<usize>> for [T] {
573573
type Output = [T];
574574

@@ -595,7 +595,7 @@ impl<T> ops::Index<ops::Range<usize>> for [T] {
595595
///
596596
/// Equivalent to `&self[0 .. end]`
597597
#[stable(feature = "rust1", since = "1.0.0")]
598-
#[rustc_on_unimplemented = "slice indices are of type usize"]
598+
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
599599
impl<T> ops::Index<ops::RangeTo<usize>> for [T] {
600600
type Output = [T];
601601

@@ -611,7 +611,7 @@ impl<T> ops::Index<ops::RangeTo<usize>> for [T] {
611611
///
612612
/// Equivalent to `&self[begin .. self.len()]`
613613
#[stable(feature = "rust1", since = "1.0.0")]
614-
#[rustc_on_unimplemented = "slice indices are of type usize"]
614+
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
615615
impl<T> ops::Index<ops::RangeFrom<usize>> for [T] {
616616
type Output = [T];
617617

@@ -637,7 +637,7 @@ impl<T> ops::Index<RangeFull> for [T] {
637637
}
638638

639639
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
640-
#[rustc_on_unimplemented = "slice indices are of type usize"]
640+
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
641641
impl<T> ops::Index<ops::RangeInclusive<usize>> for [T] {
642642
type Output = [T];
643643

@@ -653,7 +653,7 @@ impl<T> ops::Index<ops::RangeInclusive<usize>> for [T] {
653653
}
654654
}
655655
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
656-
#[rustc_on_unimplemented = "slice indices are of type usize"]
656+
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
657657
impl<T> ops::Index<ops::RangeToInclusive<usize>> for [T] {
658658
type Output = [T];
659659

@@ -674,7 +674,7 @@ impl<T> ops::Index<ops::RangeToInclusive<usize>> for [T] {
674674
/// Requires that `begin <= end` and `end <= self.len()`,
675675
/// otherwise slicing will panic.
676676
#[stable(feature = "rust1", since = "1.0.0")]
677-
#[rustc_on_unimplemented = "slice indices are of type usize"]
677+
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
678678
impl<T> ops::IndexMut<ops::Range<usize>> for [T] {
679679
#[inline]
680680
fn index_mut(&mut self, index: ops::Range<usize>) -> &mut [T] {
@@ -699,7 +699,7 @@ impl<T> ops::IndexMut<ops::Range<usize>> for [T] {
699699
///
700700
/// Equivalent to `&mut self[0 .. end]`
701701
#[stable(feature = "rust1", since = "1.0.0")]
702-
#[rustc_on_unimplemented = "slice indices are of type usize"]
702+
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
703703
impl<T> ops::IndexMut<ops::RangeTo<usize>> for [T] {
704704
#[inline]
705705
fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut [T] {
@@ -713,7 +713,7 @@ impl<T> ops::IndexMut<ops::RangeTo<usize>> for [T] {
713713
///
714714
/// Equivalent to `&mut self[begin .. self.len()]`
715715
#[stable(feature = "rust1", since = "1.0.0")]
716-
#[rustc_on_unimplemented = "slice indices are of type usize"]
716+
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
717717
impl<T> ops::IndexMut<ops::RangeFrom<usize>> for [T] {
718718
#[inline]
719719
fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut [T] {
@@ -736,7 +736,7 @@ impl<T> ops::IndexMut<RangeFull> for [T] {
736736
}
737737

738738
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
739-
#[rustc_on_unimplemented = "slice indices are of type usize"]
739+
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
740740
impl<T> ops::IndexMut<ops::RangeInclusive<usize>> for [T] {
741741
#[inline]
742742
fn index_mut(&mut self, index: ops::RangeInclusive<usize>) -> &mut [T] {
@@ -750,7 +750,7 @@ impl<T> ops::IndexMut<ops::RangeInclusive<usize>> for [T] {
750750
}
751751
}
752752
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
753-
#[rustc_on_unimplemented = "slice indices are of type usize"]
753+
#[rustc_on_unimplemented = "slice indices are of type `usize`"]
754754
impl<T> ops::IndexMut<ops::RangeToInclusive<usize>> for [T] {
755755
#[inline]
756756
fn index_mut(&mut self, index: ops::RangeToInclusive<usize>) -> &mut [T] {

src/test/compile-fail/on-unimplemented/libcore-index.rs renamed to src/test/compile-fail/on-unimplemented/slice-index.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use std::ops::Index;
1818
fn main() {
1919
let x = &[1, 2, 3] as &[i32];
2020
x[1i32]; //~ ERROR E0277
21-
//~| NOTE slice indices are of type usize
21+
//~| NOTE slice indices are of type `usize`
2222
x[..1i32]; //~ ERROR E0277
23-
//~| NOTE slice indices are of type usize
23+
//~| NOTE slice indices are of type `usize`
2424
}

0 commit comments

Comments
 (0)