]> git.proxmox.com Git - rustc.git/blame - src/test/ui/suggestions/issue-79843-impl-trait-with-missing-bounds-on-async-fn.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / suggestions / issue-79843-impl-trait-with-missing-bounds-on-async-fn.rs
CommitLineData
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
7trait Foo {
8 type Bar;
9 fn bar(&self) -> Self::Bar;
10}
11
12async 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
22async 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
30fn assert_is_send<T: Send>(_: &T) {}
31
32fn main() {}