]> git.lizzy.rs Git - rust.git/blob - tests/incremental/issue-59523-on-implemented-is-not-unused.rs
Auto merge of #106180 - RalfJung:dereferenceable-generators, r=nbdd0121
[rust.git] / tests / incremental / issue-59523-on-implemented-is-not-unused.rs
1 // We should not see the unused_attributes lint fire for
2 // rustc_on_unimplemented, but with this bug we are seeing it fire (on
3 // subsequent runs) if incremental compilation is enabled.
4
5 // revisions: cfail1 cfail2
6 // build-pass (FIXME(62277): could be check-pass?)
7
8 #![feature(rustc_attrs)]
9 #![deny(unused_attributes)]
10
11 #[rustc_on_unimplemented = "invalid"]
12 trait Index<Idx: ?Sized> {
13     type Output: ?Sized;
14     fn index(&self, index: Idx) -> &Self::Output;
15 }
16
17 #[rustc_on_unimplemented = "a usize is required to index into a slice"]
18 impl Index<usize> for [i32] {
19     type Output = i32;
20     fn index(&self, index: usize) -> &i32 {
21         &self[index]
22     }
23 }
24
25 fn main() {
26     Index::<usize>::index(&[1, 2, 3] as &[i32], 2);
27 }