Skip to content

Commit 3541645

Browse files
committed
Move tests from tests/crashes to tests/ui now that they don't ICE
1 parent 786777f commit 3541645

7 files changed

Lines changed: 86 additions & 29 deletions

tests/crashes/137190-2.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/crashes/137190-3.rs

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/crashes/135470.rs renamed to tests/ui/coercion/vtable-impossible-predicates-async.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
//@ known-bug: #135470
1+
// Regression test for #135470.
2+
// Verify that we don't ICE when building vtable entries
3+
// for a blanket impl involving async and impossible predicates.
4+
5+
//@ check-pass
26
//@ compile-flags: -Copt-level=0
37
//@ edition: 2021
48

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Regression test for #137190.
2+
// Variant of vtable-unsatisfied-supertrait.rs with generic traits.
3+
// Verify that we don't ICE when building vtable entries
4+
// for a generic trait whose supertrait is not implemented.
5+
6+
//@ compile-flags: --crate-type lib
7+
8+
trait Supertrait<T> {
9+
fn method(&self) {}
10+
}
11+
12+
trait Trait<P>: Supertrait<()> {}
13+
14+
impl<P> Trait<P> for () {}
15+
//~^ ERROR the trait bound `(): Supertrait<()>` is not satisfied
16+
17+
const fn upcast<P>(x: &dyn Trait<P>) -> &dyn Supertrait<()> {
18+
x
19+
}
20+
21+
const fn foo() -> &'static dyn Supertrait<()> {
22+
upcast::<()>(&())
23+
}
24+
25+
const _: &'static dyn Supertrait<()> = foo();
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error[E0277]: the trait bound `(): Supertrait<()>` is not satisfied
2+
--> $DIR/vtable-unsatisfied-supertrait-generics.rs:14:22
3+
|
4+
LL | impl<P> Trait<P> for () {}
5+
| ^^ the trait `Supertrait<()>` is not implemented for `()`
6+
|
7+
help: this trait has no implementations, consider adding one
8+
--> $DIR/vtable-unsatisfied-supertrait-generics.rs:8:1
9+
|
10+
LL | trait Supertrait<T> {
11+
| ^^^^^^^^^^^^^^^^^^^
12+
note: required by a bound in `Trait`
13+
--> $DIR/vtable-unsatisfied-supertrait-generics.rs:12:17
14+
|
15+
LL | trait Trait<P>: Supertrait<()> {}
16+
| ^^^^^^^^^^^^^^ required by this bound in `Trait`
17+
18+
error: aborting due to 1 previous error
19+
20+
For more information about this error, try `rustc --explain E0277`.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Regression test for #137190.
2+
// Verify that we don't ICE when building vtable entries
3+
// for a trait whose supertrait is not implemented.
4+
5+
//@ compile-flags: --crate-type lib
6+
7+
trait Supertrait {
8+
fn method(&self) {}
9+
}
10+
11+
trait Trait: Supertrait {}
12+
13+
impl Trait for () {}
14+
//~^ ERROR the trait bound `(): Supertrait` is not satisfied
15+
16+
const _: &dyn Supertrait = &() as &dyn Trait as &dyn Supertrait;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error[E0277]: the trait bound `(): Supertrait` is not satisfied
2+
--> $DIR/vtable-unsatisfied-supertrait.rs:13:16
3+
|
4+
LL | impl Trait for () {}
5+
| ^^ the trait `Supertrait` is not implemented for `()`
6+
|
7+
help: this trait has no implementations, consider adding one
8+
--> $DIR/vtable-unsatisfied-supertrait.rs:7:1
9+
|
10+
LL | trait Supertrait {
11+
| ^^^^^^^^^^^^^^^^
12+
note: required by a bound in `Trait`
13+
--> $DIR/vtable-unsatisfied-supertrait.rs:11:14
14+
|
15+
LL | trait Trait: Supertrait {}
16+
| ^^^^^^^^^^ required by this bound in `Trait`
17+
18+
error: aborting due to 1 previous error
19+
20+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)