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_pos/lib.rs | |
| 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_pos/lib.rs')
| -rw-r--r-- | src/libsyntax_pos/lib.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index 39859f25f97..cb5aaf7eb88 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -26,6 +26,7 @@ use serialize::{Encodable, Decodable, Encoder, Decoder}; extern crate serialize as rustc_serialize; // used by deriving pub mod edition; +use edition::Edition; pub mod hygiene; pub use hygiene::{Mark, SyntaxContext, ExpnInfo, ExpnFormat, CompilerDesugaringKind}; @@ -52,14 +53,16 @@ pub struct Globals { symbol_interner: Lock<symbol::Interner>, span_interner: Lock<span_encoding::SpanInterner>, hygiene_data: Lock<hygiene::HygieneData>, + edition: Edition, } impl Globals { - pub fn new() -> Globals { + pub fn new(edition: Edition) -> Globals { Globals { symbol_interner: Lock::new(symbol::Interner::fresh()), span_interner: Lock::new(span_encoding::SpanInterner::default()), hygiene_data: Lock::new(hygiene::HygieneData::new()), + edition, } } } @@ -356,8 +359,9 @@ impl Span { /// Edition of the crate from which this span came. pub fn edition(self) -> edition::Edition { - self.ctxt().outer().expn_info().map_or_else(|| hygiene::default_edition(), - |einfo| einfo.edition) + self.ctxt().outer().expn_info().map_or_else(|| { + Edition::from_session() + }, |einfo| einfo.edition) } #[inline] |
