Skip to content

Commit d9dc07c

Browse files
Rollup merge of #158044 - petrochenkov:partest, r=lqd
Add more tests for parallel frontend issues Issues: - #153366 - #154056 - #154560 2 issues still reproduce (and therefore marked with `//@ ignore-parallel-frontend query`), 1 issue doesn't reproduce. Closes #153366.
2 parents 87a98bd + 1c1aca5 commit d9dc07c

6 files changed

Lines changed: 191 additions & 0 deletions
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Regression test for ICE from issue #153366.
2+
3+
#![feature(unboxed_closures)]
4+
5+
fn iso<A>(a: Fn) -> Option<_>
6+
//~^ ERROR missing generics for trait `Fn`
7+
//~| ERROR the placeholder `_` is not allowed within types on item signatures for return types
8+
//~| WARN trait objects without an explicit `dyn` are deprecated
9+
//~| WARN this is accepted in the current edition
10+
where
11+
dyn Fn(A) -> (): Sized,
12+
{
13+
Box::new(iso_un_option)
14+
//~^ ERROR mismatched types
15+
}
16+
fn iso_un_option<B>() -> Box<_> {
17+
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
18+
iso(())
19+
//~^ ERROR the size for values of type `(dyn Fn(_) + 'static)` cannot be known at compilation
20+
}
21+
22+
fn main() {
23+
iso(())
24+
//~^ ERROR the size for values of type `(dyn Fn(_) + 'static)` cannot be known at compilation
25+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
warning: trait objects without an explicit `dyn` are deprecated
2+
--> $DIR/dyn-trait-ice-153366.rs:5:14
3+
|
4+
LL | fn iso<A>(a: Fn) -> Option<_>
5+
| ^^
6+
|
7+
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
8+
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>
9+
= note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default
10+
help: if this is a dyn-compatible trait, use `dyn`
11+
|
12+
LL | fn iso<A>(a: dyn Fn) -> Option<_>
13+
| +++
14+
15+
error[E0107]: missing generics for trait `Fn`
16+
--> $DIR/dyn-trait-ice-153366.rs:5:14
17+
|
18+
LL | fn iso<A>(a: Fn) -> Option<_>
19+
| ^^ expected 1 generic argument
20+
|
21+
help: add missing generic argument
22+
|
23+
LL | fn iso<A>(a: Fn<Args>) -> Option<_>
24+
| ++++++
25+
26+
error[E0277]: the size for values of type `(dyn Fn(_) + 'static)` cannot be known at compilation time
27+
--> $DIR/dyn-trait-ice-153366.rs:18:5
28+
|
29+
LL | iso(())
30+
| ^^^^^^^ doesn't have a size known at compile-time
31+
|
32+
= help: the trait `Sized` is not implemented for `(dyn Fn(_) + 'static)`
33+
note: required by a bound in `iso`
34+
--> $DIR/dyn-trait-ice-153366.rs:11:22
35+
|
36+
LL | fn iso<A>(a: Fn) -> Option<_>
37+
| --- required by a bound in this function
38+
...
39+
LL | dyn Fn(A) -> (): Sized,
40+
| ^^^^^ required by this bound in `iso`
41+
42+
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
43+
--> $DIR/dyn-trait-ice-153366.rs:16:30
44+
|
45+
LL | fn iso_un_option<B>() -> Box<_> {
46+
| ^ not allowed in type signatures
47+
48+
error[E0308]: mismatched types
49+
--> $DIR/dyn-trait-ice-153366.rs:13:5
50+
|
51+
LL | fn iso<A>(a: Fn) -> Option<_>
52+
| --------- expected `Option<_>` because of return type
53+
...
54+
LL | Box::new(iso_un_option)
55+
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `Option<_>`, found `Box<fn() -> ... {iso_un_option::<_>}>`
56+
|
57+
= note: expected enum `Option<_>`
58+
found struct `Box<fn() -> {type error} {iso_un_option::<_>}>`
59+
help: use parentheses to call this function
60+
|
61+
LL | Box::new(iso_un_option)()
62+
| ++
63+
help: try wrapping the expression in `Some`
64+
|
65+
LL | Some(Box::new(iso_un_option))
66+
| +++++ +
67+
68+
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
69+
--> $DIR/dyn-trait-ice-153366.rs:5:28
70+
|
71+
LL | fn iso<A>(a: Fn) -> Option<_>
72+
| ^ not allowed in type signatures
73+
74+
error[E0277]: the size for values of type `(dyn Fn(_) + 'static)` cannot be known at compilation time
75+
--> $DIR/dyn-trait-ice-153366.rs:23:5
76+
|
77+
LL | iso(())
78+
| ^^^^^^^ doesn't have a size known at compile-time
79+
|
80+
= help: the trait `Sized` is not implemented for `(dyn Fn(_) + 'static)`
81+
note: required by a bound in `iso`
82+
--> $DIR/dyn-trait-ice-153366.rs:11:22
83+
|
84+
LL | fn iso<A>(a: Fn) -> Option<_>
85+
| --- required by a bound in this function
86+
...
87+
LL | dyn Fn(A) -> (): Sized,
88+
| ^^^^^ required by this bound in `iso`
89+
90+
error: aborting due to 6 previous errors; 1 warning emitted
91+
92+
Some errors have detailed explanations: E0107, E0121, E0277, E0308.
93+
For more information about an error, try `rustc --explain E0107`.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Regression test for ICE from issue #154056.
2+
3+
//@ ignore-parallel-frontend query cycle + ICE
4+
5+
#![feature(min_generic_const_args)]
6+
#![feature(return_type_notation)]
7+
8+
trait IntFactory {
9+
fn stream(&self) -> impl IntFactory<stream(..): Send>;
10+
//~^ ERROR cycle detected when resolving lifetimes for `IntFactory::stream`
11+
}
12+
trait SendIntFactory: IntFactory<stream(..): Send> + Send {}
13+
14+
fn main() {}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0391]: cycle detected when resolving lifetimes for `IntFactory::stream`
2+
--> $DIR/fn-sig-cycle-ice-154560.rs:9:5
3+
|
4+
LL | fn stream(&self) -> impl IntFactory<stream(..): Send>;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: ...which requires computing function signature of `IntFactory::stream`...
8+
= note: ...which requires looking up late bound vars inside `IntFactory::stream`...
9+
= note: ...which again requires resolving lifetimes for `IntFactory::stream`, completing the cycle
10+
note: cycle used when listing captured lifetimes for opaque `IntFactory::stream::{opaque#0}`
11+
--> $DIR/fn-sig-cycle-ice-154560.rs:9:25
12+
|
13+
LL | fn stream(&self) -> impl IntFactory<stream(..): Send>;
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15+
= note: for more information, see <https://rustc-dev-guide.rust-lang.org/overview.html#queries> and <https://rustc-dev-guide.rust-lang.org/query.html>
16+
17+
error: aborting due to 1 previous error
18+
19+
For more information about this error, try `rustc --explain E0391`.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Regression test for ICE from issue #154560.
2+
//~^ ERROR cycle detected when computing the variances for items in this crate
3+
4+
//@ ignore-parallel-frontend query cycle + ICE
5+
6+
pub struct T<'a>(&'a str);
7+
8+
pub fn f<T>() -> _ {
9+
T
10+
}
11+
12+
pub fn g<'a>(val: T<'a>) -> _ {
13+
T
14+
}
15+
16+
fn main() {}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
error[E0391]: cycle detected when computing the variances for items in this crate
2+
|
3+
note: ...which requires computing function signature of `f`...
4+
--> $DIR/variances-cycle-ice-154560.rs:8:1
5+
|
6+
LL | pub fn f<T>() -> _ {
7+
| ^^^^^^^^^^^^^^^^^^
8+
= note: ...which requires type-checking `f`...
9+
note: ...which requires computing the variances of `T`...
10+
--> $DIR/variances-cycle-ice-154560.rs:6:1
11+
|
12+
LL | pub struct T<'a>(&'a str);
13+
| ^^^^^^^^^^^^^^^^
14+
= note: ...which again requires computing the variances for items in this crate, completing the cycle
15+
note: cycle used when computing the variances of `T`
16+
--> $DIR/variances-cycle-ice-154560.rs:6:1
17+
|
18+
LL | pub struct T<'a>(&'a str);
19+
| ^^^^^^^^^^^^^^^^
20+
= note: for more information, see <https://rustc-dev-guide.rust-lang.org/overview.html#queries> and <https://rustc-dev-guide.rust-lang.org/query.html>
21+
22+
error: aborting due to 1 previous error
23+
24+
For more information about this error, try `rustc --explain E0391`.

0 commit comments

Comments
 (0)