diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2018-03-03 06:24:49 +0100 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2018-03-28 01:27:58 +0200 |
| commit | 3f0cb8ccffa55abd430074cf2b2d785c85c7de54 (patch) | |
| tree | 5d874f9b6dbd8ea0f7da153ddf695b636beb5cfc /src/libsyntax | |
| parent | 11ccc4cac6d1c8fbe27d55714a78e8118c07379c (diff) | |
| download | rust-3f0cb8ccffa55abd430074cf2b2d785c85c7de54.tar.gz rust-3f0cb8ccffa55abd430074cf2b2d785c85c7de54.zip | |
Make SyntaxExtension thread-safe
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 20 | ||||
| -rw-r--r-- | src/libsyntax/lib.rs | 2 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index c3ae0fd2ca8..90459fec670 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -28,7 +28,7 @@ use std::collections::HashMap; use std::iter; use std::path::PathBuf; use std::rc::Rc; -use rustc_data_structures::sync::Lrc; +use rustc_data_structures::sync::{self, Lrc}; use std::default::Default; use tokenstream::{self, TokenStream}; @@ -529,26 +529,26 @@ pub enum SyntaxExtension { /// `#[derive(...)]` is a `MultiItemDecorator`. /// /// Prefer ProcMacro or MultiModifier since they are more flexible. - MultiDecorator(Box<MultiItemDecorator>), + MultiDecorator(Box<MultiItemDecorator + sync::Sync + sync::Send>), /// A syntax extension that is attached to an item and modifies it /// in-place. Also allows decoration, i.e., creating new items. - MultiModifier(Box<MultiItemModifier>), + MultiModifier(Box<MultiItemModifier + sync::Sync + sync::Send>), /// A function-like procedural macro. TokenStream -> TokenStream. - ProcMacro(Box<ProcMacro>), + ProcMacro(Box<ProcMacro + sync::Sync + sync::Send>), /// An attribute-like procedural macro. TokenStream, TokenStream -> TokenStream. /// The first TokenSteam is the attribute, the second is the annotated item. /// Allows modification of the input items and adding new items, similar to /// MultiModifier, but uses TokenStreams, rather than AST nodes. - AttrProcMacro(Box<AttrProcMacro>), + AttrProcMacro(Box<AttrProcMacro + sync::Sync + sync::Send>), /// A normal, function-like syntax extension. /// /// `bytes!` is a `NormalTT`. NormalTT { - expander: Box<TTMacroExpander>, + expander: Box<TTMacroExpander + sync::Sync + sync::Send>, def_info: Option<(ast::NodeId, Span)>, /// Whether the contents of the macro can /// directly use `#[unstable]` things (true == yes). @@ -563,13 +563,15 @@ pub enum SyntaxExtension { /// A function-like syntax extension that has an extra ident before /// the block. /// - IdentTT(Box<IdentMacroExpander>, Option<Span>, bool), + IdentTT(Box<IdentMacroExpander + sync::Sync + sync::Send>, Option<Span>, bool), /// An attribute-like procedural macro. TokenStream -> TokenStream. /// The input is the annotated item. /// Allows generating code to implement a Trait for a given struct /// or enum item. - ProcMacroDerive(Box<MultiItemModifier>, Vec<Symbol> /* inert attribute names */), + ProcMacroDerive(Box<MultiItemModifier + + sync::Sync + + sync::Send>, Vec<Symbol> /* inert attribute names */), /// An attribute-like procedural macro that derives a builtin trait. BuiltinDerive(BuiltinDeriveFn), @@ -577,7 +579,7 @@ pub enum SyntaxExtension { /// A declarative macro, e.g. `macro m() {}`. /// /// The second element is the definition site span. - DeclMacro(Box<TTMacroExpander>, Option<(ast::NodeId, Span)>), + DeclMacro(Box<TTMacroExpander + sync::Sync + sync::Send>, Option<(ast::NodeId, Span)>), } impl SyntaxExtension { diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 74f1ee373ec..ce7fa226b96 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -28,6 +28,8 @@ #![feature(const_atomic_usize_new)] #![feature(rustc_attrs)] +#![recursion_limit="256"] + // See librustc_cratesio_shim/Cargo.toml for a comment explaining this. #[allow(unused_extern_crates)] extern crate rustc_cratesio_shim; |
