Skip to content

Commit 6118290

Browse files
committed
test(parallel): Add regression test for #153391
1 parent 2caef89 commit 6118290

2 files changed

Lines changed: 48 additions & 0 deletions

File tree

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: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
error[E0782]: expected a type, found a trait
2+
--> $DIR/fn-sig-cycle-ice-153391.rs:8:15
3+
|
4+
LL | fn g() -> B;
5+
| ^
6+
|
7+
help: `B` is dyn-incompatible, use `impl B` to return an opaque type, as long as you return a single underlying type
8+
|
9+
LL | fn g() -> impl B;
10+
| ++++
11+
12+
error[E0782]: expected a type, found a trait
13+
--> $DIR/fn-sig-cycle-ice-153391.rs:13:23
14+
|
15+
LL | fn bar(&self, x: &A);
16+
| ^
17+
|
18+
= note: `A` is dyn-incompatible, otherwise a trait object could be used
19+
help: use a new generic type parameter, constrained by `A`
20+
|
21+
LL - fn bar(&self, x: &A);
22+
LL + fn bar<T: A>(&self, x: &T);
23+
|
24+
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
25+
|
26+
LL | fn bar(&self, x: &impl A);
27+
| ++++
28+
29+
error: aborting due to 2 previous errors
30+
31+
For more information about this error, try `rustc --explain E0782`.

0 commit comments

Comments
 (0)