Skip to content

Commit

Permalink
Add revisions to fixed tests in -Zlower-impl-trait-in-trait-to-assoc-ty
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Mar 15, 2023
1 parent 11f1810 commit c5c4340
Show file tree
Hide file tree
Showing 15 changed files with 180 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
error[E0311]: the parameter type `U` may not live long enough
--> $DIR/async-generics-and-bounds.rs:12:28
--> $DIR/async-generics-and-bounds.rs:14:28
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^
|
note: the parameter type `U` must be valid for the anonymous lifetime defined here...
--> $DIR/async-generics-and-bounds.rs:12:18
--> $DIR/async-generics-and-bounds.rs:14:18
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at
--> $DIR/async-generics-and-bounds.rs:12:28
--> $DIR/async-generics-and-bounds.rs:14:28
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^

error[E0311]: the parameter type `T` may not live long enough
--> $DIR/async-generics-and-bounds.rs:12:28
--> $DIR/async-generics-and-bounds.rs:14:28
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^
|
note: the parameter type `T` must be valid for the anonymous lifetime defined here...
--> $DIR/async-generics-and-bounds.rs:12:18
--> $DIR/async-generics-and-bounds.rs:14:18
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at
--> $DIR/async-generics-and-bounds.rs:12:28
--> $DIR/async-generics-and-bounds.rs:14:28
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
error[E0311]: the parameter type `U` may not live long enough
--> $DIR/async-generics-and-bounds.rs:14:28
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^
|
note: the parameter type `U` must be valid for the anonymous lifetime defined here...
--> $DIR/async-generics-and-bounds.rs:14:18
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at
--> $DIR/async-generics-and-bounds.rs:14:28
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^

