Promote crash tests to ui.

This commit is contained in:
Camille GILLOT 2024-08-18 16:35:03 +00:00
parent 6ec58a44e2
commit 6278e0f507
11 changed files with 124 additions and 35 deletions

View File

@ -1,4 +0,0 @@
//@ known-bug: #119716
#![feature(non_lifetime_binders)]
trait Trait<T> {}
fn f() -> impl for<T> Trait<impl Trait<T>> {}

View File

@ -1,4 +0,0 @@
//@ known-bug: #119716
#![feature(non_lifetime_binders)]
trait v0<v1> {}
fn kind :(v3main impl for<v4> v0<'_, v2 = impl v0<v4> + '_>) {}

View File

@ -1,8 +0,0 @@
//@ known-bug: #121422
#![feature(non_lifetime_binders)]
trait Trait<T: ?Sized> {}
fn produce() -> impl for<T> Trait<(), Assoc = impl Trait<T>> {
16
}

View File

@ -1,4 +0,0 @@
//@ known-bug: rust-lang/rust#125843
#![feature(non_lifetime_binders)]
trait v0<> {}
fn kind :(v3main impl for<v4> v0<'_, v2 = impl v0<v4> + '_>) {}

View File

@ -1,15 +0,0 @@
//@ known-bug: rust-lang/rust#129099
#![feature(type_alias_impl_trait)]
fn dyn_hoops<T: Sized>() -> dyn for<'a> Iterator<Item = impl Captures<'a>> {
loop {}
}
pub fn main() {
type Opaque = impl Sized;
fn define() -> Opaque {
let x: Opaque = dyn_hoops::<()>(0);
x
}
}

View File

@ -0,0 +1,18 @@
#![feature(type_alias_impl_trait)]
trait Captures<'a> {}
impl<T> Captures<'_> for T {}
fn dyn_hoops<T: Sized>() -> dyn for<'a> Iterator<Item = impl Captures<'a>> {
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from `dyn` type
loop {}
}
pub fn main() {
//~^ ERROR item does not constrain `Opaque::{opaque#0}`, but has it in its signature
type Opaque = impl Sized;
fn define() -> Opaque {
let x: Opaque = dyn_hoops::<()>();
x
}
}

View File

@ -0,0 +1,28 @@
error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from `dyn` type
--> $DIR/bound-lifetime-through-dyn-trait.rs:6:71
|
LL | fn dyn_hoops<T: Sized>() -> dyn for<'a> Iterator<Item = impl Captures<'a>> {
| ^^
|
note: lifetime declared here
--> $DIR/bound-lifetime-through-dyn-trait.rs:6:37
|
LL | fn dyn_hoops<T: Sized>() -> dyn for<'a> Iterator<Item = impl Captures<'a>> {
| ^^
error: item does not constrain `Opaque::{opaque#0}`, but has it in its signature
--> $DIR/bound-lifetime-through-dyn-trait.rs:11:8
|
LL | pub fn main() {
| ^^^^
|
= note: consider moving the opaque type's declaration and defining uses into a separate module
note: this opaque type is in the signature
--> $DIR/bound-lifetime-through-dyn-trait.rs:13:19
|
LL | type Opaque = impl Sized;
| ^^^^^^^^^^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0657`.

View File

@ -0,0 +1,13 @@
#![allow(incomplete_features)]
#![feature(non_lifetime_binders)]
trait Trait<T: ?Sized> {}
fn produce() -> impl for<T> Trait<(), Assoc = impl Trait<T>> {
//~^ ERROR associated type `Assoc` not found for `Trait`
//~| ERROR associated type `Assoc` not found for `Trait`
//~| the trait bound `{integer}: Trait<()>` is not satisfied
16
}
fn main() {}

View File

@ -0,0 +1,30 @@
error[E0220]: associated type `Assoc` not found for `Trait`
--> $DIR/non-lifetime-binder-in-constraint.rs:6:39
|
LL | fn produce() -> impl for<T> Trait<(), Assoc = impl Trait<T>> {
| ^^^^^ associated type `Assoc` not found
error[E0220]: associated type `Assoc` not found for `Trait`
--> $DIR/non-lifetime-binder-in-constraint.rs:6:39
|
LL | fn produce() -> impl for<T> Trait<(), Assoc = impl Trait<T>> {
| ^^^^^ associated type `Assoc` not found
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `{integer}: Trait<()>` is not satisfied
--> $DIR/non-lifetime-binder-in-constraint.rs:6:17
|
LL | fn produce() -> impl for<T> Trait<(), Assoc = impl Trait<T>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<()>` is not implemented for `{integer}`
|
help: this trait has no implementations, consider adding one
--> $DIR/non-lifetime-binder-in-constraint.rs:4:1
|
LL | trait Trait<T: ?Sized> {}
| ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0220, E0277.
For more information about an error, try `rustc --explain E0220`.

View File

@ -0,0 +1,10 @@
#![allow(incomplete_features)]
#![feature(non_lifetime_binders)]
trait Trait<T> {}
fn f() -> impl for<T> Trait<impl Trait<T>> {}
//~^ ERROR nested `impl Trait` is not allowed
//~| ERROR the trait bound `(): Trait<impl Trait<T>>` is not satisfied
fn main() {}

View File

@ -0,0 +1,25 @@
error[E0666]: nested `impl Trait` is not allowed
--> $DIR/non-lifetime-binder.rs:6:29
|
LL | fn f() -> impl for<T> Trait<impl Trait<T>> {}
| ------------------^^^^^^^^^^^^^-
| | |
| | nested `impl Trait` here
| outer `impl Trait`
error[E0277]: the trait bound `(): Trait<impl Trait<T>>` is not satisfied
--> $DIR/non-lifetime-binder.rs:6:11
|
LL | fn f() -> impl for<T> Trait<impl Trait<T>> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<impl Trait<T>>` is not implemented for `()`
|
help: this trait has no implementations, consider adding one
--> $DIR/non-lifetime-binder.rs:4:1
|
LL | trait Trait<T> {}
| ^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0666.
For more information about an error, try `rustc --explain E0277`.