Also test under next solver
This commit is contained in:
parent
6cca6da126
commit
03fa9b8073
9
tests/ui/impl-trait/recursive-bound-eval.next.stderr
Normal file
9
tests/ui/impl-trait/recursive-bound-eval.next.stderr
Normal file
@ -0,0 +1,9 @@
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/recursive-bound-eval.rs:20:13
|
||||
|
|
||||
LL | move || recursive_fn().parse()
|
||||
| ^^^^^^^^^^^^^^ cannot infer type
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0282`.
|
@ -1,7 +1,10 @@
|
||||
//! Test that we can evaluate nested obligations when invoking methods on recursive calls on
|
||||
//! an RPIT.
|
||||
|
||||
//@ check-pass
|
||||
//@revisions: next current
|
||||
//@[next] compile-flags: -Znext-solver
|
||||
|
||||
//@[current] check-pass
|
||||
|
||||
pub trait Parser<E> {
|
||||
fn parse(&self) -> E;
|
||||
@ -15,6 +18,7 @@ fn parse(&self) -> E {
|
||||
|
||||
pub fn recursive_fn<E>() -> impl Parser<E> {
|
||||
move || recursive_fn().parse()
|
||||
//[next]~^ ERROR: type annotations needed
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0119]: conflicting implementations of trait `Trait<Bar, _>`
|
||||
--> $DIR/issue-84660-unsoundness.rs:23:1
|
||||
--> $DIR/issue-84660-unsoundness.rs:28:1
|
||||
|
|
||||
LL | impl<In, Out> Trait<Bar, In> for Out {
|
||||
| ------------------------------------ first implementation here
|
@ -0,0 +1,23 @@
|
||||
error[E0284]: type annotations needed: cannot satisfy `<Out as Trait<Bar, In>>::Out == ()`
|
||||
--> $DIR/issue-84660-unsoundness.rs:22:37
|
||||
|
|
||||
LL | fn convert(_i: In) -> Self::Out {
|
||||
| _____________________________________^
|
||||
LL | |
|
||||
LL | | unreachable!();
|
||||
LL | | }
|
||||
| |_____^ cannot satisfy `<Out as Trait<Bar, In>>::Out == ()`
|
||||
|
||||
error[E0119]: conflicting implementations of trait `Trait<Bar, _>`
|
||||
--> $DIR/issue-84660-unsoundness.rs:28:1
|
||||
|
|
||||
LL | impl<In, Out> Trait<Bar, In> for Out {
|
||||
| ------------------------------------ first implementation here
|
||||
...
|
||||
LL | impl<In, Out> Trait<(), In> for Out {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0119, E0284.
|
||||
For more information about an error, try `rustc --explain E0119`.
|
@ -1,6 +1,10 @@
|
||||
// Another example from issue #84660, this time weaponized as a safe transmute: an opaque type in an
|
||||
// impl header being accepted was used to create unsoundness.
|
||||
|
||||
//@ revisions: current next
|
||||
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||
//@[next] compile-flags: -Znext-solver
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
trait Foo {}
|
||||
@ -16,11 +20,13 @@ trait Trait<T, In> {
|
||||
impl<In, Out> Trait<Bar, In> for Out {
|
||||
type Out = Out;
|
||||
fn convert(_i: In) -> Self::Out {
|
||||
//[next]~^ ERROR: cannot satisfy `<Out as Trait<Bar, In>>::Out == ()`
|
||||
unreachable!();
|
||||
}
|
||||
}
|
||||
|
||||
impl<In, Out> Trait<(), In> for Out { //~ ERROR conflicting implementations of trait `Trait<Bar, _>`
|
||||
impl<In, Out> Trait<(), In> for Out {
|
||||
//~^ ERROR conflicting implementations of trait `Trait<Bar, _>`
|
||||
type Out = In;
|
||||
fn convert(i: In) -> Self::Out {
|
||||
i
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0277]: the trait bound `(): Foo<FooX>` is not satisfied
|
||||
--> $DIR/nested-tait-inference.rs:12:13
|
||||
--> $DIR/nested-tait-inference.rs:17:13
|
||||
|
|
||||
LL | fn foo() -> impl Foo<FooX> {
|
||||
| ^^^^^^^^^^^^^^ the trait `Foo<FooX>` is not implemented for `()`
|
@ -1,18 +1,23 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
//@ revisions: current next
|
||||
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||
//@[next] compile-flags: -Znext-solver
|
||||
//@[next] check-pass
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
type FooX = impl Debug;
|
||||
|
||||
trait Foo<A> { }
|
||||
trait Foo<A> {}
|
||||
|
||||
impl Foo<()> for () { }
|
||||
impl Foo<()> for () {}
|
||||
|
||||
fn foo() -> impl Foo<FooX> {
|
||||
//~^ ERROR: the trait bound `(): Foo<FooX>` is not satisfied
|
||||
//[current]~^ ERROR: the trait bound `(): Foo<FooX>` is not satisfied
|
||||
// FIXME(type-alias-impl-trait): We could probably make this work.
|
||||
()
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
fn main() {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0277]: the trait bound `(): Foo<FooX>` is not satisfied
|
||||
--> $DIR/nested-tait-inference2.rs:13:13
|
||||
--> $DIR/nested-tait-inference2.rs:17:13
|
||||
|
|
||||
LL | fn foo() -> impl Foo<FooX> {
|
||||
| ^^^^^^^^^^^^^^ the trait `Foo<FooX>` is not implemented for `()`
|
@ -0,0 +1,9 @@
|
||||
error[E0284]: type annotations needed: cannot satisfy `impl Foo<FooX> == ()`
|
||||
--> $DIR/nested-tait-inference2.rs:19:5
|
||||
|
|
||||
LL | ()
|
||||
| ^^ cannot satisfy `impl Foo<FooX> == ()`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0284`.
|
@ -1,6 +1,10 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
//@ revisions: current next
|
||||
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||
//@[next] compile-flags: -Znext-solver
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
type FooX = impl Debug;
|
||||
@ -11,8 +15,9 @@ impl Foo<()> for () {}
|
||||
impl Foo<u32> for () {}
|
||||
|
||||
fn foo() -> impl Foo<FooX> {
|
||||
//~^ ERROR: the trait bound `(): Foo<FooX>` is not satisfied
|
||||
//[current]~^ ERROR: the trait bound `(): Foo<FooX>` is not satisfied
|
||||
()
|
||||
//[next]~^ ERROR: cannot satisfy `impl Foo<FooX> == ()`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
Loading…
Reference in New Issue
Block a user