-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use RegionNameHighlight for async fn and closure returns
- Loading branch information
Showing
7 changed files
with
173 additions
and
39 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
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,19 @@ | ||
// edition:2018 | ||
|
||
// test that names give to anonymous lifetimes in opaque types like `impl Future` are correctly | ||
// introduced in error messages | ||
|
||
use std::future::Future; | ||
|
||
pub async fn foo<F, T>(_: F) | ||
where | ||
F: Fn(&u8) -> T, | ||
T: Future<Output = ()>, | ||
{ | ||
} | ||
|
||
pub async fn bar(_: &u8) {} | ||
|
||
fn main() { | ||
let _ = foo(|x| bar(x)); //~ ERROR lifetime may not live long enough | ||
} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/async-await/issue-74497-lifetime-in-opaque.stderr
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,11 @@ | ||
error: lifetime may not live long enough | ||
--> $DIR/issue-74497-lifetime-in-opaque.rs:18:21 | ||
| | ||
LL | let _ = foo(|x| bar(x)); | ||
| -- ^^^^^^ returning this value requires that `'1` must outlive `'2` | ||
| || | ||
| |return type of closure `impl Future` contains a lifetime `'2` | ||
| has type `&'1 u8` | ||
|
||
error: aborting due to previous error | ||
|
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