Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions tests/ui/parallel-rustc/dyn-trait-ice-153366.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Regression test for ICE from issue #153366.

#![feature(unboxed_closures)]

fn iso<A>(a: Fn) -> Option<_>
//~^ ERROR missing generics for trait `Fn`
//~| ERROR the placeholder `_` is not allowed within types on item signatures for return types
//~| WARN trait objects without an explicit `dyn` are deprecated
//~| WARN this is accepted in the current edition
where
dyn Fn(A) -> (): Sized,
{
Box::new(iso_un_option)
//~^ ERROR mismatched types
}
fn iso_un_option<B>() -> Box<_> {
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
iso(())
//~^ ERROR the size for values of type `(dyn Fn(_) + 'static)` cannot be known at compilation
}

fn main() {
iso(())
//~^ ERROR the size for values of type `(dyn Fn(_) + 'static)` cannot be known at compilation
}
93 changes: 93 additions & 0 deletions tests/ui/parallel-rustc/dyn-trait-ice-153366.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/dyn-trait-ice-153366.rs:5:14
|
LL | fn iso<A>(a: Fn) -> Option<_>
| ^^
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>
= note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default
help: if this is a dyn-compatible trait, use `dyn`
|
LL | fn iso<A>(a: dyn Fn) -> Option<_>
| +++

error[E0107]: missing generics for trait `Fn`
--> $DIR/dyn-trait-ice-153366.rs:5:14
|
LL | fn iso<A>(a: Fn) -> Option<_>
| ^^ expected 1 generic argument
|
help: add missing generic argument
|
LL | fn iso<A>(a: Fn<Args>) -> Option<_>
| ++++++

error[E0277]: the size for values of type `(dyn Fn(_) + 'static)` cannot be known at compilation time
--> $DIR/dyn-trait-ice-153366.rs:18:5
|
LL | iso(())
| ^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `(dyn Fn(_) + 'static)`
note: required by a bound in `iso`
--> $DIR/dyn-trait-ice-153366.rs:11:22
|
LL | fn iso<A>(a: Fn) -> Option<_>
| --- required by a bound in this function
...
LL | dyn Fn(A) -> (): Sized,
| ^^^^^ required by this bound in `iso`

error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/dyn-trait-ice-153366.rs:16:30
|
LL | fn iso_un_option<B>() -> Box<_> {
| ^ not allowed in type signatures

error[E0308]: mismatched types
--> $DIR/dyn-trait-ice-153366.rs:13:5
|
LL | fn iso<A>(a: Fn) -> Option<_>
| --------- expected `Option<_>` because of return type
...
LL | Box::new(iso_un_option)
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `Option<_>`, found `Box<fn() -> ... {iso_un_option::<_>}>`
|
= note: expected enum `Option<_>`
found struct `Box<fn() -> {type error} {iso_un_option::<_>}>`
help: use parentheses to call this function
|
LL | Box::new(iso_un_option)()
| ++
help: try wrapping the expression in `Some`
|
LL | Some(Box::new(iso_un_option))
| +++++ +

error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/dyn-trait-ice-153366.rs:5:28
|
LL | fn iso<A>(a: Fn) -> Option<_>
| ^ not allowed in type signatures

error[E0277]: the size for values of type `(dyn Fn(_) + 'static)` cannot be known at compilation time
--> $DIR/dyn-trait-ice-153366.rs:23:5
|
LL | iso(())
| ^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `(dyn Fn(_) + 'static)`
note: required by a bound in `iso`
--> $DIR/dyn-trait-ice-153366.rs:11:22
|
LL | fn iso<A>(a: Fn) -> Option<_>
| --- required by a bound in this function
...
LL | dyn Fn(A) -> (): Sized,
| ^^^^^ required by this bound in `iso`

error: aborting due to 6 previous errors; 1 warning emitted

Some errors have detailed explanations: E0107, E0121, E0277, E0308.
For more information about an error, try `rustc --explain E0107`.
14 changes: 14 additions & 0 deletions tests/ui/parallel-rustc/fn-sig-cycle-ice-154560.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Regression test for ICE from issue #154056.

//@ ignore-parallel-frontend query cycle + ICE

#![feature(min_generic_const_args)]
#![feature(return_type_notation)]

trait IntFactory {
fn stream(&self) -> impl IntFactory<stream(..): Send>;
//~^ ERROR cycle detected when resolving lifetimes for `IntFactory::stream`
}
trait SendIntFactory: IntFactory<stream(..): Send> + Send {}

fn main() {}
19 changes: 19 additions & 0 deletions tests/ui/parallel-rustc/fn-sig-cycle-ice-154560.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
error[E0391]: cycle detected when resolving lifetimes for `IntFactory::stream`
--> $DIR/fn-sig-cycle-ice-154560.rs:9:5
|
LL | fn stream(&self) -> impl IntFactory<stream(..): Send>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: ...which requires computing function signature of `IntFactory::stream`...
= note: ...which requires looking up late bound vars inside `IntFactory::stream`...
= note: ...which again requires resolving lifetimes for `IntFactory::stream`, completing the cycle
note: cycle used when listing captured lifetimes for opaque `IntFactory::stream::{opaque#0}`
--> $DIR/fn-sig-cycle-ice-154560.rs:9:25
|
LL | fn stream(&self) -> impl IntFactory<stream(..): Send>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= 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>

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0391`.
16 changes: 16 additions & 0 deletions tests/ui/parallel-rustc/variances-cycle-ice-154560.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Regression test for ICE from issue #154560.
//~^ ERROR cycle detected when computing the variances for items in this crate

//@ ignore-parallel-frontend query cycle + ICE

pub struct T<'a>(&'a str);

pub fn f<T>() -> _ {
T
}

pub fn g<'a>(val: T<'a>) -> _ {
T
}

fn main() {}
24 changes: 24 additions & 0 deletions tests/ui/parallel-rustc/variances-cycle-ice-154560.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
error[E0391]: cycle detected when computing the variances for items in this crate
|
note: ...which requires computing function signature of `f`...
--> $DIR/variances-cycle-ice-154560.rs:8:1
|
LL | pub fn f<T>() -> _ {
| ^^^^^^^^^^^^^^^^^^
= note: ...which requires type-checking `f`...
note: ...which requires computing the variances of `T`...
--> $DIR/variances-cycle-ice-154560.rs:6:1
|
LL | pub struct T<'a>(&'a str);
| ^^^^^^^^^^^^^^^^
= note: ...which again requires computing the variances for items in this crate, completing the cycle
note: cycle used when computing the variances of `T`
--> $DIR/variances-cycle-ice-154560.rs:6:1
|
LL | pub struct T<'a>(&'a str);
| ^^^^^^^^^^^^^^^^
= 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>

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0391`.
Loading