diff options
| author | bors <bors@rust-lang.org> | 2019-05-22 01:51:31 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-05-22 01:51:31 +0000 |
| commit | dbfe70dfcdb0eab5e1e21f419c718e58cf62029b (patch) | |
| tree | 452e9e1ca7bc89a661fd3c3d5c2d4b1fb79c09b1 /src/libsyntax/ext | |
| parent | 119bbc2056a60e8557d1e5f2e0a7ab46d479bcaf (diff) | |
| parent | 2551a54af1785df544343cbba2e53fcc4c5052ec (diff) | |
| download | rust-dbfe70dfcdb0eab5e1e21f419c718e58cf62029b.tar.gz rust-dbfe70dfcdb0eab5e1e21f419c718e58cf62029b.zip | |
Auto merge of #61027 - Centril:rollup-oewauf1, r=Centril
Rollup of 10 pull requests Successful merges: - #59742 (Move `edition` outside the hygiene lock and avoid accessing it) - #60581 (convert custom try macro to `?`) - #60963 (Update boxed::Box docs on memory layout) - #60973 (Avoid symbol interning in `file_metadata`.) - #60982 (Do not fail on child without DefId) - #60991 (LocalDecl push returns Local len) - #60995 (Add stream_to_parser_with_base_dir) - #60998 (static_assert: make use of anonymous constants) - #61003 (Remove impls for `InternedString`/string equality.) - #61006 (adjust deprecation date of mem::uninitialized) Failed merges: r? @ghost
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/derive.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 8 |
3 files changed, 11 insertions, 9 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 0a88d2f8824..489fac4f1ca 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -5,7 +5,7 @@ use crate::attr::HasAttrs; use crate::source_map::{SourceMap, Spanned, respan}; use crate::edition::Edition; use crate::ext::expand::{self, AstFragment, Invocation}; -use crate::ext::hygiene::{self, Mark, SyntaxContext, Transparency}; +use crate::ext::hygiene::{Mark, SyntaxContext, Transparency}; use crate::mut_visit::{self, MutVisitor}; use crate::parse::{self, parser, DirectoryOwnership}; use crate::parse::token; @@ -713,7 +713,7 @@ impl SyntaxExtension { } } - pub fn edition(&self) -> Edition { + pub fn edition(&self, default_edition: Edition) -> Edition { match *self { SyntaxExtension::NormalTT { edition, .. } | SyntaxExtension::DeclMacro { edition, .. } | @@ -725,7 +725,7 @@ impl SyntaxExtension { SyntaxExtension::IdentTT { .. } | SyntaxExtension::MultiDecorator(..) | SyntaxExtension::MultiModifier(..) | - SyntaxExtension::BuiltinDerive(..) => hygiene::default_edition(), + SyntaxExtension::BuiltinDerive(..) => default_edition, } } } @@ -734,6 +734,7 @@ pub type NamedSyntaxExtension = (Name, SyntaxExtension); pub trait Resolver { fn next_node_id(&mut self) -> ast::NodeId; + fn get_module_scope(&mut self, id: ast::NodeId) -> Mark; fn resolve_dollar_crates(&mut self, fragment: &AstFragment); @@ -768,6 +769,7 @@ pub struct DummyResolver; impl Resolver for DummyResolver { fn next_node_id(&mut self) -> ast::NodeId { ast::DUMMY_NODE_ID } + fn get_module_scope(&mut self, _id: ast::NodeId) -> Mark { Mark::root() } fn resolve_dollar_crates(&mut self, _fragment: &AstFragment) {} diff --git a/src/libsyntax/ext/derive.rs b/src/libsyntax/ext/derive.rs index a24e09f127e..6e789c4c708 100644 --- a/src/libsyntax/ext/derive.rs +++ b/src/libsyntax/ext/derive.rs @@ -1,6 +1,6 @@ use crate::attr::HasAttrs; use crate::ast; -use crate::source_map::{hygiene, ExpnInfo, ExpnFormat}; +use crate::source_map::{ExpnInfo, ExpnFormat}; use crate::ext::base::ExtCtxt; use crate::ext::build::AstBuilder; use crate::parse::parser::PathStyle; @@ -64,7 +64,7 @@ pub fn add_derived_markers<T>(cx: &mut ExtCtxt<'_>, span: Span, traits: &[ast::P ].into()), allow_internal_unsafe: false, local_inner_macros: false, - edition: hygiene::default_edition(), + edition: cx.parse_sess.edition, }); let span = span.with_ctxt(cx.backtrace()); diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 019ebc8566f..478ae4de82b 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -5,7 +5,7 @@ use crate::source_map::{ExpnInfo, MacroBang, MacroAttribute, dummy_spanned, resp use crate::config::StripUnconfigured; use crate::ext::base::*; use crate::ext::derive::{add_derived_markers, collect_derives}; -use crate::ext::hygiene::{self, Mark, SyntaxContext}; +use crate::ext::hygiene::{Mark, SyntaxContext}; use crate::ext::placeholders::{placeholder, PlaceholderExpander}; use crate::feature_gate::{self, Features, GateIssue, is_builtin_attr, emit_feature_err}; use crate::mut_visit::*; @@ -560,7 +560,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { allow_internal_unstable: None, allow_internal_unsafe: false, local_inner_macros: false, - edition: ext.edition(), + edition: ext.edition(self.cx.parse_sess.edition), }); match *ext { @@ -805,7 +805,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { allow_internal_unstable: allow_internal_unstable.clone(), allow_internal_unsafe: false, local_inner_macros: false, - edition: hygiene::default_edition(), + edition: self.cx.parse_sess.edition, }); let input: Vec<_> = mac.node.stream().into_trees().collect(); @@ -921,7 +921,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { allow_internal_unstable: None, allow_internal_unsafe: false, local_inner_macros: false, - edition: ext.edition(), + edition: ext.edition(self.cx.parse_sess.edition), }; match *ext { |
