Skip to content

Commit

Permalink
Promote crash tests to ui.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Oct 4, 2024
1 parent 6ec58a4 commit 6278e0f
Show file tree
Hide file tree
Showing 11 changed files with 124 additions and 35 deletions.
4 changes: 0 additions & 4 deletions tests/crashes/119716-2.rs

This file was deleted.

4 changes: 0 additions & 4 deletions tests/crashes/119716.rs

This file was deleted.

8 changes: 0 additions & 8 deletions tests/crashes/121422.rs

This file was deleted.

4 changes: 0 additions & 4 deletions tests/crashes/125843.rs

This file was deleted.

15 changes: 0 additions & 15 deletions tests/crashes/129099.rs

This file was deleted.

18 changes: 18 additions & 0 deletions tests/ui/type-alias-impl-trait/bound-lifetime-through-dyn-trait.rs
Original file line number Diff line number Diff line change
@@ -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
}
}
Original file line number Diff line number Diff line change
@@ -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`.
Original file line number Diff line number Diff line change
@@ -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() {}
Original file line number Diff line number Diff line change
@@ -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`.
10 changes: 10 additions & 0 deletions tests/ui/type-alias-impl-trait/non-lifetime-binder.rs
Original file line number Diff line number Diff line change
@@ -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() {}
25 changes: 25 additions & 0 deletions tests/ui/type-alias-impl-trait/non-lifetime-binder.stderr
Original file line number Diff line number Diff line change
@@ -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`.

0 comments on commit 6278e0f

Please sign in to comment.