mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2024-11-24 07:40:19 +00:00
dcc1db841e
error: future cannot be sent between threads safely --> tests/cxx_string.rs:14:5 | 13 | fn assert_send(_: impl Send) {} | ---- required by this bound in `assert_send` 14 | assert_send(f()); | ^^^^^^^^^^^ future returned by `f` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `*const ()` note: future is not `Send` as this value is used across an await --> tests/cxx_string.rs:9:9 | 6 | let_cxx_string!(s = "..."); | --------------------------- has type `StackString` which is not `Send` ... 9 | g(&s).await; | ^^^^^^^^^^^ await occurs here, with `mut $var` maybe used later 10 | } | - `mut $var` is later dropped here
16 lines
306 B
Rust
16 lines
306 B
Rust
use cxx::{let_cxx_string, CxxString};
|
|
|
|
#[test]
|
|
fn test_async_cxx_string() {
|
|
async fn f() {
|
|
let_cxx_string!(s = "...");
|
|
|
|
async fn g(_: &CxxString) {}
|
|
g(&s).await;
|
|
}
|
|
|
|
// https://github.com/dtolnay/cxx/issues/693
|
|
fn assert_send(_: impl Send) {}
|
|
assert_send(f());
|
|
}
|