guigui64 / guigui64/stybulate

Lib not Send?

Open
#13 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
21
Forks
3
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
Hi I am running this inside of a tokio thread. So it is async. It works when I dont create Cells inside of a for loop over a vec but as soon as I do that to generate the contents array I run into `error[E0277]: `dyn stybulate::Unstyle` cannot be sent between threads safely`

**To Reproduce**
Not easily possible. But basicly it is a tokio::spawn() with a for loop inside that iterates over a vec, creates the row vec and pushes this to a previously created vec which holds all vecs,

**Expected behavior**
It shouldnt cause thread issues

**Toolchain**
- Version: rustc 1.48.0 (7eac88abb 2020-11-16)

Full Log:

```
error[E0277]: `dyn stybulate::Unstyle` cannot be sent between threads safely
--> src/matrix/sync.rs:76:13
|
76 | tokio::spawn(async move {
| ^^^^^^^^^^^^ `dyn stybulate::Unstyle` cannot be sent between threads safely
|
::: /home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.23/src/task/spawn.rs:127:21
|
127 | T: Future + Send + 'static,
| ---- required by this bound in `tokio::spawn`
|
= help: the trait `std::marker::Send` is not implemented for `dyn stybulate::Unstyle`
= note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique`
= note: required because it appears within the type `std::boxed::Box`
= note: required because it appears within the type `stybulate::Cell<'_>`
= note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique>`
= note: required because it appears within the type `alloc::raw_vec::RawVec>`
= note: required because it appears within the type `std::vec::Vec>`
= note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique>>`
= note: required because it appears within the type `alloc::raw_vec::RawVec>>`
= note: required because it appears within the type `std::vec::Vec>>`
= note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21> {std::future::ResumeTy, chrono::NaiveDate, command_parser::CommandParser<'r>, &'s mut command_parser::CommandParser<'t0>, &'t1 config::Config<'t2>, config::Config<'t3>, impl std::future::Future, (), sqlx::Pool, &'t5 str, sqlx::postgres::PgArguments, sqlx::query::Query<'t6, sqlx::Postgres, sqlx::postgres::PgArguments>, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::query::Map<'t8, sqlx::Postgres, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::postgres::PgArguments>, &'t10 sqlx::Pool, impl std::future::Future, std::vec::Vec, std::vec::Vec>>, std::vec::Vec>, std::string::String, matrix_sdk::ruma_events::AnyMessageEventContent, &'t20 mut tokio::sync::mpsc::Sender, tokio::sync::mpsc::Sender, impl std::future::Future}`
= note: required because it appears within the type `[static generator@src/command_parser/mod.rs:519:99: 579:6 for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21> {std::future::ResumeTy, chrono::NaiveDate, command_parser::CommandParser<'r>, &'s mut command_parser::CommandParser<'t0>, &'t1 config::Config<'t2>, config::Config<'t3>, impl std::future::Future, (), sqlx::Pool, &'t5 str, sqlx::postgres::PgArguments, sqlx::query::Query<'t6, sqlx::Postgres, sqlx::postgres::PgArguments>, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::query::Map<'t8, sqlx::Postgres, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::postgres::PgArguments>, &'t10 sqlx::Pool, impl std::future::Future, std::vec::Vec, std::vec::Vec>>, std::vec::Vec>, std::string::String, matrix_sdk::ruma_events::AnyMessageEventContent, &'t20 mut tokio::sync::mpsc::Sender, tokio::sync::mpsc::Sender, impl std::future::Future}]`
= note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12> {std::future::ResumeTy, &'r mut command_parser::CommandParser<'s>, std::vec::Vec<&'t0 str>, std::string::String, tracing::Span, [static generator@src/command_parser/mod.rs:519:99: 579:6 for<'t13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36> {std::future::ResumeTy, chrono::NaiveDate, command_parser::CommandParser<'t13>, &'t14 mut command_parser::CommandParser<'t15>, &'t16 config::Config<'t17>, config::Config<'t18>, impl std::future::Future, (), sqlx::Pool, &'t20 str, sqlx::postgres::PgArguments, sqlx::query::Query<'t21, sqlx::Postgres, sqlx::postgres::PgArguments>, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::query::Map<'t23, sqlx::Postgres, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::postgres::PgArguments>, &'t25 sqlx::Pool, impl std::future::Future, std::vec::Vec, std::vec::Vec>>, std::vec::Vec>, std::string::String, matrix_sdk::ruma_events::AnyMessageEventContent, &'t35 mut tokio::sync::mpsc::Sender, tokio::sync::mpsc::Sender, impl std::future::Future}], impl std::future::Future, tracing_futures::Instrumented, ()}`
= note: required because it appears within the type `[static generator@src/command_parser/mod.rs:518:5: 518:30 for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12> {std::future::ResumeTy, &'r mut command_parser::CommandParser<'s>, std::vec::Vec<&'t0 str>, std::string::String, tracing::Span, [static generator@src/command_parser/mod.rs:519:99: 579:6 for<'t13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36> {std::future::ResumeTy, chrono::NaiveDate, command_parser::CommandParser<'t13>, &'t14 mut command_parser::CommandParser<'t15>, &'t16 config::Config<'t17>, config::Config<'t18>, impl std::future::Future, (), sqlx::Pool, &'t20 str, sqlx::postgres::PgArguments, sqlx::query::Query<'t21, sqlx::Postgres, sqlx::postgres::PgArguments>, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::query::Map<'t23, sqlx::Postgres, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::postgres::PgArguments>, &'t25 sqlx::Pool, impl std::future::Future, std::vec::Vec, std::vec::Vec>>, std::vec::Vec>, std::string::String, matrix_sdk::ruma_events::AnyMessageEventContent, &'t35 mut tokio::sync::mpsc::Sender, tokio::sync::mpsc::Sender, impl std::future::Future}], impl std::future::Future, tracing_futures::Instrumented, ()}]`
= note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@src/command_parser/mod.rs:518:5: 518:30 for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12> {std::future::ResumeTy, &'r mut command_parser::CommandParser<'s>, std::vec::Vec<&'t0 str>, std::string::String, tracing::Span, [static generator@src/command_parser/mod.rs:519:99: 579:6 for<'t13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36> {std::future::ResumeTy, chrono::NaiveDate, command_parser::CommandParser<'t13>, &'t14 mut command_parser::CommandParser<'t15>, &'t16 config::Config<'t17>, config::Config<'t18>, impl std::future::Future, (), sqlx::Pool, &'t20 str, sqlx::postgres::PgArguments, sqlx::query::Query<'t21, sqlx::Postgres, sqlx::postgres::PgArguments>, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::query::Map<'t23, sqlx::Postgres, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::postgres::PgArguments>, &'t25 sqlx::Pool, impl std::future::Future, std::vec::Vec, std::vec::Vec>>, std::vec::Vec>, std::string::String, matrix_sdk::ruma_events::AnyMessageEventContent, &'t35 mut tokio::sync::mpsc::Sender, tokio::sync::mpsc::Sender, impl std::future::Future}], impl std::future::Future, tracing_futures::Instrumented, ()}]>`
= note: required because it appears within the type `impl std::future::Future`
= note: required because it appears within the type `impl std::future::Future`
= note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36, 't37, 't38, 't39, 't40> {std::future::ResumeTy, std::str::SplitWhitespace<'r>, &'s str, bool, &'t0 mut command_parser::CommandParser<'t1>, impl std::future::Future, (), impl std::future::Future, &'t8 std::string::String, std::string::String, impl std::future::Future, std::vec::Vec<&'t12 str>, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future}`
= note: required because it appears within the type `[static generator@src/command_parser/mod.rs:616:34: 670:6 for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36, 't37, 't38, 't39, 't40> {std::future::ResumeTy, std::str::SplitWhitespace<'r>, &'s str, bool, &'t0 mut command_parser::CommandParser<'t1>, impl std::future::Future, (), impl std::future::Future, &'t8 std::string::String, std::string::String, impl std::future::Future, std::vec::Vec<&'t12 str>, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future}]`
= note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8> {std::future::ResumeTy, &'r mut command_parser::CommandParser<'s>, std::string::String, tracing::Span, [static generator@src/command_parser/mod.rs:616:34: 670:6 for<'t9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36, 't37, 't38, 't39, 't40, 't41, 't42, 't43, 't44, 't45, 't46, 't47, 't48, 't49, 't50, 't51> {std::future::ResumeTy, std::str::SplitWhitespace<'t9>, &'t10 str, bool, &'t11 mut command_parser::CommandParser<'t12>, impl std::future::Future, (), impl std::future::Future, &'t19 std::string::String, std::string::String, impl std::future::Future, std::vec::Vec<&'t23 str>, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future}], impl std::future::Future, tracing_futures::Instrumented, ()}`
= note: required because it appears within the type `[static generator@src/command_parser/mod.rs:610:5: 610:30 for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8> {std::future::ResumeTy, &'r mut command_parser::CommandParser<'s>, std::string::String, tracing::Span, [static generator@src/command_parser/mod.rs:616:34: 670:6 for<'t9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36, 't37, 't38, 't39, 't40, 't41, 't42, 't43, 't44, 't45, 't46, 't47, 't48, 't49, 't50, 't51> {std::future::ResumeTy, std::str::SplitWhitespace<'t9>, &'t10 str, bool, &'t11 mut command_parser::CommandParser<'t12>, impl std::future::Future, (), impl std::future::Future, &'t19 std::string::String, std::string::String, impl std::future::Future, std::vec::Vec<&'t23 str>, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future}], impl std::future::Future, tracing_futures::Instrumented, ()}]`
= note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@src/command_parser/mod.rs:610:5: 610:30 for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8> {std::future::ResumeTy, &'r mut command_parser::CommandParser<'s>, std::string::String, tracing::Span, [static generator@src/command_parser/mod.rs:616:34: 670:6 for<'t9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36, 't37, 't38, 't39, 't40, 't41, 't42, 't43, 't44, 't45, 't46, 't47, 't48, 't49, 't50, 't51> {std::future::ResumeTy, std::str::SplitWhitespace<'t9>, &'t10 str, bool, &'t11 mut command_parser::CommandParser<'t12>, impl std::future::Future, (), impl std::future::Future, &'t19 std::string::String, std::string::String, impl std::future::Future, std::vec::Vec<&'t23 str>, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future}], impl std::future::Future, tracing_futures::Instrumented, ()}]>`
= note: required because it appears within the type `impl std::future::Future`
= note: required because it appears within the type `impl std::future::Future`
= note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7> {std::future::ResumeTy, &'r mut command_parser::CommandParser<'s>, command_parser::CommandParser<'t0>, std::string::String, impl std::future::Future, (), std::result::Result<(), errors::ParseErrors>, errors::ParseErrors, &'t4 matrix_sdk::Client, matrix_sdk::Client, matrix_sdk::ruma_identifiers::RoomId, &'t5 matrix_sdk::ruma_identifiers::RoomId, matrix_sdk::ruma_events::room::message::MessageEventContent, matrix_sdk::ruma_events::AnyMessageEventContent, std::option::Option, impl std::future::Future}`
= note: required because it appears within the type `[static generator@src/matrix/sync.rs:76:37: 97:14 for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7> {std::future::ResumeTy, &'r mut command_parser::CommandParser<'s>, command_parser::CommandParser<'t0>, std::string::String, impl std::future::Future, (), std::result::Result<(), errors::ParseErrors>, errors::ParseErrors, &'t4 matrix_sdk::Client, matrix_sdk::Client, matrix_sdk::ruma_identifiers::RoomId, &'t5 matrix_sdk::ruma_identifiers::RoomId, matrix_sdk::ruma_events::room::message::MessageEventContent, matrix_sdk::ruma_events::AnyMessageEventContent, std::option::Option, impl std::future::Future}]`
= note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@src/matrix/sync.rs:76:37: 97:14 for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7> {std::future::ResumeTy, &'r mut command_parser::CommandParser<'s>, command_parser::CommandParser<'t0>, std::string::String, impl std::future::Future, (), std::result::Result<(), errors::ParseErrors>, errors::ParseErrors, &'t4 matrix_sdk::Client, matrix_sdk::Client, matrix_sdk::ruma_identifiers::RoomId, &'t5 matrix_sdk::ruma_identifiers::RoomId, matrix_sdk::ruma_events::room::message::MessageEventContent, matrix_sdk::ruma_events::AnyMessageEventContent, std::option::Option, impl std::future::Future}]>`
= note: required because it appears within the type `impl std::future::Future`
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.