mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2024-11-27 17:30:38 +00:00
Improve async fn error message with link to workaround
This commit is contained in:
parent
7c5c7bef34
commit
8de461f44a
@ -373,6 +373,12 @@ fn parse_extern_fn(
|
||||
"variadic function is not supported yet",
|
||||
));
|
||||
}
|
||||
if foreign_fn.sig.asyncness.is_some() {
|
||||
return Err(Error::new_spanned(
|
||||
foreign_fn,
|
||||
"async function is not directly supported yet, but see https://cxx.rs/async.html for a working approach",
|
||||
));
|
||||
}
|
||||
|
||||
let mut doc = Doc::new();
|
||||
let mut cxx_name = None;
|
||||
|
@ -1,22 +1,5 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/async_fn.rs:4:18
|
||||
error: async function is not directly supported yet, but see https://cxx.rs/async.html for a working approach
|
||||
--> $DIR/async_fn.rs:4:9
|
||||
|
|
||||
4 | async fn f();
|
||||
| ^
|
||||
| |
|
||||
| expected `()`, found opaque type
|
||||
| possibly return type missing here?
|
||||
...
|
||||
8 | async fn f() {}
|
||||
| - the `Output` of this `async fn`'s found opaque type
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found opaque type `impl Future`
|
||||
help: consider `await`ing on the `Future`
|
||||
|
|
||||
4 | async fn f.await();
|
||||
| ^^^^^^
|
||||
help: try adding a semicolon
|
||||
|
|
||||
4 | async fn f;();
|
||||
| ^
|
||||
| ^^^^^^^^^^^^^
|
||||
|
Loading…
Reference in New Issue
Block a user