Skip to content

Commit e0716ad

Browse files
committed
test(parallel): Add regression test for fn_sig cycle arity ICE #153391
1 parent 64b72a1 commit e0716ad

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Regression test for #153391.
2+
//
3+
//@ edition:2024
4+
//@ compile-flags: -Z threads=16
5+
//@ compare-output-by-lines
6+
7+
trait A {
8+
fn g() -> B;
9+
//~^ ERROR expected a type, found a trait
10+
}
11+
12+
trait B {
13+
fn bar(&self, x: &A);
14+
//~^ ERROR expected a type, found a trait
15+
}
16+
17+
fn main() {}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
error[E0782]: expected a type, found a trait
2+
|
3+
LL | fn bar(&self, x: &A);
4+
| ^
5+
|
6+
= note: `A` is dyn-incompatible, otherwise a trait object could be used
7+
help: use a new generic type parameter, constrained by `A`
8+
|
9+
LL - fn bar(&self, x: &A);
10+
LL + fn bar<T: A>(&self, x: &T);
11+
|
12+
help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
13+
|
14+
LL | fn bar(&self, x: &impl A);
15+
| ++++
16+
17+
error[E0782]: expected a type, found a trait
18+
--> $DIR/fn-sig-cycle-ice-153391.rs:8:15
19+
|
20+
LL | fn g() -> B;
21+
| ^
22+
|
23+
|
24+
LL | fn g() -> impl B;
25+
| ++++
26+
|
27+
28+
error: aborting due to 2 previous errors
29+
30+
For more information about this error, try `rustc --explain E0782`.

0 commit comments

Comments
 (0)