forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#[deny(single_use_lifetimes)] | ||
// edition:2018 | ||
// check-pass | ||
|
||
// Prior to the fix, the compiler complained that the 'a lifetime was only used | ||
// once. This was obviously wrong since the lifetime is used twice: For the s3 | ||
// parameter and the return type. The issue was caused by the compiler | ||
// desugaring the async function into a generator that uses only a single | ||
// lifetime, which then the validator complained about becauase of the | ||
// single_use_lifetimes constraints. | ||
async fn bar<'a>(s1: String, s2: &'_ str, s3: &'a str) -> &'a str { | ||
s3 | ||
} | ||
|
||
fn foo<'a>(s1: String, s2: &'_ str, s3: &'a str) -> &'a str { | ||
s3 | ||
} | ||
|
||
fn main() {} |