diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-01-01 19:40:49 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-01-02 19:31:38 +0100 |
| commit | b1aad76586a9816ae577f5338982c4cbcee9a6a5 (patch) | |
| tree | f7d0d3f7ff03c84fabc7839db13fcce341b67e45 /src/libsyntax | |
| parent | 4ff12ce4c14d348dfe53d1f74ab53c878f4fb4f8 (diff) | |
| download | rust-b1aad76586a9816ae577f5338982c4cbcee9a6a5.tar.gz rust-b1aad76586a9816ae577f5338982c4cbcee9a6a5.zip | |
Normalize `syntax::edition` imports.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/feature_gate/check.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/lib.rs | 15 |
2 files changed, 5 insertions, 12 deletions
diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index 4ccec421483..50712058874 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -1,7 +1,6 @@ use crate::ast::{self, AssocTyConstraint, AssocTyConstraintKind, NodeId}; use crate::ast::{GenericParam, GenericParamKind, PatKind, RangeEnd, VariantData}; use crate::attr; -use crate::edition::{Edition, ALL_EDITIONS}; use crate::sess::ParseSess; use crate::visit::{self, FnKind, Visitor}; @@ -14,6 +13,7 @@ use rustc_feature::{Feature, Features, State as FeatureState, UnstableFeatures}; use rustc_feature::{ ACCEPTED_FEATURES, ACTIVE_FEATURES, REMOVED_FEATURES, STABLE_REMOVED_FEATURES, }; +use rustc_span::edition::{Edition, ALL_EDITIONS}; use rustc_span::source_map::Spanned; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{MultiSpan, Span, DUMMY_SP}; diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 3815aa6d774..0b0a19517ec 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -21,7 +21,7 @@ use ast::AttrId; pub use errors; use rustc_data_structures::sync::Lock; use rustc_index::bit_set::GrowableBitSet; -use rustc_span::edition::Edition; +use rustc_span::edition::{Edition, DEFAULT_EDITION}; #[macro_export] macro_rules! unwrap_or { @@ -51,19 +51,13 @@ impl Globals { } } -pub fn with_globals<F, R>(edition: Edition, f: F) -> R -where - F: FnOnce() -> R, -{ +pub fn with_globals<R>(edition: Edition, f: impl FnOnce() -> R) -> R { let globals = Globals::new(edition); GLOBALS.set(&globals, || rustc_span::GLOBALS.set(&globals.rustc_span_globals, f)) } -pub fn with_default_globals<F, R>(f: F) -> R -where - F: FnOnce() -> R, -{ - with_globals(edition::DEFAULT_EDITION, f) +pub fn with_default_globals<R>(f: impl FnOnce() -> R) -> R { + with_globals(DEFAULT_EDITION, f) } scoped_tls::scoped_thread_local!(pub static GLOBALS: Globals); @@ -96,7 +90,6 @@ pub mod mut_visit; pub mod ptr; pub mod show_span; pub use rustc_session::parse as sess; -pub use rustc_span::edition; pub mod token; pub mod tokenstream; pub mod visit; |
