about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2016-01-23 06:44:38 +0100
committerggomez <guillaume1.gomez@gmail.com>2016-05-11 13:22:01 +0200
commitb8fad79a07ef287a80959ec8c4f82e7e6803b053 (patch)
treee774b9770c39f14f2d6e6fe6451f6f18e6c70d58 /src/libcore
parente9797d4be51e1118773877a078859f997c4191b2 (diff)
downloadrust-b8fad79a07ef287a80959ec8c4f82e7e6803b053.tar.gz
rust-b8fad79a07ef287a80959ec8c4f82e7e6803b053.zip
Improve error message for Index trait on slices
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/slice.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs
index 07f76aca14d..e4b98ed6445 100644
--- a/src/libcore/slice.rs
+++ b/src/libcore/slice.rs
@@ -523,6 +523,8 @@ impl<T> SliceExt for [T] {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
+#[allow(unused_attributes)]
+#[rustc_on_unimplemented = "a usize is required to index into a slice"]
 impl<T> ops::Index<usize> for [T] {
     type Output = T;
 
@@ -533,6 +535,8 @@ impl<T> ops::Index<usize> for [T] {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
+#[allow(unused_attributes)]
+#[rustc_on_unimplemented = "a usize is required to index into a slice"]
 impl<T> ops::IndexMut<usize> for [T] {
     #[inline]
     fn index_mut(&mut self, index: usize) -> &mut T {