]> git.lizzy.rs Git - rust.git/blob - tests/ui/issue_4266.rs
Auto merge of #4266 - uHOOCCOOHu:fix/async_fn_lifetime, r=flip1995
[rust.git] / tests / ui / issue_4266.rs
1 // compile-flags: --edition 2018
2 #![feature(async_await)]
3 #![allow(dead_code)]
4
5 async fn sink1<'a>(_: &'a str) {} // lint
6 async fn sink1_elided(_: &str) {} // ok
7
8 // lint
9 async fn one_to_one<'a>(s: &'a str) -> &'a str {
10     s
11 }
12
13 // ok
14 async fn one_to_one_elided(s: &str) -> &str {
15     s
16 }
17
18 // ok
19 async fn all_to_one<'a>(a: &'a str, _b: &'a str) -> &'a str {
20     a
21 }
22
23 // async fn unrelated(_: &str, _: &str) {} // Not allowed in async fn
24
25 // #3988
26 struct Foo;
27 impl Foo {
28     // ok
29     pub async fn foo(&mut self) {}
30 }
31
32 // rust-lang/rust#61115
33 // ok
34 async fn print(s: &str) {
35     println!("{}", s);
36 }
37
38 fn main() {}