forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#105254 - cjgillot:issue-105251, r=oli-obk
Recurse into nested impl-trait when computing variance. Fixes rust-lang#105251
- Loading branch information
Showing
3 changed files
with
66 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// edition: 2021 | ||
|
||
fn test<'s: 's>(s: &'s str) -> impl std::future::Future<Output = impl Sized> { | ||
async move { let _s = s; } | ||
//~^ ERROR hidden type for `impl Future<Output = impl Sized>` captures lifetime that does not appear in bounds | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
error[E0700]: hidden type for `impl Future<Output = impl Sized>` captures lifetime that does not appear in bounds | ||
--> $DIR/nested-return-type4.rs:4:5 | ||
| | ||
LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future<Output = impl Sized> { | ||
| -- hidden type `[async block@$DIR/nested-return-type4.rs:4:5: 4:31]` captures the lifetime `'s` as defined here | ||
LL | async move { let _s = s; } | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
help: to declare that `impl Future<Output = impl Sized>` captures `'s`, you can add an explicit `'s` lifetime bound | ||
| | ||
LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future<Output = impl Sized> + 's { | ||
| ++++ | ||
help: to declare that `impl Sized` captures `'s`, you can add an explicit `'s` lifetime bound | ||
| | ||
LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future<Output = impl Sized + 's> { | ||
| ++++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0700`. |