Skip to content

Commit f1dd097

Browse files
oli-obkcuviper
authored andcommitted
Also test under next solver
(cherry picked from commit 03fa9b8)
1 parent 85ca09b commit f1dd097

10 files changed

+71
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0282]: type annotations needed
2+
--> $DIR/recursive-bound-eval.rs:20:13
3+
|
4+
LL | move || recursive_fn().parse()
5+
| ^^^^^^^^^^^^^^ cannot infer type
6+
7+
error: aborting due to 1 previous error
8+
9+
For more information about this error, try `rustc --explain E0282`.

tests/ui/impl-trait/recursive-bound-eval.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
//! Test that we can evaluate nested obligations when invoking methods on recursive calls on
22
//! an RPIT.
33
4-
//@ check-pass
4+
//@revisions: next current
5+
//@[next] compile-flags: -Znext-solver
6+
7+
//@[current] check-pass
58

69
pub trait Parser<E> {
710
fn parse(&self) -> E;
@@ -15,6 +18,7 @@ impl<E, T: Fn() -> E> Parser<E> for T {
1518

1619
pub fn recursive_fn<E>() -> impl Parser<E> {
1720
move || recursive_fn().parse()
21+
//[next]~^ ERROR: type annotations needed
1822
}
1923

2024
fn main() {}

tests/ui/type-alias-impl-trait/issue-84660-unsoundness.stderr renamed to tests/ui/type-alias-impl-trait/issue-84660-unsoundness.current.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0119]: conflicting implementations of trait `Trait<Bar, _>`
2-
--> $DIR/issue-84660-unsoundness.rs:23:1
2+
--> $DIR/issue-84660-unsoundness.rs:28:1
33
|
44
LL | impl<In, Out> Trait<Bar, In> for Out {
55
| ------------------------------------ first implementation here
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
error[E0284]: type annotations needed: cannot satisfy `<Out as Trait<Bar, In>>::Out == ()`
2+
--> $DIR/issue-84660-unsoundness.rs:22:37
3+
|
4+
LL | fn convert(_i: In) -> Self::Out {
5+
| _____________________________________^
6+
LL | |
7+
LL | | unreachable!();
8+
LL | | }
9+
| |_____^ cannot satisfy `<Out as Trait<Bar, In>>::Out == ()`
10+
11+
error[E0119]: conflicting implementations of trait `Trait<Bar, _>`
12+
--> $DIR/issue-84660-unsoundness.rs:28:1
13+
|
14+
LL | impl<In, Out> Trait<Bar, In> for Out {
15+
| ------------------------------------ first implementation here
16+
...
17+
LL | impl<In, Out> Trait<(), In> for Out {
18+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
19+
20+
error: aborting due to 2 previous errors
21+
22+
Some errors have detailed explanations: E0119, E0284.
23+
For more information about an error, try `rustc --explain E0119`.

tests/ui/type-alias-impl-trait/issue-84660-unsoundness.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// Another example from issue #84660, this time weaponized as a safe transmute: an opaque type in an
22
// impl header being accepted was used to create unsoundness.
33

4+
//@ revisions: current next
5+
//@ ignore-compare-mode-next-solver (explicit revisions)
6+
//@[next] compile-flags: -Znext-solver
7+
48
#![feature(type_alias_impl_trait)]
59

610
trait Foo {}
@@ -16,11 +20,13 @@ trait Trait<T, In> {
1620
impl<In, Out> Trait<Bar, In> for Out {
1721
type Out = Out;
1822
fn convert(_i: In) -> Self::Out {
23+
//[next]~^ ERROR: cannot satisfy `<Out as Trait<Bar, In>>::Out == ()`
1924
unreachable!();
2025
}
2126
}
2227

23-
impl<In, Out> Trait<(), In> for Out { //~ ERROR conflicting implementations of trait `Trait<Bar, _>`
28+
impl<In, Out> Trait<(), In> for Out {
29+
//~^ ERROR conflicting implementations of trait `Trait<Bar, _>`
2430
type Out = In;
2531
fn convert(i: In) -> Self::Out {
2632
i

tests/ui/type-alias-impl-trait/nested-tait-inference.stderr renamed to tests/ui/type-alias-impl-trait/nested-tait-inference.current.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0277]: the trait bound `(): Foo<FooX>` is not satisfied
2-
--> $DIR/nested-tait-inference.rs:12:13
2+
--> $DIR/nested-tait-inference.rs:17:13
33
|
44
LL | fn foo() -> impl Foo<FooX> {
55
| ^^^^^^^^^^^^^^ the trait `Foo<FooX>` is not implemented for `()`
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
#![feature(type_alias_impl_trait)]
22
#![allow(dead_code)]
33

4+
//@ revisions: current next
5+
//@ ignore-compare-mode-next-solver (explicit revisions)
6+
//@[next] compile-flags: -Znext-solver
7+
//@[next] check-pass
8+
49
use std::fmt::Debug;
510

611
type FooX = impl Debug;
712

8-
trait Foo<A> { }
13+
trait Foo<A> {}
914

10-
impl Foo<()> for () { }
15+
impl Foo<()> for () {}
1116

1217
fn foo() -> impl Foo<FooX> {
13-
//~^ ERROR: the trait bound `(): Foo<FooX>` is not satisfied
18+
//[current]~^ ERROR: the trait bound `(): Foo<FooX>` is not satisfied
1419
// FIXME(type-alias-impl-trait): We could probably make this work.
1520
()
1621
}
1722

18-
fn main() { }
23+
fn main() {}

tests/ui/type-alias-impl-trait/nested-tait-inference2.stderr renamed to tests/ui/type-alias-impl-trait/nested-tait-inference2.current.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0277]: the trait bound `(): Foo<FooX>` is not satisfied
2-
--> $DIR/nested-tait-inference2.rs:13:13
2+
--> $DIR/nested-tait-inference2.rs:17:13
33
|
44
LL | fn foo() -> impl Foo<FooX> {
55
| ^^^^^^^^^^^^^^ the trait `Foo<FooX>` is not implemented for `()`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0284]: type annotations needed: cannot satisfy `impl Foo<FooX> == ()`
2+
--> $DIR/nested-tait-inference2.rs:19:5
3+
|
4+
LL | ()
5+
| ^^ cannot satisfy `impl Foo<FooX> == ()`
6+
7+
error: aborting due to 1 previous error
8+
9+
For more information about this error, try `rustc --explain E0284`.

tests/ui/type-alias-impl-trait/nested-tait-inference2.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#![feature(type_alias_impl_trait)]
22
#![allow(dead_code)]
33

4+
//@ revisions: current next
5+
//@ ignore-compare-mode-next-solver (explicit revisions)
6+
//@[next] compile-flags: -Znext-solver
7+
48
use std::fmt::Debug;
59

610
type FooX = impl Debug;
@@ -11,8 +15,9 @@ impl Foo<()> for () {}
1115
impl Foo<u32> for () {}
1216

1317
fn foo() -> impl Foo<FooX> {
14-
//~^ ERROR: the trait bound `(): Foo<FooX>` is not satisfied
18+
//[current]~^ ERROR: the trait bound `(): Foo<FooX>` is not satisfied
1519
()
20+
//[next]~^ ERROR: cannot satisfy `impl Foo<FooX> == ()`
1621
}
1722

1823
fn main() {}

0 commit comments

Comments
 (0)