I tries to use syntax::ast::ItemKind
inside lazy_static!
in my compiler plugin:
lazy_static! {
static ref ITEMS: Vec<ItemKind> = Vec::<ItemKind>::new();
}
but get following error:
error[E0275]: overflow evaluating the requirement `std::ptr::Unique<syntax::ast::InlineAsmOutput>: std::marker::Sync`
--> src/lib.in.rs:37:1
|
37 | / lazy_static! {
38 | | static ref ITEMS: Vec<ItemKind> = Vec::<ItemKind>::new();
39 | | }
| |_^
|
= help: consider adding a `#![recursion_limit="128"]` attribute to your crate
= note: required because it appears within the type `alloc::raw_vec::RawVec<syntax::ast::InlineAsmOutput>`
= note: required because it appears within the type `std::vec::Vec<syntax::ast::InlineAsmOutput>`
= note: required because it appears within the type `syntax::ast::InlineAsm`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<syntax::ast::InlineAsm>`
= note: required because it appears within the type `std::boxed::Box<syntax::ast::InlineAsm>`
= note: required because it appears within the type `syntax::ptr::P<syntax::ast::InlineAsm>`
= note: required because it appears within the type `syntax::ast::ExprKind`
= note: required because it appears within the type `syntax::ast::Expr`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<syntax::ast::Expr>`
= note: required because it appears within the type `std::boxed::Box<syntax::ast::Expr>`
= note: required because it appears within the type `syntax::ptr::P<syntax::ast::Expr>`
= note: required because it appears within the type `syntax::ast::ExprKind`
= note: required because it appears within the type `syntax::ast::Expr`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<syntax::ast::Expr>`
= note: required because it appears within the type `std::boxed::Box<syntax::ast::Expr>`
= note: required because it appears within the type `syntax::ptr::P<syntax::ast::Expr>`
= note: required because it appears within the type `syntax::ast::InlineAsmOutput`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<syntax::ast::InlineAsmOutput>`
= note: required because it appears within the type `alloc::raw_vec::RawVec<syntax::ast::InlineAsmOutput>`
= note: required because it appears within the type `std::vec::Vec<syntax::ast::InlineAsmOutput>`
= note: required because it appears within the type `syntax::ast::InlineAsm`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<syntax::ast::InlineAsm>`
= note: required because it appears within the type `std::boxed::Box<syntax::ast::InlineAsm>`
= note: required because it appears within the type `syntax::ptr::P<syntax::ast::InlineAsm>`
= note: required because it appears within the type `syntax::ast::ExprKind`
= note: required because it appears within the type `syntax::ast::Expr`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<syntax::ast::Expr>`
= note: required because it appears within the type `std::boxed::Box<syntax::ast::Expr>`
= note: required because it appears within the type `syntax::ptr::P<syntax::ast::Expr>`
= note: required because it appears within the type `syntax::ast::InlineAsmOutput`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<syntax::ast::InlineAsmOutput>`
= note: required because it appears within the type `alloc::raw_vec::RawVec<syntax::ast::InlineAsmOutput>`
= note: required because it appears within the type `std::vec::Vec<syntax::ast::InlineAsmOutput>`
= note: required because it appears within the type `syntax::ast::InlineAsm`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<syntax::ast::InlineAsm>`
= note: required because it appears within the type `std::boxed::Box<syntax::ast::InlineAsm>`
= note: required because it appears within the type `syntax::ptr::P<syntax::ast::InlineAsm>`
= note: required because it appears within the type `syntax::ast::ExprKind`
= note: required because it appears within the type `syntax::ast::Expr`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<syntax::ast::Expr>`
= note: required because it appears within the type `std::boxed::Box<syntax::ast::Expr>`
= note: required because it appears within the type `syntax::ptr::P<syntax::ast::Expr>`
= note: required because it appears within the type `syntax::ast::TyKind`
= note: required because it appears within the type `syntax::ast::Ty`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<syntax::ast::Ty>`
= note: required because it appears within the type `std::boxed::Box<syntax::ast::Ty>`
= note: required because it appears within the type `syntax::ptr::P<syntax::ast::Ty>`
= note: required because it appears within the type `std::option::Option<syntax::ptr::P<syntax::ast::Ty>>`
= note: required because it appears within the type `syntax::ast::ParenthesizedParameterData`
= note: required because it appears within the type `syntax::ast::PathParameters`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<syntax::ast::PathParameters>`
= note: required because it appears within the type `std::boxed::Box<syntax::ast::PathParameters>`
= note: required because it appears within the type `syntax::ptr::P<syntax::ast::PathParameters>`
= note: required because it appears within the type `std::option::Option<syntax::ptr::P<syntax::ast::PathParameters>>`
= note: required because it appears within the type `syntax::ast::PathSegment`
= note: required because it appears within the type `syntax::ast::ExprKind`
= note: required because it appears within the type `syntax::ast::Expr`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<syntax::ast::Expr>`
= note: required because it appears within the type `std::boxed::Box<syntax::ast::Expr>`
= note: required because it appears within the type `syntax::ptr::P<syntax::ast::Expr>`
= note: required because it appears within the type `syntax::ast::ItemKind`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<syntax::ast::ItemKind>`
= note: required because it appears within the type `alloc::raw_vec::RawVec<syntax::ast::ItemKind>`
= note: required because it appears within the type `std::vec::Vec<syntax::ast::ItemKind>`
= note: required by `lazy_static::lazy::Lazy`
= note: this error originates in a macro outside of the current crate
error: aborting due to previous error
Is this a bug? Is there any workaround? Increasing recursion limit doesn't help.