serde-deprecated / syntex

No longer maintained
112 stars 34 forks source link

Add syntex::with_extra_stack helper #92

Closed dtolnay closed 8 years ago

dtolnay commented 8 years ago

This is the same workaround from https://github.com/serde-rs/serde/pull/503. I am adding it here because Servo just hit this with quasi_codegen (https://github.com/servo/rust-bindgen/issues/35) and I want to share the code. I will update the serde_codegen implementation to use this too.

Unfortunately we can't apply this to syntex::Registry::expand in general because rustc overflows its stack trying to decide whether syntex::Registry implements Send :panda_face:.

dtolnay commented 8 years ago

Here is the stack overflow: https://gist.github.com/dtolnay/24b84b4bbb20c4e9e6b88473695ae0d0

dtolnay commented 8 years ago

Rustc 1.9.0 gives a much better message.

error: the trait bound `syntex_syntax::ext::base::MultiItemDecorator + 'static: std::marker::Send` is not satisfied [E0277]
note: `syntex_syntax::ext::base::MultiItemDecorator + 'static` cannot be sent between threads safely
note: required because it appears within the type `Box<syntex_syntax::ext::base::MultiItemDecorator + 'static>`
note: required because it appears within the type `syntex_syntax::ext::base::SyntaxExtension`
note: required because it appears within the type `(syntex_syntax::ast::Name, syntex_syntax::ext::base::SyntaxExtension)`
note: required because it appears within the type `alloc::raw_vec::RawVec<(syntex_syntax::ast::Name, syntex_syntax::ext::base::SyntaxExtension)>`
note: required because it appears within the type `std::vec::Vec<(syntex_syntax::ast::Name, syntex_syntax::ext::base::SyntaxExtension)>`
note: required because it appears within the type `syntex::Registry`

Seems legit.

erickt commented 8 years ago

@homu: r+