error[E0311]: the parameter type `T` may not live long enough
--> $DIR/async-generics-and-bounds.rs:14:28
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^
|
note: the parameter type `T` must be valid for the anonymous lifetime defined here...
--> $DIR/async-generics-and-bounds.rs:14:18
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at
--> $DIR/async-generics-and-bounds.rs:14:28
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0311`.
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/async-generics-and-bounds.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// check-fail
// known-bug: #102682
// edition: 2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
error[E0311]: the parameter type `U` may not live long enough
--> $DIR/async-generics.rs:9:28
--> $DIR/async-generics.rs:11:28
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^
|
note: the parameter type `U` must be valid for the anonymous lifetime defined here...
--> $DIR/async-generics.rs:9:18
--> $DIR/async-generics.rs:11:18
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at
--> $DIR/async-generics.rs:9:28
--> $DIR/async-generics.rs:11:28
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^

error[E0311]: the parameter type `T` may not live long enough
--> $DIR/async-generics.rs:9:28
--> $DIR/async-generics.rs:11:28
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^
|
note: the parameter type `T` must be valid for the anonymous lifetime defined here...
--> $DIR/async-generics.rs:9:18
--> $DIR/async-generics.rs:11:18
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at
--> $DIR/async-generics.rs:9:28
--> $DIR/async-generics.rs:11:28
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^
Expand Down
37 changes: 37 additions & 0 deletions tests/ui/async-await/in-trait/async-generics.next.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
error[E0311]: the parameter type `U` may not live long enough
--> $DIR/async-generics.rs:11:28
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^
|
note: the parameter type `U` must be valid for the anonymous lifetime defined here...
--> $DIR/async-generics.rs:11:18
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at
--> $DIR/async-generics.rs:11:28
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^

error[E0311]: the parameter type `T` may not live long enough
--> $DIR/async-generics.rs:11:28
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^
|
note: the parameter type `T` must be valid for the anonymous lifetime defined here...
--> $DIR/async-generics.rs:11:18
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at
--> $DIR/async-generics.rs:11:28
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0311`.
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/async-generics.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// check-fail
// known-bug: #102682
// edition: 2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-102571.rs:20:9
--> $DIR/issue-102571.rs:23:9
|
LL | let () = t.bar();
| ^^ ------- this expression has type `impl Deref<Target = impl std::fmt::Display + ?Sized>`
Expand Down
14 changes: 14 additions & 0 deletions tests/ui/impl-trait/in-trait/issue-102571.next.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error[E0308]: mismatched types
--> $DIR/issue-102571.rs:23:9
|
LL | let () = t.bar();
| ^^ ------- this expression has type `impl Deref<Target = impl std::fmt::Display + ?Sized>`
| |
| expected associated type, found `()`
|
= note: expected associated type `impl Deref<Target = impl std::fmt::Display + ?Sized>`
found unit type `()`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
3 changes: 3 additions & 0 deletions tests/ui/impl-trait/in-trait/issue-102571.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0053]: method `bar` has an incompatible type for trait
--> $DIR/specialization-broken.rs:16:22
--> $DIR/specialization-broken.rs:19:22
|
LL | default impl<U> Foo for U
| - this type parameter
Expand All @@ -11,15 +11,15 @@ LL | fn bar(&self) -> U {
| help: change the output type to match the trait: `impl Sized`
|
note: type in trait
--> $DIR/specialization-broken.rs:9:22
--> $DIR/specialization-broken.rs:12:22
|
LL | fn bar(&self) -> impl Sized;
| ^^^^^^^^^^
= note: expected signature `fn(&U) -> impl Sized`
found signature `fn(&U) -> U`

error: method with return-position `impl Trait` in trait cannot be specialized
--> $DIR/specialization-broken.rs:16:5
--> $DIR/specialization-broken.rs:19:5
|
LL | fn bar(&self) -> U {
| ^^^^^^^^^^^^^^^^^^
Expand Down
31 changes: 31 additions & 0 deletions tests/ui/impl-trait/in-trait/specialization-broken.next.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
error[E0053]: method `bar` has an incompatible type for trait
--> $DIR/specialization-broken.rs:19:22
|
LL | default impl<U> Foo for U
| - this type parameter
...
LL | fn bar(&self) -> U {
| ^
| |
| expected associated type, found type parameter `U`
| help: change the output type to match the trait: `impl Sized`
|
note: type in trait
--> $DIR/specialization-broken.rs:12:22
|
LL | fn bar(&self) -> impl Sized;
| ^^^^^^^^^^
= note: expected signature `fn(&U) -> impl Sized`
found signature `fn(&U) -> U`

error: method with return-position `impl Trait` in trait cannot be specialized
--> $DIR/specialization-broken.rs:19:5
|
LL | fn bar(&self) -> U {
| ^^^^^^^^^^^^^^^^^^
|
= note: specialization behaves in inconsistent and surprising ways with `#![feature(return_position_impl_trait_in_trait)]`, and for now is disallowed

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0053`.
3 changes: 3 additions & 0 deletions tests/ui/impl-trait/in-trait/specialization-broken.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

// FIXME(compiler-errors): I'm not exactly sure if this is expected to pass or not.
// But we fixed an ICE anyways.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> $DIR/wf-bounds.rs:9:22
--> $DIR/wf-bounds.rs:11:22
|
LL | fn nya() -> impl Wf<Vec<[u8]>>;
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
Expand All @@ -9,14 +9,14 @@ note: required by a bound in `Vec`
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> $DIR/wf-bounds.rs:12:23
--> $DIR/wf-bounds.rs:14:23
|
LL | fn nya2() -> impl Wf<[u8]>;
| ^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `Wf`
--> $DIR/wf-bounds.rs:6:10
--> $DIR/wf-bounds.rs:8:10
|
LL | trait Wf<T> {}
| ^ required by this bound in `Wf`
Expand Down
30 changes: 30 additions & 0 deletions tests/ui/impl-trait/in-trait/wf-bounds.next.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> $DIR/wf-bounds.rs:11:22
|
LL | fn nya() -> impl Wf<Vec<[u8]>>;
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `Vec`
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> $DIR/wf-bounds.rs:14:23
|
LL | fn nya2() -> impl Wf<[u8]>;
| ^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `Wf`
--> $DIR/wf-bounds.rs:8:10
|
LL | trait Wf<T> {}
| ^ required by this bound in `Wf`
help: consider relaxing the implicit `Sized` restriction
|
LL | trait Wf<T: ?Sized> {}
| ++++++++

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.
2 changes: 2 additions & 0 deletions tests/ui/impl-trait/in-trait/wf-bounds.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// issue #101663
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
Expand Down

0 comments on commit c5c4340

Please sign in to comment.