1 // Test if the on_unimplemented message override works
3 #![feature(rustc_attrs)]
9 #[rustc_on_unimplemented = "trait message"]
10 trait Index<Idx: ?Sized> {
12 fn index(&self, index: Idx) -> &Self::Output;
15 #[rustc_on_unimplemented = "on impl for Foo"]
16 impl Index<Foo<usize>> for [i32] {
18 fn index(&self, _index: Foo<usize>) -> &i32 {
23 #[rustc_on_unimplemented = "on impl for Bar"]
24 impl Index<Bar<usize>> for [i32] {
26 fn index(&self, _index: Bar<usize>) -> &i32 {
33 Index::index(&[] as &[i32], 2u32);
36 Index::index(&[] as &[i32], Foo(2u32));
39 Index::index(&[] as &[i32], Bar(2u32));