Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cc682fd

Browse files
authoredJan 16, 2025
Unrolled build for rust-lang#135522
Rollup merge of rust-lang#135522 - lqd:issue-135514, r=compiler-errors add incremental test for issue 135514 r? `@compiler-errors` as requested in rust-lang#135514 (comment) This adds parts of `@steffahn's` repro as an incremental test for rust-lang#135514. I had initially added the actual exploitation of the issue into the safe transmute, but removed it because it's not exactly needed for such a test. I can add it back if you'd like. I've verified that the test fails with rust-lang#133828 reverted.
2 parents 419b3e2 + 67a07e0 commit cc682fd

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)
Failed to load comments.