2 files changed +70
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Computing the ambiguity causes for the overlap ended up
2
+ // causing an exponential blowup when recursing into the normalization
3
+ // goals for `<Box<?t> as RecursiveSuper>::Assoc`. This test
4
+ // takes multiple minutes when doing so and less than a second
5
+ // otherwise.
6
+
7
+ //@ compile-flags: -Znext-solver=coherence
8
+
9
+ trait RecursiveSuper :
10
+ Super <
11
+ A0 = Self :: Assoc ,
12
+ A1 = Self :: Assoc ,
13
+ A2 = Self :: Assoc ,
14
+ A3 = Self :: Assoc ,
15
+ A4 = Self :: Assoc ,
16
+ A5 = Self :: Assoc ,
17
+ A6 = Self :: Assoc ,
18
+ A7 = Self :: Assoc ,
19
+ A8 = Self :: Assoc ,
20
+ A9 = Self :: Assoc ,
21
+ A10 = Self :: Assoc ,
22
+ A11 = Self :: Assoc ,
23
+ A12 = Self :: Assoc ,
24
+ A13 = Self :: Assoc ,
25
+ A14 = Self :: Assoc ,
26
+ A15 = Self :: Assoc ,
27
+ >
28
+ {
29
+ type Assoc ;
30
+ }
31
+
32
+ trait Super {
33
+ type A0 ;
34
+ type A1 ;
35
+ type A2 ;
36
+ type A3 ;
37
+ type A4 ;
38
+ type A5 ;
39
+ type A6 ;
40
+ type A7 ;
41
+ type A8 ;
42
+ type A9 ;
43
+ type A10 ;
44
+ type A11 ;
45
+ type A12 ;
46
+ type A13 ;
47
+ type A14 ;
48
+ type A15 ;
49
+ }
50
+
51
+ trait Overlap { }
52
+ impl < T : RecursiveSuper > Overlap for T { }
53
+ impl < T > Overlap for Box < T > { }
54
+ //~^ ERROR conflicting implementations of trait `Overlap` for type `Box<_>`
55
+
56
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0119]: conflicting implementations of trait `Overlap` for type `Box<_>`
2
+ --> $DIR/ambiguity-causes-visitor-hang.rs:53:1
3
+ |
4
+ LL | impl<T: RecursiveSuper> Overlap for T {}
5
+ | ------------------------------------- first implementation here
6
+ LL | impl<T> Overlap for Box<T> {}
7
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Box<_>`
8
+ |
9
+ = note: downstream crates may implement trait `Super` for type `std::boxed::Box<_>`
10
+ = note: downstream crates may implement trait `RecursiveSuper` for type `std::boxed::Box<_>`
11
+
12
+ error: aborting due to 1 previous error
13
+
14
+ For more information about this error, try `rustc --explain E0119`.
0 commit comments