Move tests from tests/crashes to tests/ui now that they don't ICE
This commit is contained in:
parent
cee9cc6113
commit
6af91c56d1
7 changed files with 86 additions and 29 deletions
|
|
@ -1,18 +0,0 @@
|
||||||
//@ known-bug: #137190
|
|
||||||
trait Supertrait<T> {
|
|
||||||
fn method(&self) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
trait Trait<P>: Supertrait<()> {}
|
|
||||||
|
|
||||||
impl<P> Trait<P> for () {}
|
|
||||||
|
|
||||||
const fn upcast<P>(x: &dyn Trait<P>) -> &dyn Supertrait<()> {
|
|
||||||
x
|
|
||||||
}
|
|
||||||
|
|
||||||
const fn foo() -> &'static dyn Supertrait<()> {
|
|
||||||
upcast::<()>(&())
|
|
||||||
}
|
|
||||||
|
|
||||||
const _: &'static dyn Supertrait<()> = foo();
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
//@ known-bug: #137190
|
|
||||||
trait Supertrait {
|
|
||||||
fn method(&self) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
trait Trait: Supertrait {}
|
|
||||||
|
|
||||||
impl Trait for () {}
|
|
||||||
|
|
||||||
const _: &dyn Supertrait = &() as &dyn Trait as &dyn Supertrait;
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
//@ known-bug: #135470
|
// Regression test for #135470.
|
||||||
|
// Verify that we don't ICE when building vtable entries
|
||||||
|
// for a blanket impl involving async and impossible predicates.
|
||||||
|
|
||||||
|
//@ check-pass
|
||||||
//@ compile-flags: -Copt-level=0
|
//@ compile-flags: -Copt-level=0
|
||||||
//@ edition: 2021
|
//@ edition: 2021
|
||||||
|
|
||||||
25
tests/ui/coercion/vtable-unsatisfied-supertrait-generics.rs
Normal file
25
tests/ui/coercion/vtable-unsatisfied-supertrait-generics.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
// Regression test for #137190.
|
||||||
|
// Variant of vtable-unsatisfied-supertrait.rs with generic traits.
|
||||||
|
// Verify that we don't ICE when building vtable entries
|
||||||
|
// for a generic trait whose supertrait is not implemented.
|
||||||
|
|
||||||
|
//@ compile-flags: --crate-type lib
|
||||||
|
|
||||||
|
trait Supertrait<T> {
|
||||||
|
fn method(&self) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Trait<P>: Supertrait<()> {}
|
||||||
|
|
||||||
|
impl<P> Trait<P> for () {}
|
||||||
|
//~^ ERROR the trait bound `(): Supertrait<()>` is not satisfied
|
||||||
|
|
||||||
|
const fn upcast<P>(x: &dyn Trait<P>) -> &dyn Supertrait<()> {
|
||||||
|
x
|
||||||
|
}
|
||||||
|
|
||||||
|
const fn foo() -> &'static dyn Supertrait<()> {
|
||||||
|
upcast::<()>(&())
|
||||||
|
}
|
||||||
|
|
||||||
|
const _: &'static dyn Supertrait<()> = foo();
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
error[E0277]: the trait bound `(): Supertrait<()>` is not satisfied
|
||||||
|
--> $DIR/vtable-unsatisfied-supertrait-generics.rs:14:22
|
||||||
|
|
|
||||||
|
LL | impl<P> Trait<P> for () {}
|
||||||
|
| ^^ the trait `Supertrait<()>` is not implemented for `()`
|
||||||
|
|
|
||||||
|
help: this trait has no implementations, consider adding one
|
||||||
|
--> $DIR/vtable-unsatisfied-supertrait-generics.rs:8:1
|
||||||
|
|
|
||||||
|
LL | trait Supertrait<T> {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
note: required by a bound in `Trait`
|
||||||
|
--> $DIR/vtable-unsatisfied-supertrait-generics.rs:12:17
|
||||||
|
|
|
||||||
|
LL | trait Trait<P>: Supertrait<()> {}
|
||||||
|
| ^^^^^^^^^^^^^^ required by this bound in `Trait`
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
16
tests/ui/coercion/vtable-unsatisfied-supertrait.rs
Normal file
16
tests/ui/coercion/vtable-unsatisfied-supertrait.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Regression test for #137190.
|
||||||
|
// Verify that we don't ICE when building vtable entries
|
||||||
|
// for a trait whose supertrait is not implemented.
|
||||||
|
|
||||||
|
//@ compile-flags: --crate-type lib
|
||||||
|
|
||||||
|
trait Supertrait {
|
||||||
|
fn method(&self) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Trait: Supertrait {}
|
||||||
|
|
||||||
|
impl Trait for () {}
|
||||||
|
//~^ ERROR the trait bound `(): Supertrait` is not satisfied
|
||||||
|
|
||||||
|
const _: &dyn Supertrait = &() as &dyn Trait as &dyn Supertrait;
|
||||||
20
tests/ui/coercion/vtable-unsatisfied-supertrait.stderr
Normal file
20
tests/ui/coercion/vtable-unsatisfied-supertrait.stderr
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
error[E0277]: the trait bound `(): Supertrait` is not satisfied
|
||||||
|
--> $DIR/vtable-unsatisfied-supertrait.rs:13:16
|
||||||
|
|
|
||||||
|
LL | impl Trait for () {}
|
||||||
|
| ^^ the trait `Supertrait` is not implemented for `()`
|
||||||
|
|
|
||||||
|
help: this trait has no implementations, consider adding one
|
||||||
|
--> $DIR/vtable-unsatisfied-supertrait.rs:7:1
|
||||||
|
|
|
||||||
|
LL | trait Supertrait {
|
||||||
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
note: required by a bound in `Trait`
|
||||||
|
--> $DIR/vtable-unsatisfied-supertrait.rs:11:14
|
||||||
|
|
|
||||||
|
LL | trait Trait: Supertrait {}
|
||||||
|
| ^^^^^^^^^^ required by this bound in `Trait`
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue