Closed deep110 closed 3 years ago
Please show a minimum example to reproduce your issue. Thanks.
@xu-cheng Sure,
You can try to create a katex::Opts
struct in lazy_static
lazy_static! {
static ref katex_opts: katex::Opts = katex::Opts::builder()
.display_mode(true)
.output_type(katex::OutputType::Html)
.throw_on_error(false)
.build()
.unwrap();
}
You get the same stacktrace, since lazy_static also requires Sync trait to be implemented.
error[E0277]: `(dyn for<'r> std::ops::Fn(katex::TrustContext<'r>) -> bool + std::panic::RefUnwindSafe + 'static)` cannot be sent between threads safely
|
11 | / lazy_static! {
12 | | static ref katex_opts: katex::Opts = katex::Opts::builder()
13 | | .display_mode(true)
14 | | .output_type(katex::OutputType::Html)
... |
18 | |
19 | | }
| |_^ `(dyn for<'r> std::ops::Fn(katex::TrustContext<'r>) -> bool + std::panic::RefUnwindSafe + 'static)` cannot be sent between threads safely
pub struct Lazy<T: Sync>(Cell<Option<T>>, Once);
| ---- required by this bound in `lazy_static::lazy::Lazy`
|
= help: the trait `std::marker::Send` is not implemented for `(dyn for<'r> std::ops::Fn(katex::TrustContext<'r>) -> bool + std::panic::RefUnwindSafe + 'static)`
First of all, thanks for this great crate.
I am encountering an error when using this where Sync is also required.
Detailed stacktrace: