Register member constraints on the final merged hidden type
Previously we did this per hidden type candiate, which didn't always have all the information available.
This commit is contained in:
parent
9110911353
commit
7bce50c01a
13 changed files with 62 additions and 96 deletions
|
|
@ -14,16 +14,21 @@ LL | | }
|
|||
= help: consider adding the following bound: `'a: 'b`
|
||||
|
||||
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
||||
--> $DIR/ret-impl-trait-one.rs:16:65
|
||||
--> $DIR/ret-impl-trait-one.rs:16:80
|
||||
|
|
||||
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
|
||||
| ^^^^^^^^^^^^^^
|
||||
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
|
||||
| ____________________________________--__________________________________________^
|
||||
| | |
|
||||
| | hidden type `(&'a u8, &'b u8)` captures the lifetime `'b` as defined here
|
||||
LL | |
|
||||
LL | | (a, b)
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
note: hidden type `(&'a u8, &'<empty> u8)` captures lifetime smaller than the function body
|
||||
--> $DIR/ret-impl-trait-one.rs:16:65
|
||||
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
|
||||
|
|
||||
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
|
||||
| ^^^^^^^^^^^^^^
|
||||
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
|
||||
| ++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -11,16 +11,21 @@ LL | | }
|
|||
| |_^ ...but data from `a` is returned here
|
||||
|
||||
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
||||
--> $DIR/ret-impl-trait-one.rs:16:65
|
||||
--> $DIR/ret-impl-trait-one.rs:16:80
|
||||
|
|
||||
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
|
||||
| ^^^^^^^^^^^^^^
|
||||
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
|
||||
| ____________________________________--__________________________________________^
|
||||
| | |
|
||||
| | hidden type `(&'a u8, &'b u8)` captures the lifetime `'b` as defined here
|
||||
LL | |
|
||||
LL | | (a, b)
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
note: hidden type `(&'a u8, &'<empty> u8)` captures lifetime smaller than the function body
|
||||
--> $DIR/ret-impl-trait-one.rs:16:65
|
||||
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
|
||||
|
|
||||
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
|
||||
| ^^^^^^^^^^^^^^
|
||||
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
|
||||
| ++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ where
|
|||
// ```
|
||||
if condition() { a } else { b }
|
||||
//~^ ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
||||
//~| ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
||||
}
|
||||
|
||||
fn condition() -> bool {
|
||||
|
|
|
|||
|
|
@ -12,20 +12,6 @@ help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'
|
|||
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e> + 'b
|
||||
| ++++
|
||||
|
||||
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
||||
--> $DIR/ordinary-bounds-unrelated.rs:28:33
|
||||
|
|
||||
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e>
|
||||
| -- hidden type `Ordinary<'b>` captures the lifetime `'b` as defined here
|
||||
...
|
||||
LL | if condition() { a } else { b }
|
||||
| ^
|
||||
|
|
||||
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
|
||||
|
|
||||
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e> + 'b
|
||||
| ++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0700`.
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b>
|
|||
// We are forced to pick that '0 = 'e, because only 'e is outlived by *both* 'a and 'b.
|
||||
if condition() { a } else { b }
|
||||
//~^ ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
||||
//~| ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
||||
}
|
||||
|
||||
fn condition() -> bool {
|
||||
|
|
|
|||
|
|
@ -12,20 +12,6 @@ help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'
|
|||
LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b> + 'b
|
||||
| ++++
|
||||
|
||||
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
||||
--> $DIR/ordinary-bounds-unsuited.rs:31:33
|
||||
|
|
||||
LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b>
|
||||
| -- hidden type `Ordinary<'b>` captures the lifetime `'b` as defined here
|
||||
...
|
||||
LL | if condition() { a } else { b }
|
||||
| ^
|
||||
|
|
||||
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
|
||||
|
|
||||
LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b> + 'b
|
||||
| ++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0700`.
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
||||
--> $DIR/arbitrary_self_types_pin_lifetime_impl_trait-async.rs:8:37
|
||||
--> $DIR/arbitrary_self_types_pin_lifetime_impl_trait-async.rs:8:48
|
||||
|
|
||||
LL | async fn f(self: Pin<&Self>) -> impl Clone { self }
|
||||
| ^^^^^^^^^^
|
||||
| - ^^^^^^^^
|
||||
| |
|
||||
| hidden type `Pin<&Foo>` captures the lifetime `'_` as defined here
|
||||
|
|
||||
note: hidden type `Pin<&'<empty> Foo>` captures lifetime smaller than the function body
|
||||
--> $DIR/arbitrary_self_types_pin_lifetime_impl_trait-async.rs:8:37
|
||||
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
|
||||
|
|
||||
LL | async fn f(self: Pin<&Self>) -> impl Clone { self }
|
||||
| ^^^^^^^^^^
|
||||
LL | async fn f(self: Pin<&Self>) -> impl Clone + '_ { self }
|
||||
| ++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue