diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-07-06 21:02:45 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-07-11 00:12:57 +0300 |
| commit | 99c7432896bbfdab1f7f70f8d763cab5f3efe64a (patch) | |
| tree | a2865fec34b7b001c5353c498706cf991a7befc5 /src/libsyntax/ext/base.rs | |
| parent | d1949b1ab01dbd482008f64af54161cc43bb0991 (diff) | |
| download | rust-99c7432896bbfdab1f7f70f8d763cab5f3efe64a.tar.gz rust-99c7432896bbfdab1f7f70f8d763cab5f3efe64a.zip | |
hygiene: Introduce a helper method for creating new expansions
Creating a fresh expansion and immediately generating a span from it is the most common scenario. Also avoid allocating `allow_internal_unstable` lists for derive markers repeatedly. And rename `ExpnInfo::with_unstable` to `ExpnInfo::allow_unstable`, seems to be a better fitting name.
Diffstat (limited to 'src/libsyntax/ext/base.rs')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index cb4edee30cd..37d5885db60 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -721,6 +721,7 @@ pub struct ExtCtxt<'a> { pub resolver: &'a mut dyn Resolver, pub current_expansion: ExpansionData, pub expansions: FxHashMap<Span, Vec<String>>, + pub allow_derive_markers: Lrc<[Symbol]>, } impl<'a> ExtCtxt<'a> { @@ -740,6 +741,7 @@ impl<'a> ExtCtxt<'a> { directory_ownership: DirectoryOwnership::Owned { relative: None }, }, expansions: FxHashMap::default(), + allow_derive_markers: [sym::rustc_attrs, sym::structural_match][..].into(), } } |
