Skip to content

Commit 67a07e0

Browse files
committed
add test for issue 135514
1 parent 93ba568 commit 67a07e0

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Regression test for #135514 where the new solver didn't properly record deps for incremental
2+
// compilation, similarly to `track-deps-in-new-solver.rs`.
3+
//
4+
// In this specially crafted example, @steffahn was able to trigger unsoundness with an overlapping
5+
// impl that was accepted during the incremental rebuild.
6+
7+
//@ revisions: cpass1 cfail2
8+
//@ compile-flags: -Znext-solver
9+
10+
pub trait Trait {}
11+
12+
pub struct S0<T>(T);
13+
14+
pub struct S<T>(T);
15+
impl<T> Trait for S<T> where S0<T>: Trait {}
16+
17+
pub struct W;
18+
19+
pub trait Other {
20+
type Choose<L, R>;
21+
}
22+
23+
// first impl
24+
impl<T: Trait> Other for T {
25+
type Choose<L, R> = L;
26+
}
27+
28+
// second impl
29+
impl<T> Other for S<T> {
30+
//[cfail2]~^ ERROR conflicting implementations of trait
31+
type Choose<L, R> = R;
32+
}
33+
34+
#[cfg(cpass1)]
35+
impl Trait for W {}
36+
37+
#[cfg(cfail2)]
38+
impl Trait for S<W> {}
39+
40+
fn main() {}

0 commit comments

Comments
 (0)