Skip to content

Commit 6d80879

Browse files
committed
Add regression test for RPITITs
1 parent 3aec8d4 commit 6d80879

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0277]: the trait bound `impl Foo<u8>: Foo<char>` is not satisfied
2+
--> $DIR/return-dont-satisfy-bounds.rs:13:34
3+
|
4+
LL | fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> {
5+
| ^^^^^^^^^^^^ the trait `Foo<char>` is not implemented for `impl Foo<u8>`
6+
|
7+
= help: the trait `Foo<char>` is implemented for `Bar`
8+
note: required by a bound in `Foo::foo::{opaque#0}`
9+
--> $DIR/return-dont-satisfy-bounds.rs:7:30
10+
|
11+
LL | fn foo<F2>(self) -> impl Foo<T>;
12+
| ^^^^^^ required by this bound in `Foo::foo::{opaque#0}`
13+
14+
error: aborting due to previous error
15+
16+
For more information about this error, try `rustc --explain E0277`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0277]: the trait bound `impl Foo<u8>: Foo<char>` is not satisfied
2+
--> $DIR/return-dont-satisfy-bounds.rs:13:34
3+
|
4+
LL | fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> {
5+
| ^^^^^^^^^^^^ the trait `Foo<char>` is not implemented for `impl Foo<u8>`
6+
|
7+
= help: the trait `Foo<char>` is implemented for `Bar`
8+
note: required by a bound in `Foo::{opaque#0}`
9+
--> $DIR/return-dont-satisfy-bounds.rs:7:30
10+
|
11+
LL | fn foo<F2>(self) -> impl Foo<T>;
12+
| ^^^^^^ required by this bound in `Foo::{opaque#0}`
13+
14+
error: aborting due to previous error
15+
16+
For more information about this error, try `rustc --explain E0277`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
2+
// revisions: current next
3+
4+
#![feature(return_position_impl_trait_in_trait)]
5+
6+
trait Foo<T> {
7+
fn foo<F2>(self) -> impl Foo<T>;
8+
}
9+
10+
struct Bar;
11+
12+
impl Foo<char> for Bar {
13+
fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> {
14+
//~^ ERROR: the trait bound `impl Foo<u8>: Foo<char>` is not satisfied [E0277]
15+
self
16+
}
17+
}
18+
19+
fn main() {}

0 commit comments

Comments
 (0)