Skip to content

Commit 0b96697

Browse files
committed
Regression test for incremental treatment of rustc_on_unimplemented.
1 parent ff33b27 commit 0b96697

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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: rpass1 rpass2
6+
// compile-pass
7+
8+
#![feature(on_unimplemented)]
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+
}

0 commit comments

Comments
 (0)