]>
Commit | Line | Data |
---|---|---|
fc512014 XL |
1 | // Regression test: if we suggest replacing an `impl Trait` argument to an async |
2 | // fn with a named type parameter in order to add bounds, the suggested function | |
3 | // signature should be well-formed. | |
4 | // | |
5 | // edition:2018 | |
6 | ||
7 | trait Foo { | |
8 | type Bar; | |
9 | fn bar(&self) -> Self::Bar; | |
10 | } | |
11 | ||
12 | async fn run(_: &(), foo: impl Foo) -> std::io::Result<()> { | |
13 | let bar = foo.bar(); | |
14 | assert_is_send(&bar); | |
15 | //~^ ERROR: `<impl Foo as Foo>::Bar` cannot be sent between threads safely | |
16 | ||
17 | Ok(()) | |
18 | } | |
19 | ||
20 | // Test our handling of cases where there is a generic parameter list in the | |
21 | // source, but only synthetic generic parameters | |
22 | async fn run2< >(_: &(), foo: impl Foo) -> std::io::Result<()> { | |
23 | let bar = foo.bar(); | |
24 | assert_is_send(&bar); | |
25 | //~^ ERROR: `<impl Foo as Foo>::Bar` cannot be sent between threads safely | |
26 | ||
27 | Ok(()) | |
28 | } | |
29 | ||
30 | fn assert_is_send<T: Send>(_: &T) {} | |
31 | ||
32 | fn main() {} |