Skip to content

Commit 0696c28

Browse files
committed
test for issue #77175
1 parent 82f1f50 commit 0696c28

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Diff for: src/test/ui/lifetimes/issue-77175.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#[deny(single_use_lifetimes)]
2+
// edition:2018
3+
// check-pass
4+
5+
// Prior to the fix, the compiler complained that the 'a lifetime was only used
6+
// once. This was obviously wrong since the lifetime is used twice: For the s3
7+
// parameter and the return type. The issue was caused by the compiler
8+
// desugaring the async function into a generator that uses only a single
9+
// lifetime, which then the validator complained about becauase of the
10+
// single_use_lifetimes constraints.
11+
async fn bar<'a>(s1: String, s2: &'_ str, s3: &'a str) -> &'a str {
12+
s3
13+
}
14+
15+
fn foo<'a>(s1: String, s2: &'_ str, s3: &'a str) -> &'a str {
16+
s3
17+
}
18+
19+
fn main() {}

0 commit comments

Comments
 (0)