1
Fork 0

Normalize syntax::edition imports.

This commit is contained in:
Mazdak Farrokhzad 2020-01-01 19:40:49 +01:00
parent 4ff12ce4c1
commit b1aad76586
22 changed files with 28 additions and 34 deletions

View file

@ -9,11 +9,11 @@ use crate::middle::stability;
use crate::session::Session; use crate::session::Session;
use errors::{pluralize, Applicability, DiagnosticBuilder}; use errors::{pluralize, Applicability, DiagnosticBuilder};
use rustc_session::declare_lint; use rustc_session::declare_lint;
use rustc_span::edition::Edition;
use rustc_span::source_map::Span; use rustc_span::source_map::Span;
use rustc_span::symbol::Symbol; use rustc_span::symbol::Symbol;
use syntax::ast; use syntax::ast;
use syntax::early_buffered_lints::{ILL_FORMED_ATTRIBUTE_INPUT, META_VARIABLE_MISUSE}; use syntax::early_buffered_lints::{ILL_FORMED_ATTRIBUTE_INPUT, META_VARIABLE_MISUSE};
use syntax::edition::Edition;
declare_lint! { declare_lint! {
pub EXCEEDING_BITSHIFTS, pub EXCEEDING_BITSHIFTS,

View file

@ -15,9 +15,9 @@ use crate::deriving::*;
use rustc_expand::base::{MacroExpanderFn, Resolver, SyntaxExtension, SyntaxExtensionKind}; use rustc_expand::base::{MacroExpanderFn, Resolver, SyntaxExtension, SyntaxExtensionKind};
use rustc_expand::proc_macro::BangProcMacro; use rustc_expand::proc_macro::BangProcMacro;
use rustc_span::edition::Edition;
use rustc_span::symbol::sym; use rustc_span::symbol::sym;
use syntax::ast::Ident; use syntax::ast::Ident;
use syntax::edition::Edition;
mod asm; mod asm;
mod assert; mod assert;

View file

@ -1,9 +1,9 @@
use rustc_expand::base::{ExtCtxt, Resolver}; use rustc_expand::base::{ExtCtxt, Resolver};
use rustc_expand::expand::ExpansionConfig; use rustc_expand::expand::ExpansionConfig;
use rustc_span::edition::Edition;
use rustc_span::hygiene::AstPass; use rustc_span::hygiene::AstPass;
use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::DUMMY_SP; use rustc_span::DUMMY_SP;
use syntax::edition::Edition;
use syntax::ptr::P; use syntax::ptr::P;
use syntax::sess::ParseSess; use syntax::sess::ParseSess;
use syntax::{ast, attr}; use syntax::{ast, attr};

View file

@ -1,11 +1,11 @@
use crate::expand::{self, AstFragment, Invocation}; use crate::expand::{self, AstFragment, Invocation};
use rustc_parse::{self, parser, DirectoryOwnership, MACRO_ARGUMENTS}; use rustc_parse::{self, parser, DirectoryOwnership, MACRO_ARGUMENTS};
use rustc_span::edition::Edition;
use rustc_span::source_map::SourceMap; use rustc_span::source_map::SourceMap;
use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::symbol::{kw, sym, Ident, Symbol};
use syntax::ast::{self, Attribute, Name, NodeId, PatKind}; use syntax::ast::{self, Attribute, Name, NodeId, PatKind};
use syntax::attr::{self, Deprecation, HasAttrs, Stability}; use syntax::attr::{self, Deprecation, HasAttrs, Stability};
use syntax::edition::Edition;
use syntax::mut_visit::{self, MutVisitor}; use syntax::mut_visit::{self, MutVisitor};
use syntax::ptr::P; use syntax::ptr::P;
use syntax::sess::ParseSess; use syntax::sess::ParseSess;

View file

@ -11,12 +11,12 @@ use crate::mbe::transcribe::transcribe;
use rustc_feature::Features; use rustc_feature::Features;
use rustc_parse::parser::Parser; use rustc_parse::parser::Parser;
use rustc_parse::Directory; use rustc_parse::Directory;
use rustc_span::edition::Edition;
use rustc_span::hygiene::Transparency; use rustc_span::hygiene::Transparency;
use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::symbol::{kw, sym, Symbol};
use rustc_span::Span; use rustc_span::Span;
use syntax::ast; use syntax::ast;
use syntax::attr::{self, TransparencyError}; use syntax::attr::{self, TransparencyError};
use syntax::edition::Edition;
use syntax::print::pprust; use syntax::print::pprust;
use syntax::sess::ParseSess; use syntax::sess::ParseSess;
use syntax::token::{self, NtTT, Token, TokenKind::*}; use syntax::token::{self, NtTT, Token, TokenKind::*};

View file

@ -12,13 +12,13 @@ use rustc::session::search_paths::SearchPath;
use rustc::session::{build_session, Session}; use rustc::session::{build_session, Session};
use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::fx::FxHashSet;
use rustc_errors::{emitter::HumanReadableErrorType, registry, ColorConfig}; use rustc_errors::{emitter::HumanReadableErrorType, registry, ColorConfig};
use rustc_span::edition::{Edition, DEFAULT_EDITION};
use rustc_span::symbol::sym; use rustc_span::symbol::sym;
use rustc_target::spec::{MergeFunctions, PanicStrategy, RelroLevel}; use rustc_target::spec::{MergeFunctions, PanicStrategy, RelroLevel};
use std::collections::{BTreeMap, BTreeSet}; use std::collections::{BTreeMap, BTreeSet};
use std::iter::FromIterator; use std::iter::FromIterator;
use std::path::PathBuf; use std::path::PathBuf;
use syntax; use syntax;
use syntax::edition::{Edition, DEFAULT_EDITION};
type CfgSpecs = FxHashSet<(String, Option<String>)>; type CfgSpecs = FxHashSet<(String, Option<String>)>;

View file

@ -37,12 +37,12 @@ use rustc::util::nodemap::FxHashSet;
use rustc_feature::Stability; use rustc_feature::Stability;
use rustc_feature::{deprecated_attributes, AttributeGate, AttributeTemplate, AttributeType}; use rustc_feature::{deprecated_attributes, AttributeGate, AttributeTemplate, AttributeType};
use rustc_span::edition::Edition;
use rustc_span::source_map::Spanned; use rustc_span::source_map::Spanned;
use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::symbol::{kw, sym, Symbol};
use rustc_span::{BytePos, Span}; use rustc_span::{BytePos, Span};
use syntax::ast::{self, Expr}; use syntax::ast::{self, Expr};
use syntax::attr::{self, HasAttrs}; use syntax::attr::{self, HasAttrs};
use syntax::edition::Edition;
use syntax::errors::{Applicability, DiagnosticBuilder}; use syntax::errors::{Applicability, DiagnosticBuilder};
use syntax::print::pprust::{self, expr_to_string}; use syntax::print::pprust::{self, expr_to_string};
use syntax::ptr::P; use syntax::ptr::P;

View file

@ -23,11 +23,11 @@ use std::{cmp, fs};
use log::{debug, info, log_enabled}; use log::{debug, info, log_enabled};
use proc_macro::bridge::client::ProcMacro; use proc_macro::bridge::client::ProcMacro;
use rustc_expand::base::SyntaxExtension; use rustc_expand::base::SyntaxExtension;
use rustc_span::edition::Edition;
use rustc_span::symbol::{sym, Symbol}; use rustc_span::symbol::{sym, Symbol};
use rustc_span::{Span, DUMMY_SP}; use rustc_span::{Span, DUMMY_SP};
use syntax::ast; use syntax::ast;
use syntax::attr; use syntax::attr;
use syntax::edition::Edition;
use syntax::expand::allocator::{global_allocator_spans, AllocatorKind}; use syntax::expand::allocator::{global_allocator_spans, AllocatorKind};
use syntax::span_fatal; use syntax::span_fatal;

View file

@ -15,10 +15,10 @@ use rustc_data_structures::svh::Svh;
use rustc_data_structures::sync::MetadataRef; use rustc_data_structures::sync::MetadataRef;
use rustc_index::vec::IndexVec; use rustc_index::vec::IndexVec;
use rustc_serialize::opaque::Encoder; use rustc_serialize::opaque::Encoder;
use rustc_span::edition::Edition;
use rustc_span::symbol::Symbol; use rustc_span::symbol::Symbol;
use rustc_span::{self, Span}; use rustc_span::{self, Span};
use rustc_target::spec::{PanicStrategy, TargetTriple}; use rustc_target::spec::{PanicStrategy, TargetTriple};
use syntax::edition::Edition;
use syntax::{ast, attr}; use syntax::{ast, attr};
use std::marker::PhantomData; use std::marker::PhantomData;

View file

@ -11,12 +11,12 @@
use crate::{parse_in, validate_attr}; use crate::{parse_in, validate_attr};
use rustc_errors::Applicability; use rustc_errors::Applicability;
use rustc_feature::Features; use rustc_feature::Features;
use rustc_span::edition::Edition;
use rustc_span::symbol::sym; use rustc_span::symbol::sym;
use rustc_span::Span; use rustc_span::Span;
use syntax::ast::{self, AttrItem, Attribute, MetaItem}; use syntax::ast::{self, AttrItem, Attribute, MetaItem};
use syntax::attr; use syntax::attr;
use syntax::attr::HasAttrs; use syntax::attr::HasAttrs;
use syntax::edition::Edition;
use syntax::feature_gate::{feature_err, get_features}; use syntax::feature_gate::{feature_err, get_features};
use syntax::mut_visit::*; use syntax::mut_visit::*;
use syntax::ptr::P; use syntax::ptr::P;

View file

@ -17,12 +17,12 @@ use rustc_expand::base::{self, Indeterminate, InvocationRes};
use rustc_expand::compile_declarative_macro; use rustc_expand::compile_declarative_macro;
use rustc_expand::expand::{AstFragment, AstFragmentKind, Invocation, InvocationKind}; use rustc_expand::expand::{AstFragment, AstFragmentKind, Invocation, InvocationKind};
use rustc_feature::is_builtin_attr_name; use rustc_feature::is_builtin_attr_name;
use rustc_span::edition::Edition;
use rustc_span::hygiene::{self, ExpnData, ExpnId, ExpnKind}; use rustc_span::hygiene::{self, ExpnData, ExpnId, ExpnKind};
use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::symbol::{kw, sym, Symbol};
use rustc_span::{Span, DUMMY_SP}; use rustc_span::{Span, DUMMY_SP};
use syntax::ast::{self, Ident, NodeId}; use syntax::ast::{self, Ident, NodeId};
use syntax::attr::{self, StabilityLevel}; use syntax::attr::{self, StabilityLevel};
use syntax::edition::Edition;
use syntax::feature_gate::feature_err; use syntax::feature_gate::feature_err;
use syntax::print::pprust; use syntax::print::pprust;

View file

@ -15,8 +15,8 @@ use rustc::session::config::{parse_crate_types_from_list, parse_externs, CrateTy
use rustc::session::config::{CodegenOptions, DebuggingOptions, ErrorOutputType, Externs}; use rustc::session::config::{CodegenOptions, DebuggingOptions, ErrorOutputType, Externs};
use rustc::session::search_paths::SearchPath; use rustc::session::search_paths::SearchPath;
use rustc_driver; use rustc_driver;
use rustc_span::edition::{Edition, DEFAULT_EDITION};
use rustc_target::spec::TargetTriple; use rustc_target::spec::TargetTriple;
use syntax::edition::{Edition, DEFAULT_EDITION};
use crate::core::new_handler; use crate::core::new_handler;
use crate::externalfiles::ExternalHtml; use crate::externalfiles::ExternalHtml;

View file

@ -1,5 +1,5 @@
use crate::html::markdown::{ErrorCodes, IdMap, Markdown, Playground}; use crate::html::markdown::{ErrorCodes, IdMap, Markdown, Playground};
use crate::syntax::edition::Edition; use crate::rustc_span::edition::Edition;
use errors; use errors;
use rustc_feature::UnstableFeatures; use rustc_feature::UnstableFeatures;
use std::fs; use std::fs;

View file

@ -5,9 +5,9 @@
//! ``` //! ```
//! #![feature(rustc_private)] //! #![feature(rustc_private)]
//! //!
//! extern crate syntax; //! extern crate rustc_span;
//! //!
//! use syntax::edition::Edition; //! use rustc_span::edition::Edition;
//! use rustdoc::html::markdown::{IdMap, Markdown, ErrorCodes}; //! use rustdoc::html::markdown::{IdMap, Markdown, ErrorCodes};
//! //!
//! let s = "My *markdown* _text_"; //! let s = "My *markdown* _text_";
@ -20,6 +20,7 @@
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::fx::FxHashMap;
use rustc_span::edition::Edition;
use std::borrow::Cow; use std::borrow::Cow;
use std::cell::RefCell; use std::cell::RefCell;
use std::collections::VecDeque; use std::collections::VecDeque;
@ -27,7 +28,6 @@ use std::default::Default;
use std::fmt::Write; use std::fmt::Write;
use std::ops::Range; use std::ops::Range;
use std::str; use std::str;
use syntax::edition::Edition;
use crate::html::highlight; use crate::html::highlight;
use crate::html::toc::TocBuilder; use crate::html::toc::TocBuilder;

View file

@ -1,7 +1,7 @@
use super::plain_summary_line; use super::plain_summary_line;
use super::{ErrorCodes, IdMap, Ignore, LangString, Markdown, MarkdownHtml}; use super::{ErrorCodes, IdMap, Ignore, LangString, Markdown, MarkdownHtml};
use rustc_span::edition::{Edition, DEFAULT_EDITION};
use std::cell::RefCell; use std::cell::RefCell;
use syntax::edition::{Edition, DEFAULT_EDITION};
#[test] #[test]
fn test_unique_id() { fn test_unique_id() {

View file

@ -50,13 +50,13 @@ use rustc::middle::stability;
use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc::util::nodemap::{FxHashMap, FxHashSet};
use rustc_data_structures::flock; use rustc_data_structures::flock;
use rustc_feature::UnstableFeatures; use rustc_feature::UnstableFeatures;
use rustc_span::edition::Edition;
use rustc_span::hygiene::MacroKind; use rustc_span::hygiene::MacroKind;
use rustc_span::source_map::FileName; use rustc_span::source_map::FileName;
use rustc_span::symbol::{sym, Symbol}; use rustc_span::symbol::{sym, Symbol};
use serde::ser::SerializeSeq; use serde::ser::SerializeSeq;
use serde::{Serialize, Serializer}; use serde::{Serialize, Serializer};
use syntax::ast; use syntax::ast;
use syntax::edition::Edition;
use syntax::print::pprust; use syntax::print::pprust;
use crate::clean::{self, AttributesExt, Deprecation, GetDefId, SelfTy}; use crate::clean::{self, AttributesExt, Deprecation, GetDefId, SelfTy};

View file

@ -4,8 +4,8 @@ use std::path::PathBuf;
use errors; use errors;
use rustc_feature::UnstableFeatures; use rustc_feature::UnstableFeatures;
use rustc_span::edition::Edition;
use rustc_span::source_map::DUMMY_SP; use rustc_span::source_map::DUMMY_SP;
use syntax::edition::Edition;
use testing; use testing;
use crate::config::{Options, RenderOptions}; use crate::config::{Options, RenderOptions};

View file

@ -5,6 +5,7 @@ use rustc::util::common::ErrorReported;
use rustc_data_structures::sync::Lrc; use rustc_data_structures::sync::Lrc;
use rustc_feature::UnstableFeatures; use rustc_feature::UnstableFeatures;
use rustc_interface::interface; use rustc_interface::interface;
use rustc_span::edition::Edition;
use rustc_span::source_map::SourceMap; use rustc_span::source_map::SourceMap;
use rustc_span::symbol::sym; use rustc_span::symbol::sym;
use rustc_span::{BytePos, FileName, Pos, Span, DUMMY_SP}; use rustc_span::{BytePos, FileName, Pos, Span, DUMMY_SP};
@ -16,7 +17,6 @@ use std::path::PathBuf;
use std::process::{self, Command, Stdio}; use std::process::{self, Command, Stdio};
use std::str; use std::str;
use syntax::ast; use syntax::ast;
use syntax::edition::Edition;
use syntax::with_globals; use syntax::with_globals;
use tempfile::Builder as TempFileBuilder; use tempfile::Builder as TempFileBuilder;
use testing; use testing;

View file

@ -1,5 +1,5 @@
use super::{make_test, TestOptions}; use super::{make_test, TestOptions};
use syntax::edition::DEFAULT_EDITION; use rustc_span::edition::DEFAULT_EDITION;
#[test] #[test]
fn make_test_basic() { fn make_test_basic() {

View file

@ -1,7 +1,6 @@
use crate::ast::{self, AssocTyConstraint, AssocTyConstraintKind, NodeId}; use crate::ast::{self, AssocTyConstraint, AssocTyConstraintKind, NodeId};
use crate::ast::{GenericParam, GenericParamKind, PatKind, RangeEnd, VariantData}; use crate::ast::{GenericParam, GenericParamKind, PatKind, RangeEnd, VariantData};
use crate::attr; use crate::attr;
use crate::edition::{Edition, ALL_EDITIONS};
use crate::sess::ParseSess; use crate::sess::ParseSess;
use crate::visit::{self, FnKind, Visitor}; use crate::visit::{self, FnKind, Visitor};
@ -14,6 +13,7 @@ use rustc_feature::{Feature, Features, State as FeatureState, UnstableFeatures};
use rustc_feature::{ use rustc_feature::{
ACCEPTED_FEATURES, ACTIVE_FEATURES, REMOVED_FEATURES, STABLE_REMOVED_FEATURES, 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::source_map::Spanned;
use rustc_span::symbol::{sym, Symbol}; use rustc_span::symbol::{sym, Symbol};
use rustc_span::{MultiSpan, Span, DUMMY_SP}; use rustc_span::{MultiSpan, Span, DUMMY_SP};

View file

@ -21,7 +21,7 @@ use ast::AttrId;
pub use errors; pub use errors;
use rustc_data_structures::sync::Lock; use rustc_data_structures::sync::Lock;
use rustc_index::bit_set::GrowableBitSet; use rustc_index::bit_set::GrowableBitSet;
use rustc_span::edition::Edition; use rustc_span::edition::{Edition, DEFAULT_EDITION};
#[macro_export] #[macro_export]
macro_rules! unwrap_or { macro_rules! unwrap_or {
@ -51,19 +51,13 @@ impl Globals {
} }
} }
pub fn with_globals<F, R>(edition: Edition, f: F) -> R pub fn with_globals<R>(edition: Edition, f: impl FnOnce() -> R) -> R {
where
F: FnOnce() -> R,
{
let globals = Globals::new(edition); let globals = Globals::new(edition);
GLOBALS.set(&globals, || rustc_span::GLOBALS.set(&globals.rustc_span_globals, f)) GLOBALS.set(&globals, || rustc_span::GLOBALS.set(&globals.rustc_span_globals, f))
} }
pub fn with_default_globals<F, R>(f: F) -> R pub fn with_default_globals<R>(f: impl FnOnce() -> R) -> R {
where with_globals(DEFAULT_EDITION, f)
F: FnOnce() -> R,
{
with_globals(edition::DEFAULT_EDITION, f)
} }
scoped_tls::scoped_thread_local!(pub static GLOBALS: Globals); scoped_tls::scoped_thread_local!(pub static GLOBALS: Globals);
@ -96,7 +90,6 @@ pub mod mut_visit;
pub mod ptr; pub mod ptr;
pub mod show_span; pub mod show_span;
pub use rustc_session::parse as sess; pub use rustc_session::parse as sess;
pub use rustc_span::edition;
pub mod token; pub mod token;
pub mod tokenstream; pub mod tokenstream;
pub mod visit; pub mod visit;

View file

@ -2,6 +2,7 @@
#![deny(warnings)] #![deny(warnings)]
extern crate env_logger; extern crate env_logger;
extern crate rustc_span;
extern crate syntax; extern crate syntax;
use std::cell::RefCell; use std::cell::RefCell;
@ -13,7 +14,7 @@ use std::io::Write;
use std::path::Path; use std::path::Path;
use std::path::PathBuf; use std::path::PathBuf;
use syntax::edition::DEFAULT_EDITION; use rustc_span::edition::DEFAULT_EDITION;
use rustdoc::html::markdown::{ErrorCodes, IdMap, Markdown, Playground}; use rustdoc::html::markdown::{ErrorCodes, IdMap, Markdown, Playground};