diff --git a/src/libfmt_macros/Cargo.toml b/src/libfmt_macros/Cargo.toml index 70752b548ddb3..01608701a79dc 100644 --- a/src/libfmt_macros/Cargo.toml +++ b/src/libfmt_macros/Cargo.toml @@ -9,5 +9,5 @@ name = "fmt_macros" path = "lib.rs" [dependencies] -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } rustc_lexer = { path = "../librustc_lexer" } diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index fa0021a7c734f..9ca7eee999fe0 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -24,7 +24,7 @@ use std::iter; use std::str; use std::string; -use syntax_pos::{InnerSpan, Symbol}; +use rustc_span::{InnerSpan, Symbol}; #[derive(Copy, Clone)] struct InnerOffset(usize); diff --git a/src/libfmt_macros/tests.rs b/src/libfmt_macros/tests.rs index 71a6d51fc870c..98c2a17f0dd54 100644 --- a/src/libfmt_macros/tests.rs +++ b/src/libfmt_macros/tests.rs @@ -144,7 +144,7 @@ fn format_align_fill() { } #[test] fn format_counts() { - use syntax_pos::{edition, Globals, GLOBALS}; + use rustc_span::{edition, Globals, GLOBALS}; GLOBALS.set(&Globals::new(edition::DEFAULT_EDITION), || { same( "{:10x}", diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml index 19122424d6ddd..973384bcf05aa 100644 --- a/src/librustc/Cargo.toml +++ b/src/librustc/Cargo.toml @@ -30,7 +30,7 @@ rustc_index = { path = "../librustc_index" } errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_serialize = { path = "../libserialize", package = "serialize" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } backtrace = "0.3.40" parking_lot = "0.9" byteorder = { version = "1.3" } diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 57f72ba050789..8c68f7272c02c 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -65,9 +65,9 @@ use crate::traits::query::{ use crate::ty::subst::SubstsRef; use crate::ty::{self, ParamEnvAnd, Ty, TyCtxt}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_span::symbol::Symbol; use std::fmt; use std::hash::Hash; -use syntax_pos::symbol::Symbol; // erase!() just makes tokens go away. It's used to specify which macro argument // is repeated (i.e., which sub-expression of the macro we are in) but don't need diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs index 511244ca516f5..2b201cfe0a962 100644 --- a/src/librustc/hir/check_attr.rs +++ b/src/librustc/hir/check_attr.rs @@ -12,9 +12,9 @@ use crate::lint::builtin::UNUSED_ATTRIBUTES; use crate::ty::query::Providers; use crate::ty::TyCtxt; +use rustc_span::Span; use std::fmt::{self, Display}; use syntax::{attr, symbol::sym}; -use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/librustc/hir/def.rs b/src/librustc/hir/def.rs index 38223843e2756..6ba9a53799b9a 100644 --- a/src/librustc/hir/def.rs +++ b/src/librustc/hir/def.rs @@ -6,10 +6,10 @@ use crate::ty; use crate::util::nodemap::DefIdMap; use rustc_macros::HashStable; +use rustc_span::hygiene::MacroKind; +use rustc_span::Span; use syntax::ast; use syntax::ast::NodeId; -use syntax_pos::hygiene::MacroKind; -use syntax_pos::Span; use std::fmt::Debug; diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index 9ac63001bf34b..241febe0cf60c 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -36,8 +36,8 @@ use super::itemlikevisit::DeepVisitor; use crate::hir::map::Map; use crate::hir::*; +use rustc_span::Span; use syntax::ast::{Attribute, Ident, Name}; -use syntax_pos::Span; #[derive(Copy, Clone)] pub enum FnKind<'a> { diff --git a/src/librustc/hir/map/blocks.rs b/src/librustc/hir/map/blocks.rs index 1267de4d9786c..9546c101dc803 100644 --- a/src/librustc/hir/map/blocks.rs +++ b/src/librustc/hir/map/blocks.rs @@ -15,8 +15,8 @@ use crate::hir as ast; use crate::hir::intravisit::FnKind; use crate::hir::map; use crate::hir::{Expr, FnDecl, Node}; +use rustc_span::Span; use syntax::ast::{Attribute, Ident}; -use syntax_pos::Span; /// An FnLikeNode is a Node that is like a fn, in that it has a decl /// and a body (as well as a NodeId, a span, etc). diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index 28eff07a494d5..c1fe1bec342ff 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -11,10 +11,10 @@ use crate::session::Session; use crate::util::nodemap::FxHashMap; use rustc_data_structures::svh::Svh; use rustc_index::vec::IndexVec; +use rustc_span::Span; use std::iter::repeat; use syntax::ast::NodeId; use syntax::source_map::SourceMap; -use syntax_pos::Span; use crate::ich::StableHashingContext; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs index 15819f3b6e023..60bacfbe2df63 100644 --- a/src/librustc/hir/map/definitions.rs +++ b/src/librustc/hir/map/definitions.rs @@ -13,13 +13,13 @@ use crate::util::nodemap::NodeMap; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::StableHasher; use rustc_index::vec::IndexVec; +use rustc_span::hygiene::ExpnId; +use rustc_span::symbol::{sym, Symbol}; +use rustc_span::Span; use std::borrow::Borrow; use std::fmt::Write; use std::hash::Hash; use syntax::ast; -use syntax_pos::hygiene::ExpnId; -use syntax_pos::symbol::{sym, Symbol}; -use syntax_pos::Span; /// The `DefPathTable` maps `DefIndex`es to `DefKey`s and vice versa. /// Internally the `DefPathTable` holds a tree of `DefKey`s, where each `DefKey` diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 7f7af331b3c30..7445f35dd21ad 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -16,11 +16,11 @@ use crate::util::nodemap::FxHashMap; use rustc_data_structures::svh::Svh; use rustc_index::vec::IndexVec; +use rustc_span::hygiene::MacroKind; +use rustc_span::{Span, DUMMY_SP}; use rustc_target::spec::abi::Abi; use syntax::ast::{self, Name, NodeId}; use syntax::source_map::Spanned; -use syntax_pos::hygiene::MacroKind; -use syntax_pos::{Span, DUMMY_SP}; pub mod blocks; mod collector; diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index dfd06da969b57..d0cc87f7506a0 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -19,6 +19,9 @@ use errors::FatalError; use rustc_data_structures::sync::{par_for_each_in, Send, Sync}; use rustc_macros::HashStable; use rustc_serialize::{self, Decodable, Decoder, Encodable, Encoder}; +use rustc_span::source_map::{SourceMap, Spanned}; +use rustc_span::symbol::{kw, sym, Symbol}; +use rustc_span::{MultiSpan, Span, DUMMY_SP}; use rustc_target::spec::abi::Abi; use smallvec::SmallVec; use std::collections::{BTreeMap, BTreeSet}; @@ -30,9 +33,6 @@ pub use syntax::ast::{CaptureBy, Constness, Movability, Mutability, Unsafety}; use syntax::attr::{InlineAttr, OptimizeAttr}; use syntax::tokenstream::TokenStream; use syntax::util::parser::ExprPrecedence; -use syntax_pos::source_map::{SourceMap, Spanned}; -use syntax_pos::symbol::{kw, sym, Symbol}; -use syntax_pos::{MultiSpan, Span, DUMMY_SP}; pub mod check_attr; pub mod def; diff --git a/src/librustc/hir/pat_util.rs b/src/librustc/hir/pat_util.rs index 0831f5403db54..56b557b409ca6 100644 --- a/src/librustc/hir/pat_util.rs +++ b/src/librustc/hir/pat_util.rs @@ -1,8 +1,8 @@ use crate::hir::def::{CtorOf, DefKind, Res}; use crate::hir::def_id::DefId; use crate::hir::{self, HirId, PatKind}; +use rustc_span::Span; use syntax::ast; -use syntax_pos::Span; use std::iter::{Enumerate, ExactSizeIterator}; diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index ae760d22f751c..7cc57ed7528a3 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -1,3 +1,4 @@ +use rustc_span::{self, BytePos, FileName}; use rustc_target::spec::abi::Abi; use syntax::ast; use syntax::print::pp::Breaks::{Consistent, Inconsistent}; @@ -7,7 +8,6 @@ use syntax::sess::ParseSess; use syntax::source_map::{SourceMap, Spanned}; use syntax::symbol::kw; use syntax::util::parser::{self, AssocOp, Fixity}; -use syntax_pos::{self, BytePos, FileName}; use crate::hir; use crate::hir::{GenericArg, GenericParam, GenericParamKind}; @@ -178,7 +178,7 @@ impl<'a> State<'a> { self.end(); // close the head-box } - pub fn bclose_maybe_open(&mut self, span: syntax_pos::Span, close_box: bool) { + pub fn bclose_maybe_open(&mut self, span: rustc_span::Span, close_box: bool) { self.maybe_print_comment(span.hi()); self.break_offset_if_not_bol(1, -(INDENT_UNIT as isize)); self.s.word("}"); @@ -187,7 +187,7 @@ impl<'a> State<'a> { } } - pub fn bclose(&mut self, span: syntax_pos::Span) { + pub fn bclose(&mut self, span: rustc_span::Span) { self.bclose_maybe_open(span, true) } @@ -223,7 +223,7 @@ impl<'a> State<'a> { pub fn commasep_cmnt(&mut self, b: Breaks, elts: &[T], mut op: F, mut get_span: G) where F: FnMut(&mut State<'_>, &T), - G: FnMut(&T) -> syntax_pos::Span, + G: FnMut(&T) -> rustc_span::Span, { self.rbox(0, b); let len = elts.len(); @@ -704,7 +704,7 @@ impl<'a> State<'a> { enum_definition: &hir::EnumDef<'_>, generics: &hir::Generics<'_>, name: ast::Name, - span: syntax_pos::Span, + span: rustc_span::Span, visibility: &hir::Visibility<'_>, ) { self.head(visibility_qualified(visibility, "enum")); @@ -715,7 +715,7 @@ impl<'a> State<'a> { self.print_variants(&enum_definition.variants, span) } - pub fn print_variants(&mut self, variants: &[hir::Variant<'_>], span: syntax_pos::Span) { + pub fn print_variants(&mut self, variants: &[hir::Variant<'_>], span: rustc_span::Span) { self.bopen(); for v in variants { self.space_if_not_bol(); @@ -763,7 +763,7 @@ impl<'a> State<'a> { struct_def: &hir::VariantData<'_>, generics: &hir::Generics<'_>, name: ast::Name, - span: syntax_pos::Span, + span: rustc_span::Span, print_finalizer: bool, ) { self.print_name(name); @@ -839,18 +839,18 @@ impl<'a> State<'a> { match ti.kind { hir::TraitItemKind::Const(ref ty, default) => { let vis = - Spanned { span: syntax_pos::DUMMY_SP, node: hir::VisibilityKind::Inherited }; + Spanned { span: rustc_span::DUMMY_SP, node: hir::VisibilityKind::Inherited }; self.print_associated_const(ti.ident, &ty, default, &vis); } hir::TraitItemKind::Method(ref sig, hir::TraitMethod::Required(ref arg_names)) => { let vis = - Spanned { span: syntax_pos::DUMMY_SP, node: hir::VisibilityKind::Inherited }; + Spanned { span: rustc_span::DUMMY_SP, node: hir::VisibilityKind::Inherited }; self.print_method_sig(ti.ident, sig, &ti.generics, &vis, arg_names, None); self.s.word(";"); } hir::TraitItemKind::Method(ref sig, hir::TraitMethod::Provided(body)) => { let vis = - Spanned { span: syntax_pos::DUMMY_SP, node: hir::VisibilityKind::Inherited }; + Spanned { span: rustc_span::DUMMY_SP, node: hir::VisibilityKind::Inherited }; self.head(""); self.print_method_sig(ti.ident, sig, &ti.generics, &vis, &[], Some(body)); self.nbsp(); @@ -2097,8 +2097,8 @@ impl<'a> State<'a> { } let generics = hir::Generics { params: &[], - where_clause: hir::WhereClause { predicates: &[], span: syntax_pos::DUMMY_SP }, - span: syntax_pos::DUMMY_SP, + where_clause: hir::WhereClause { predicates: &[], span: rustc_span::DUMMY_SP }, + span: rustc_span::DUMMY_SP, }; self.print_fn( decl, @@ -2110,7 +2110,7 @@ impl<'a> State<'a> { }, name, &generics, - &Spanned { span: syntax_pos::DUMMY_SP, node: hir::VisibilityKind::Inherited }, + &Spanned { span: rustc_span::DUMMY_SP, node: hir::VisibilityKind::Inherited }, arg_names, None, ); @@ -2119,7 +2119,7 @@ impl<'a> State<'a> { pub fn maybe_print_trailing_comment( &mut self, - span: syntax_pos::Span, + span: rustc_span::Span, next_pos: Option, ) { if let Some(cmnts) = self.comments() { diff --git a/src/librustc/hir/upvars.rs b/src/librustc/hir/upvars.rs index 827cf7513944f..ff6b0541078b7 100644 --- a/src/librustc/hir/upvars.rs +++ b/src/librustc/hir/upvars.rs @@ -6,7 +6,7 @@ use crate::hir::{self, HirId}; use crate::ty::query::Providers; use crate::ty::TyCtxt; use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; -use syntax_pos::Span; +use rustc_span::Span; pub fn provide(providers: &mut Providers<'_>) { providers.upvars = |tcx, def_id| { diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs index 9442392ea9e31..305b6058d3466 100644 --- a/src/librustc/ich/hcx.rs +++ b/src/librustc/ich/hcx.rs @@ -9,10 +9,10 @@ use crate::ty::{fast_reject, TyCtxt}; use std::cmp::Ord; +use rustc_span::{BytePos, SourceFile}; use syntax::ast; use syntax::source_map::SourceMap; use syntax::symbol::Symbol; -use syntax_pos::{BytePos, SourceFile}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey}; @@ -270,7 +270,7 @@ impl<'a> ToStableHashKey> for ast::NodeId { } } -impl<'a> syntax_pos::HashStableContext for StableHashingContext<'a> { +impl<'a> rustc_span::HashStableContext for StableHashingContext<'a> { fn hash_spans(&self) -> bool { self.hash_spans } diff --git a/src/librustc/ich/impls_syntax.rs b/src/librustc/ich/impls_syntax.rs index e13822aed4de7..90e1cac211aa6 100644 --- a/src/librustc/ich/impls_syntax.rs +++ b/src/librustc/ich/impls_syntax.rs @@ -3,8 +3,8 @@ use crate::ich::StableHashingContext; +use rustc_span::SourceFile; use syntax::ast; -use syntax_pos::SourceFile; use crate::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX}; @@ -114,22 +114,22 @@ impl<'a> HashStable> for SourceFile { } } -fn stable_byte_pos(pos: ::syntax_pos::BytePos, source_file_start: ::syntax_pos::BytePos) -> u32 { +fn stable_byte_pos(pos: ::rustc_span::BytePos, source_file_start: ::rustc_span::BytePos) -> u32 { pos.0 - source_file_start.0 } fn stable_multibyte_char( - mbc: ::syntax_pos::MultiByteChar, - source_file_start: ::syntax_pos::BytePos, + mbc: ::rustc_span::MultiByteChar, + source_file_start: ::rustc_span::BytePos, ) -> (u32, u32) { - let ::syntax_pos::MultiByteChar { pos, bytes } = mbc; + let ::rustc_span::MultiByteChar { pos, bytes } = mbc; (pos.0 - source_file_start.0, bytes as u32) } fn stable_non_narrow_char( - swc: ::syntax_pos::NonNarrowChar, - source_file_start: ::syntax_pos::BytePos, + swc: ::rustc_span::NonNarrowChar, + source_file_start: ::rustc_span::BytePos, ) -> (u32, u32) { let pos = swc.pos(); let width = swc.width(); @@ -138,10 +138,10 @@ fn stable_non_narrow_char( } fn stable_normalized_pos( - np: ::syntax_pos::NormalizedPos, - source_file_start: ::syntax_pos::BytePos, + np: ::rustc_span::NormalizedPos, + source_file_start: ::rustc_span::BytePos, ) -> (u32, u32) { - let ::syntax_pos::NormalizedPos { pos, diff } = np; + let ::rustc_span::NormalizedPos { pos, diff } = np; (pos.0 - source_file_start.0, diff) } diff --git a/src/librustc/ich/mod.rs b/src/librustc/ich/mod.rs index 4ad3e9482ded8..f07e8f38734a7 100644 --- a/src/librustc/ich/mod.rs +++ b/src/librustc/ich/mod.rs @@ -4,8 +4,8 @@ pub use self::hcx::{ hash_stable_trait_impls, NodeIdHashingMode, StableHashingContext, StableHashingContextProvider, }; crate use rustc_data_structures::fingerprint::Fingerprint; +pub use rustc_span::CachingSourceMapView; use syntax::symbol::{sym, Symbol}; -pub use syntax_pos::CachingSourceMapView; mod hcx; diff --git a/src/librustc/infer/canonical/canonicalizer.rs b/src/librustc/infer/canonical/canonicalizer.rs index d5666f6975bc7..b720168f3563e 100644 --- a/src/librustc/infer/canonical/canonicalizer.rs +++ b/src/librustc/infer/canonical/canonicalizer.rs @@ -190,7 +190,7 @@ impl CanonicalizeRegionMode for CanonicalizeQueryResponse { // `delay_span_bug` to allow type error over an ICE. ty::tls::with_context(|c| { c.tcx.sess.delay_span_bug( - syntax_pos::DUMMY_SP, + rustc_span::DUMMY_SP, &format!("unexpected region in query response: `{:?}`", r), ); }); diff --git a/src/librustc/infer/canonical/query_response.rs b/src/librustc/infer/canonical/query_response.rs index f35bec0c81d5b..5e402dc79a1ad 100644 --- a/src/librustc/infer/canonical/query_response.rs +++ b/src/librustc/infer/canonical/query_response.rs @@ -25,8 +25,8 @@ use crate::ty::{self, BoundVar, Ty, TyCtxt}; use crate::util::captures::Captures; use rustc_index::vec::Idx; use rustc_index::vec::IndexVec; +use rustc_span::DUMMY_SP; use std::fmt::Debug; -use syntax_pos::DUMMY_SP; impl<'tcx> InferCtxtBuilder<'tcx> { /// The "main method" for a canonicalized trait query. Given the diff --git a/src/librustc/infer/combine.rs b/src/librustc/infer/combine.rs index 9e47c178415a5..a9e56a9264cf9 100644 --- a/src/librustc/infer/combine.rs +++ b/src/librustc/infer/combine.rs @@ -40,8 +40,8 @@ use crate::ty::subst::SubstsRef; use crate::ty::{self, InferConst, Ty, TyCtxt}; use crate::ty::{IntType, UintType}; +use rustc_span::{Span, DUMMY_SP}; use syntax::ast; -use syntax_pos::{Span, DUMMY_SP}; #[derive(Clone)] pub struct CombineFields<'infcx, 'tcx> { diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index b3a79c0883358..e2b70abe6f0f5 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -67,9 +67,9 @@ use crate::ty::{ use errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString}; use rustc_error_codes::*; +use rustc_span::{Pos, Span}; use rustc_target::spec::abi; use std::{cmp, fmt}; -use syntax_pos::{Pos, Span}; mod note; diff --git a/src/librustc/infer/error_reporting/need_type_info.rs b/src/librustc/infer/error_reporting/need_type_info.rs index 5a6d336ee1b92..a94595b227b2e 100644 --- a/src/librustc/infer/error_reporting/need_type_info.rs +++ b/src/librustc/infer/error_reporting/need_type_info.rs @@ -6,10 +6,10 @@ use crate::infer::InferCtxt; use crate::ty::print::Print; use crate::ty::{self, DefIdTree, Infer, Ty, TyVar}; use errors::{Applicability, DiagnosticBuilder}; +use rustc_span::Span; use std::borrow::Cow; use syntax::source_map::DesugaringKind; use syntax::symbol::kw; -use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/librustc/infer/error_reporting/nice_region_error/trait_impl_difference.rs b/src/librustc/infer/error_reporting/nice_region_error/trait_impl_difference.rs index 6f9fe25b63058..a33cb511133db 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/trait_impl_difference.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/trait_impl_difference.rs @@ -6,7 +6,7 @@ use crate::infer::{Subtype, ValuePairs}; use crate::traits::ObligationCauseCode::CompareImplMethodObligation; use crate::ty::Ty; use crate::util::common::ErrorReported; -use syntax_pos::Span; +use rustc_span::Span; impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { /// Print the error message for lifetime errors when the `impl` doesn't conform to the `trait`. diff --git a/src/librustc/infer/error_reporting/nice_region_error/util.rs b/src/librustc/infer/error_reporting/nice_region_error/util.rs index 95feef313c07a..ece55c4a822f6 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/util.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/util.rs @@ -5,7 +5,7 @@ use crate::hir; use crate::hir::def_id::DefId; use crate::infer::error_reporting::nice_region_error::NiceRegionError; use crate::ty::{self, DefIdTree, Region, Ty}; -use syntax_pos::Span; +use rustc_span::Span; // The struct contains the information about the anonymous region // we are searching for. diff --git a/src/librustc/infer/lexical_region_resolve/mod.rs b/src/librustc/infer/lexical_region_resolve/mod.rs index 723169b9f5fc5..3fd5d3b5de4f2 100644 --- a/src/librustc/infer/lexical_region_resolve/mod.rs +++ b/src/librustc/infer/lexical_region_resolve/mod.rs @@ -21,8 +21,8 @@ use rustc_data_structures::graph::implementation::{ }; use rustc_index::bit_set::BitSet; use rustc_index::vec::{Idx, IndexVec}; +use rustc_span::Span; use std::fmt; -use syntax_pos::Span; mod graphviz; diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index e563f986f57e1..f9bc9020f1633 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -27,12 +27,12 @@ use crate::util::nodemap::{FxHashMap, FxHashSet}; use errors::DiagnosticBuilder; use rustc_data_structures::sync::Lrc; use rustc_data_structures::unify as ut; +use rustc_span::symbol::Symbol; +use rustc_span::Span; use std::cell::{Cell, Ref, RefCell, RefMut}; use std::collections::BTreeMap; use std::fmt; use syntax::ast; -use syntax_pos::symbol::Symbol; -use syntax_pos::Span; use self::combine::CombineFields; use self::lexical_region_resolve::LexicalRegionResolutions; @@ -1728,7 +1728,7 @@ impl RegionVariableOrigin { Coercion(a) => a, EarlyBoundRegion(a, ..) => a, LateBoundRegion(a, ..) => a, - BoundRegionInCoherence(_) => syntax_pos::DUMMY_SP, + BoundRegionInCoherence(_) => rustc_span::DUMMY_SP, UpvarRegion(_, a) => a, NLL(..) => bug!("NLL variable used with `span`"), } diff --git a/src/librustc/infer/nll_relate/mod.rs b/src/librustc/infer/nll_relate/mod.rs index 74f1c26b0f21d..6b53871b9e2f5 100644 --- a/src/librustc/infer/nll_relate/mod.rs +++ b/src/librustc/infer/nll_relate/mod.rs @@ -266,7 +266,7 @@ where ) -> Ty<'tcx> { use crate::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use crate::traits::WhereClause; - use syntax_pos::DUMMY_SP; + use rustc_span::DUMMY_SP; match value_ty.kind { ty::Projection(other_projection_ty) => { diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs index 3e9f68cebefae..8399737b3e610 100644 --- a/src/librustc/infer/opaque_types/mod.rs +++ b/src/librustc/infer/opaque_types/mod.rs @@ -13,7 +13,7 @@ use errors::DiagnosticBuilder; use rustc::session::config::nightly_options; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::Lrc; -use syntax_pos::Span; +use rustc_span::Span; use rustc_error_codes::*; diff --git a/src/librustc/infer/outlives/env.rs b/src/librustc/infer/outlives/env.rs index a49b770ceb845..e27f1a8b26d7f 100644 --- a/src/librustc/infer/outlives/env.rs +++ b/src/librustc/infer/outlives/env.rs @@ -4,7 +4,7 @@ use crate::infer::{GenericKind, InferCtxt}; use crate::traits::query::outlives_bounds::{self, OutlivesBound}; use crate::ty::{self, Ty}; use rustc_data_structures::fx::FxHashMap; -use syntax_pos::Span; +use rustc_span::Span; /// The `OutlivesEnvironment` collects information about what outlives /// what in a given type-checking setting. For example, if we have a diff --git a/src/librustc/infer/region_constraints/mod.rs b/src/librustc/infer/region_constraints/mod.rs index 19b3c30e53733..323aa1f7f01cd 100644 --- a/src/librustc/infer/region_constraints/mod.rs +++ b/src/librustc/infer/region_constraints/mod.rs @@ -15,7 +15,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::sync::Lrc; use rustc_data_structures::unify as ut; use rustc_index::vec::IndexVec; -use syntax_pos::Span; +use rustc_span::Span; use std::collections::BTreeMap; use std::ops::Range; diff --git a/src/librustc/infer/type_variable.rs b/src/librustc/infer/type_variable.rs index fb301037fa5d1..43ded26b42217 100644 --- a/src/librustc/infer/type_variable.rs +++ b/src/librustc/infer/type_variable.rs @@ -1,7 +1,7 @@ use crate::hir::def_id::DefId; use crate::ty::{self, Ty, TyVid}; +use rustc_span::Span; use syntax::symbol::Symbol; -use syntax_pos::Span; use rustc_data_structures::snapshot_vec as sv; use rustc_data_structures::unify as ut; diff --git a/src/librustc/infer/unify_key.rs b/src/librustc/infer/unify_key.rs index 023b15f7943e6..cc05f4ee7a5c3 100644 --- a/src/librustc/infer/unify_key.rs +++ b/src/librustc/infer/unify_key.rs @@ -1,8 +1,8 @@ use crate::ty::{self, FloatVarValue, InferConst, IntVarValue, Ty, TyCtxt}; use rustc_data_structures::unify::InPlace; use rustc_data_structures::unify::{EqUnifyValue, NoError, UnificationTable, UnifyKey, UnifyValue}; +use rustc_span::{Span, DUMMY_SP}; use syntax::symbol::Symbol; -use syntax_pos::{Span, DUMMY_SP}; use std::cell::RefMut; use std::cmp; diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index 44258b62ca32f..6e0bb3a2a2b38 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -34,11 +34,11 @@ use crate::util::nodemap::FxHashMap; use errors::DiagnosticBuilder; use rustc_data_structures::sync::{self, join, par_iter, ParallelIterator}; +use rustc_span::{symbol::Symbol, MultiSpan, Span}; use std::slice; use syntax::ast; use syntax::util::lev_distance::find_best_match_for_name; use syntax::visit as ast_visit; -use syntax_pos::{symbol::Symbol, MultiSpan, Span}; use rustc_error_codes::*; diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index f4684bd52224f..7e433f50db208 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -32,11 +32,11 @@ use crate::ty::query::Providers; use crate::ty::TyCtxt; use crate::util::nodemap::NodeMap; use errors::{DiagnosticBuilder, DiagnosticId}; +use rustc_span::hygiene::MacroKind; +use rustc_span::Span; use syntax::ast; use syntax::source_map::{DesugaringKind, ExpnKind, MultiSpan}; use syntax::symbol::Symbol; -use syntax_pos::hygiene::MacroKind; -use syntax_pos::Span; pub use crate::lint::context::{ check_ast_crate, check_crate, late_lint_mod, BufferedEarlyLint, CheckLintNameResult, diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs index 9dd913ab34588..93c8ad7707076 100644 --- a/src/librustc/middle/cstore.rs +++ b/src/librustc/middle/cstore.rs @@ -12,13 +12,13 @@ use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::{self, MetadataRef}; use rustc_macros::HashStable; +use rustc_span::Span; use rustc_target::spec::Target; use std::any::Any; use std::path::{Path, PathBuf}; use syntax::ast; use syntax::expand::allocator::AllocatorKind; use syntax::symbol::Symbol; -use syntax_pos::Span; pub use self::NativeLibraryKind::*; pub use rustc_session::utils::NativeLibraryKind; diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 5881b82f7549e..c07b65acff218 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -19,9 +19,9 @@ use crate::util::nodemap::FxHashMap; use crate::hir; use crate::hir::itemlikevisit::ItemLikeVisitor; use rustc_macros::HashStable; +use rustc_span::Span; use syntax::ast; use syntax::symbol::{sym, Symbol}; -use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index a4c489735a96d..dd03a703c8964 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -16,7 +16,7 @@ use crate::util::nodemap::FxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_index::vec::Idx; use rustc_macros::HashStable; -use syntax_pos::{Span, DUMMY_SP}; +use rustc_span::{Span, DUMMY_SP}; use std::fmt; diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index b692459eb517f..7b186bc7a140c 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -16,12 +16,12 @@ use crate::ty::{self, TyCtxt}; use crate::util::nodemap::{FxHashMap, FxHashSet}; use errors::DiagnosticBuilder; use rustc_feature::GateIssue; +use rustc_span::{MultiSpan, Span}; use syntax::ast::{Attribute, CRATE_NODE_ID}; use syntax::attr::{self, ConstStability, Deprecation, RustcDeprecation, Stability}; use syntax::errors::Applicability; use syntax::feature_gate::{feature_err, feature_err_issue}; use syntax::symbol::{sym, Symbol}; -use syntax_pos::{MultiSpan, Span}; use std::cmp::Ordering; use std::mem::replace; diff --git a/src/librustc/middle/weak_lang_items.rs b/src/librustc/middle/weak_lang_items.rs index 600b05068cdc9..011c9fc27e05e 100644 --- a/src/librustc/middle/weak_lang_items.rs +++ b/src/librustc/middle/weak_lang_items.rs @@ -9,10 +9,10 @@ use crate::hir::intravisit; use crate::hir::intravisit::{NestedVisitorMap, Visitor}; use crate::ty::TyCtxt; use rustc_data_structures::fx::FxHashSet; +use rustc_span::Span; use rustc_target::spec::PanicStrategy; use syntax::ast; use syntax::symbol::{sym, Symbol}; -use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index 51f0818fe0be1..2308da5d610e8 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -11,10 +11,10 @@ use backtrace::Backtrace; use errors::DiagnosticBuilder; use hir::GeneratorKind; use rustc_macros::HashStable; +use rustc_span::{Pos, Span}; use rustc_target::spec::abi::Abi; use std::{any::Any, env, fmt}; use syntax::symbol::Symbol; -use syntax_pos::{Pos, Span}; use rustc_error_codes::*; diff --git a/src/librustc/mir/interpret/queries.rs b/src/librustc/mir/interpret/queries.rs index c593a51e457b8..b560363c95861 100644 --- a/src/librustc/mir/interpret/queries.rs +++ b/src/librustc/mir/interpret/queries.rs @@ -4,7 +4,7 @@ use crate::hir::def_id::DefId; use crate::mir; use crate::ty::subst::{InternalSubsts, SubstsRef}; use crate::ty::{self, TyCtxt}; -use syntax_pos::Span; +use rustc_span::Span; impl<'tcx> TyCtxt<'tcx> { /// Evaluates a constant without providing any substitutions. This is useful to evaluate consts diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index dc74ff1e98d66..bb1afdd877f82 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -27,6 +27,7 @@ use rustc_index::bit_set::BitMatrix; use rustc_index::vec::{Idx, IndexVec}; use rustc_macros::HashStable; use rustc_serialize::{Decodable, Encodable}; +use rustc_span::{Span, DUMMY_SP}; use smallvec::SmallVec; use std::borrow::Cow; use std::fmt::{self, Debug, Display, Formatter, Write}; @@ -36,7 +37,6 @@ use std::{iter, mem, option, u32}; pub use syntax::ast::Mutability; use syntax::ast::Name; use syntax::symbol::Symbol; -use syntax_pos::{Span, DUMMY_SP}; pub use crate::mir::cache::{BodyAndCache, ReadOnlyBodyAndCache}; pub use crate::mir::interpret::AssertMessage; diff --git a/src/librustc/mir/visit.rs b/src/librustc/mir/visit.rs index 50c5bd9299f36..9173c32800641 100644 --- a/src/librustc/mir/visit.rs +++ b/src/librustc/mir/visit.rs @@ -1,7 +1,7 @@ use crate::mir::*; use crate::ty::subst::SubstsRef; use crate::ty::{CanonicalUserTypeAnnotation, Ty}; -use syntax_pos::Span; +use rustc_span::Span; // # The MIR Visitor // diff --git a/src/librustc/query/mod.rs b/src/librustc/query/mod.rs index 1cd0b67ef05c0..1534e922cddf0 100644 --- a/src/librustc/query/mod.rs +++ b/src/librustc/query/mod.rs @@ -13,8 +13,8 @@ use crate::ty::query::QueryDescription; use crate::ty::subst::SubstsRef; use crate::ty::{self, ParamEnvAnd, Ty, TyCtxt}; +use rustc_span::symbol::Symbol; use std::borrow::Cow; -use syntax_pos::symbol::Symbol; // Each of these queries corresponds to a function pointer field in the // `Providers` struct for requesting a value of that type, and a method @@ -497,7 +497,7 @@ rustc_queries! { desc { "extract field of const" } } - query const_caller_location(key: (syntax_pos::Symbol, u32, u32)) -> &'tcx ty::Const<'tcx> { + query const_caller_location(key: (rustc_span::Symbol, u32, u32)) -> &'tcx ty::Const<'tcx> { no_force desc { "get a &core::panic::Location referring to a span" } } diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs index 3eaa9db0b1522..9be18f45de654 100644 --- a/src/librustc/traits/coherence.rs +++ b/src/librustc/traits/coherence.rs @@ -12,8 +12,8 @@ use crate::traits::{self, Normalized, Obligation, ObligationCause, SelectionCont use crate::ty::fold::TypeFoldable; use crate::ty::subst::Subst; use crate::ty::{self, Ty, TyCtxt}; +use rustc_span::DUMMY_SP; use syntax::symbol::sym; -use syntax_pos::DUMMY_SP; /// Whether we do the orphan check relative to this crate or /// to some remote crate. diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 5819e7aa5c25d..8a5a92fcfa6d9 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -25,11 +25,11 @@ use crate::util::nodemap::{FxHashMap, FxHashSet}; use errors::{pluralize, Applicability, DiagnosticBuilder, Style}; use rustc::hir::def_id::LOCAL_CRATE; +use rustc_span::source_map::SourceMap; +use rustc_span::{ExpnKind, MultiSpan, Span, DUMMY_SP}; use std::fmt; use syntax::ast; use syntax::symbol::{kw, sym}; -use syntax_pos::source_map::SourceMap; -use syntax_pos::{ExpnKind, MultiSpan, Span, DUMMY_SP}; use rustc_error_codes::*; diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index fe373e02e10f3..5c44d5bda39b2 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -32,8 +32,8 @@ use crate::ty::{self, AdtKind, GenericParamDefKind, List, ToPredicate, Ty, TyCtx use crate::util::common::ErrorReported; use chalk_engine; use rustc_macros::HashStable; +use rustc_span::{Span, DUMMY_SP}; use syntax::ast; -use syntax_pos::{Span, DUMMY_SP}; use std::fmt::Debug; use std::rc::Rc; diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index ac49f522f431f..97f75056f80a2 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -16,11 +16,11 @@ use crate::lint; use crate::traits::{self, Obligation, ObligationCause}; use crate::ty::subst::{InternalSubsts, Subst}; use crate::ty::{self, Predicate, ToPredicate, Ty, TyCtxt, TypeFoldable}; +use rustc_span::{Span, DUMMY_SP}; use std::borrow::Cow; use std::iter::{self}; use syntax::ast::{self}; use syntax::symbol::Symbol; -use syntax_pos::{Span, DUMMY_SP}; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] pub enum ObjectSafetyViolation { diff --git a/src/librustc/traits/on_unimplemented.rs b/src/librustc/traits/on_unimplemented.rs index ff4d8980054cf..5d90018e80a38 100644 --- a/src/librustc/traits/on_unimplemented.rs +++ b/src/librustc/traits/on_unimplemented.rs @@ -5,10 +5,10 @@ use crate::ty::{self, GenericParamDefKind, TyCtxt}; use crate::util::common::ErrorReported; use crate::util::nodemap::FxHashMap; +use rustc_span::Span; use syntax::ast::{MetaItem, NestedMetaItem}; use syntax::attr; use syntax::symbol::{kw, sym, Symbol}; -use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index bcb012ea51494..c604bf59cbd79 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -21,9 +21,9 @@ use crate::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt}; use crate::util::common::FN_OUTPUT_NAME; use rustc_data_structures::snapshot_map::{Snapshot, SnapshotMap}; use rustc_macros::HashStable; +use rustc_span::DUMMY_SP; use syntax::ast::Ident; use syntax::symbol::sym; -use syntax_pos::DUMMY_SP; /// Depending on the stage of compilation, we want projection to be /// more or less conservative. diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index d527aa310ad28..9d3e9e309c697 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -19,7 +19,7 @@ use crate::traits::{self, coherence, FutureCompatOverlapErrorKind, ObligationCau use crate::ty::subst::{InternalSubsts, Subst, SubstsRef}; use crate::ty::{self, TyCtxt, TypeFoldable}; use rustc_data_structures::fx::FxHashSet; -use syntax_pos::DUMMY_SP; +use rustc_span::DUMMY_SP; use super::util::impl_trait_ref_and_oblig; use super::{FulfillmentContext, SelectionContext}; diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs index d36ff8c236f8f..99f6e933fb418 100644 --- a/src/librustc/traits/util.rs +++ b/src/librustc/traits/util.rs @@ -1,6 +1,6 @@ use errors::DiagnosticBuilder; +use rustc_span::Span; use smallvec::SmallVec; -use syntax_pos::Span; use crate::hir; use crate::hir::def_id::DefId; diff --git a/src/librustc/ty/codec.rs b/src/librustc/ty/codec.rs index d55b756adf6d1..3ccbc096d02c2 100644 --- a/src/librustc/ty/codec.rs +++ b/src/librustc/ty/codec.rs @@ -14,9 +14,9 @@ use crate::ty::subst::SubstsRef; use crate::ty::{self, List, Ty, TyCtxt}; use rustc_data_structures::fx::FxHashMap; use rustc_serialize::{opaque, Decodable, Decoder, Encodable, Encoder}; +use rustc_span::Span; use std::hash::Hash; use std::intrinsics; -use syntax_pos::Span; /// The shorthand encoding uses an enum's variant index `usize` /// and is offset by this value so it never matches a real variant. @@ -355,7 +355,7 @@ macro_rules! implement_ty_decoder { use $crate::ty::subst::SubstsRef; use $crate::hir::def_id::{CrateNum}; - use syntax_pos::Span; + use rustc_span::Span; use super::$DecoderName; diff --git a/src/librustc/ty/constness.rs b/src/librustc/ty/constness.rs index 35d5bdaf1820c..518ad63bdd0ae 100644 --- a/src/librustc/ty/constness.rs +++ b/src/librustc/ty/constness.rs @@ -3,9 +3,9 @@ use crate::hir::def_id::DefId; use crate::hir::map::blocks::FnLikeNode; use crate::ty::query::Providers; use crate::ty::TyCtxt; +use rustc_span::symbol::Symbol; use rustc_target::spec::abi::Abi; use syntax::attr; -use syntax_pos::symbol::Symbol; impl<'tcx> TyCtxt<'tcx> { /// Whether the `def_id` counts as const fn in your current crate, considering all active diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index b84b0e4f45dcb..daa5ca37a98cd 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -59,6 +59,7 @@ use rustc_data_structures::stable_hasher::{ use rustc_data_structures::sync::{Lock, Lrc, WorkerLocal}; use rustc_index::vec::{Idx, IndexVec}; use rustc_macros::HashStable; +use rustc_span::Span; use rustc_target::spec::abi; use smallvec::SmallVec; use std::any::Any; @@ -76,7 +77,6 @@ use syntax::attr; use syntax::expand::allocator::AllocatorKind; use syntax::source_map::MultiSpan; use syntax::symbol::{kw, sym, Symbol}; -use syntax_pos::Span; pub struct AllArenas { pub interner: SyncDroplessArena, diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index c4a134926aed9..e2ecfd13d2f85 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -3,10 +3,10 @@ use crate::hir::def_id::DefId; use crate::ty::{self, BoundRegion, Region, Ty, TyCtxt}; use errors::{Applicability, DiagnosticBuilder}; +use rustc_span::Span; use rustc_target::spec::abi; use syntax::ast; use syntax::errors::pluralize; -use syntax_pos::Span; use std::borrow::Cow; use std::fmt; diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 98aa299a70405..63345f828e09c 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -1,9 +1,9 @@ use crate::session::{self, DataTypeKind}; use crate::ty::{self, subst::SubstsRef, ReprOptions, Ty, TyCtxt, TypeFoldable}; +use rustc_span::DUMMY_SP; use syntax::ast::{self, Ident, IntTy, UintTy}; use syntax::attr; -use syntax_pos::DUMMY_SP; use std::cmp; use std::fmt; diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 2c40c9dc9efbb..2707d07633b2f 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -35,6 +35,9 @@ use rustc_macros::HashStable; use rustc_data_structures::sync::{self, par_iter, Lrc, ParallelIterator}; use rustc_serialize::{self, Encodable, Encoder}; +use rustc_span::hygiene::ExpnId; +use rustc_span::symbol::{kw, sym, Symbol}; +use rustc_span::Span; use rustc_target::abi::Align; use std::cell::RefCell; use std::cmp::{self, Ordering}; @@ -46,9 +49,6 @@ use std::slice; use std::{mem, ptr}; use syntax::ast::{self, Ident, Name, NodeId}; use syntax::attr; -use syntax_pos::hygiene::ExpnId; -use syntax_pos::symbol::{kw, sym, Symbol}; -use syntax_pos::Span; use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; diff --git a/src/librustc/ty/query/job.rs b/src/librustc/ty/query/job.rs index fbcbfae9f8f4f..dd8274dcf22a5 100644 --- a/src/librustc/ty/query/job.rs +++ b/src/librustc/ty/query/job.rs @@ -4,7 +4,7 @@ use crate::ty::query::Query; use crate::ty::tls; use rustc_data_structures::sync::Lrc; -use syntax_pos::Span; +use rustc_span::Span; #[cfg(not(parallel_compiler))] use std::ptr; @@ -17,9 +17,9 @@ use { rustc_data_structures::sync::Lock, rustc_data_structures::{jobserver, OnDrop}, rustc_rayon_core as rayon_core, + rustc_span::DUMMY_SP, std::iter::FromIterator, std::{mem, process, thread}, - syntax_pos::DUMMY_SP, }; /// Represents a span and a query key. @@ -432,16 +432,16 @@ pub unsafe fn handle_deadlock() { let gcx_ptr = tls::GCX_PTR.with(|gcx_ptr| gcx_ptr as *const _); let gcx_ptr = &*gcx_ptr; - let syntax_pos_globals = - syntax_pos::GLOBALS.with(|syntax_pos_globals| syntax_pos_globals as *const _); - let syntax_pos_globals = &*syntax_pos_globals; + let rustc_span_globals = + rustc_span::GLOBALS.with(|rustc_span_globals| rustc_span_globals as *const _); + let rustc_span_globals = &*rustc_span_globals; let syntax_globals = syntax::GLOBALS.with(|syntax_globals| syntax_globals as *const _); let syntax_globals = &*syntax_globals; thread::spawn(move || { tls::GCX_PTR.set(gcx_ptr, || { syntax::GLOBALS.set(syntax_globals, || { - syntax_pos::GLOBALS - .set(syntax_pos_globals, || tls::with_global(|tcx| deadlock(tcx, ®istry))) + rustc_span::GLOBALS + .set(rustc_span_globals, || tls::with_global(|tcx| deadlock(tcx, ®istry))) }); }) }); diff --git a/src/librustc/ty/query/keys.rs b/src/librustc/ty/query/keys.rs index 78e97f701ea57..3cf0a07b29df6 100644 --- a/src/librustc/ty/query/keys.rs +++ b/src/librustc/ty/query/keys.rs @@ -8,8 +8,8 @@ use crate::ty::fast_reject::SimplifiedType; use crate::ty::subst::SubstsRef; use crate::ty::{self, Ty, TyCtxt}; -use syntax_pos::symbol::Symbol; -use syntax_pos::{Span, DUMMY_SP}; +use rustc_span::symbol::Symbol; +use rustc_span::{Span, DUMMY_SP}; /// The `Key` trait controls what types can legally be used as the key /// for a query. diff --git a/src/librustc/ty/query/mod.rs b/src/librustc/ty/query/mod.rs index f523cee49ec63..9a555ecf091c7 100644 --- a/src/librustc/ty/query/mod.rs +++ b/src/librustc/ty/query/mod.rs @@ -47,6 +47,7 @@ use rustc_data_structures::sync::Lrc; use rustc_index::vec::IndexVec; use rustc_target::spec::PanicStrategy; +use rustc_span::{Span, DUMMY_SP}; use std::any::type_name; use std::borrow::Cow; use std::ops::Deref; @@ -54,7 +55,6 @@ use std::sync::Arc; use syntax::ast; use syntax::attr; use syntax::symbol::Symbol; -use syntax_pos::{Span, DUMMY_SP}; #[macro_use] mod plumbing; diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index 2a03413ee603d..a432f43d13303 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -20,11 +20,11 @@ use rustc_serialize::{ opaque, Decodable, Decoder, Encodable, Encoder, SpecializedDecoder, SpecializedEncoder, UseSpecializedDecodable, UseSpecializedEncodable, }; +use rustc_span::hygiene::{ExpnId, SyntaxContext}; +use rustc_span::{BytePos, SourceFile, Span, DUMMY_SP}; use std::mem; use syntax::ast::{Ident, NodeId}; use syntax::source_map::{SourceMap, StableSourceFileId}; -use syntax_pos::hygiene::{ExpnId, SyntaxContext}; -use syntax_pos::{BytePos, SourceFile, Span, DUMMY_SP}; const TAG_FILE_FOOTER: u128 = 0xC0FFEE_C0FFEE_C0FFEE_C0FFEE_C0FFEE; diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index 0114cd9076a88..0642de8c744c2 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -20,12 +20,12 @@ use rustc_data_structures::fx::{FxHashMap, FxHasher}; use rustc_data_structures::sharded::Sharded; use rustc_data_structures::sync::{Lock, Lrc}; use rustc_data_structures::thin_vec::ThinVec; +use rustc_span::Span; use std::collections::hash_map::Entry; use std::hash::{Hash, Hasher}; use std::mem; use std::ptr; use syntax::source_map::DUMMY_SP; -use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index 61ee7288a9bdf..c92128a1467a5 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -274,7 +274,7 @@ CloneTypeFoldableAndLiftImpls! { crate::middle::region::Scope, ::syntax::ast::FloatTy, ::syntax::ast::NodeId, - ::syntax_pos::symbol::Symbol, + ::rustc_span::symbol::Symbol, crate::hir::def::Res, crate::hir::def_id::DefId, crate::hir::InlineAsmInner, @@ -303,7 +303,7 @@ CloneTypeFoldableAndLiftImpls! { crate::ty::RegionVid, crate::ty::UniverseIndex, crate::ty::Variance, - ::syntax_pos::Span, + ::rustc_span::Span, } /////////////////////////////////////////////////////////////////////////// diff --git a/src/librustc/ty/structural_match.rs b/src/librustc/ty/structural_match.rs index 426dd93c55732..13cb5fd1f38ce 100644 --- a/src/librustc/ty/structural_match.rs +++ b/src/librustc/ty/structural_match.rs @@ -5,7 +5,7 @@ use rustc::traits::{self, ConstPatternStructural, TraitEngine}; use rustc_data_structures::fx::FxHashSet; -use syntax_pos::Span; +use rustc_span::Span; use crate::ty::fold::{TypeFoldable, TypeVisitor}; use crate::ty::{self, AdtDef, Ty, TyCtxt}; diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index 3804b5aed7161..0167fae0ce118 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -8,8 +8,8 @@ use crate::ty::{self, Lift, List, ParamConst, Ty, TyCtxt}; use rustc_macros::HashStable; use rustc_serialize::{self, Decodable, Decoder, Encodable, Encoder}; +use rustc_span::{Span, DUMMY_SP}; use smallvec::SmallVec; -use syntax_pos::{Span, DUMMY_SP}; use core::intrinsics; use std::cmp::Ordering; diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 41b3d0f7391b2..15fae10236dbc 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -18,10 +18,10 @@ use crate::util::common::ErrorReported; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_macros::HashStable; +use rustc_span::{Span, DUMMY_SP}; use std::{cmp, fmt}; use syntax::ast; use syntax::attr::{self, SignedInt, UnsignedInt}; -use syntax_pos::{Span, DUMMY_SP}; #[derive(Copy, Clone, Debug)] pub struct Discr<'tcx> { diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index afd1b690232e7..1440813f47aab 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -5,9 +5,9 @@ use crate::middle::lang_items; use crate::traits::{self, AssocTypeBoundData}; use crate::ty::subst::SubstsRef; use crate::ty::{self, ToPredicate, Ty, TyCtxt, TypeFoldable}; +use rustc_span::Span; use std::iter::once; use syntax::symbol::{kw, Ident}; -use syntax_pos::Span; /// Returns the set of obligations needed to make `ty` well-formed. /// If `ty` contains unresolved inference variables, this may include diff --git a/src/librustc/util/bug.rs b/src/librustc/util/bug.rs index 8c1f416235a6c..c12b2859f728e 100644 --- a/src/librustc/util/bug.rs +++ b/src/librustc/util/bug.rs @@ -1,8 +1,8 @@ // These functions are used by macro expansion for bug! and span_bug! use crate::ty::tls; +use rustc_span::{MultiSpan, Span}; use std::fmt; -use syntax_pos::{MultiSpan, Span}; #[cold] #[inline(never)] diff --git a/src/librustc_builtin_macros/Cargo.toml b/src/librustc_builtin_macros/Cargo.toml index d2834bf7022fe..f56cc938f4a2f 100644 --- a/src/librustc_builtin_macros/Cargo.toml +++ b/src/librustc_builtin_macros/Cargo.toml @@ -20,5 +20,5 @@ rustc_target = { path = "../librustc_target" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } syntax = { path = "../libsyntax" } rustc_expand = { path = "../librustc_expand" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } rustc_error_codes = { path = "../librustc_error_codes" } diff --git a/src/librustc_builtin_macros/asm.rs b/src/librustc_builtin_macros/asm.rs index 0e1ff7603ba74..71d6d058d90be 100644 --- a/src/librustc_builtin_macros/asm.rs +++ b/src/librustc_builtin_macros/asm.rs @@ -5,13 +5,13 @@ use State::*; use errors::{DiagnosticBuilder, PResult}; use rustc_expand::base::*; use rustc_parse::parser::Parser; +use rustc_span::Span; use syntax::ast::{self, AsmDialect}; use syntax::ptr::P; use syntax::symbol::{kw, sym, Symbol}; use syntax::token::{self, Token}; use syntax::tokenstream::{self, TokenStream}; use syntax::{span_err, struct_span_err}; -use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/librustc_builtin_macros/assert.rs b/src/librustc_builtin_macros/assert.rs index 59e499b8f8ee4..c32263a6a0f9c 100644 --- a/src/librustc_builtin_macros/assert.rs +++ b/src/librustc_builtin_macros/assert.rs @@ -2,13 +2,13 @@ use errors::{Applicability, DiagnosticBuilder}; use rustc_expand::base::*; use rustc_parse::parser::Parser; +use rustc_span::{Span, DUMMY_SP}; use syntax::ast::{self, *}; use syntax::print::pprust; use syntax::ptr::P; use syntax::symbol::{sym, Symbol}; use syntax::token::{self, TokenKind}; use syntax::tokenstream::{DelimSpan, TokenStream, TokenTree}; -use syntax_pos::{Span, DUMMY_SP}; pub fn expand_assert<'cx>( cx: &'cx mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/cfg.rs b/src/librustc_builtin_macros/cfg.rs index 6d97b94ab9f9f..62a4dc06b1fe2 100644 --- a/src/librustc_builtin_macros/cfg.rs +++ b/src/librustc_builtin_macros/cfg.rs @@ -4,11 +4,11 @@ use errors::DiagnosticBuilder; use rustc_expand::base::{self, *}; +use rustc_span::Span; use syntax::ast; use syntax::attr; use syntax::token; use syntax::tokenstream::TokenStream; -use syntax_pos::Span; pub fn expand_cfg( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/cmdline_attrs.rs b/src/librustc_builtin_macros/cmdline_attrs.rs index ea33d4c2c464a..2f7f7e73ac2ce 100644 --- a/src/librustc_builtin_macros/cmdline_attrs.rs +++ b/src/librustc_builtin_macros/cmdline_attrs.rs @@ -1,11 +1,11 @@ //! Attributes injected into the crate root from command line using `-Z crate-attr`. use rustc_expand::panictry; +use rustc_span::FileName; use syntax::ast::{self, AttrItem, AttrStyle}; use syntax::attr::mk_attr; use syntax::sess::ParseSess; use syntax::token; -use syntax_pos::FileName; pub fn inject(mut krate: ast::Crate, parse_sess: &ParseSess, attrs: &[String]) -> ast::Crate { for raw_attr in attrs { diff --git a/src/librustc_builtin_macros/compile_error.rs b/src/librustc_builtin_macros/compile_error.rs index 95bcb6b075bcf..4d8d168a2a866 100644 --- a/src/librustc_builtin_macros/compile_error.rs +++ b/src/librustc_builtin_macros/compile_error.rs @@ -1,8 +1,8 @@ // The compiler code necessary to support the compile_error! extension. use rustc_expand::base::{self, *}; +use rustc_span::Span; use syntax::tokenstream::TokenStream; -use syntax_pos::Span; pub fn expand_compile_error<'cx>( cx: &'cx mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/concat.rs b/src/librustc_builtin_macros/concat.rs index 4dab74610c3e3..c768402b479f8 100644 --- a/src/librustc_builtin_macros/concat.rs +++ b/src/librustc_builtin_macros/concat.rs @@ -7,7 +7,7 @@ use std::string::String; pub fn expand_concat( cx: &mut base::ExtCtxt<'_>, - sp: syntax_pos::Span, + sp: rustc_span::Span, tts: TokenStream, ) -> Box { let es = match base::get_exprs_from_tts(cx, sp, tts) { diff --git a/src/librustc_builtin_macros/concat_idents.rs b/src/librustc_builtin_macros/concat_idents.rs index 4b5ade9823706..449cb2a0b1887 100644 --- a/src/librustc_builtin_macros/concat_idents.rs +++ b/src/librustc_builtin_macros/concat_idents.rs @@ -1,10 +1,10 @@ use rustc_expand::base::{self, *}; +use rustc_span::symbol::Symbol; +use rustc_span::Span; use syntax::ast; use syntax::ptr::P; use syntax::token::{self, Token}; use syntax::tokenstream::{TokenStream, TokenTree}; -use syntax_pos::symbol::Symbol; -use syntax_pos::Span; pub fn expand_concat_idents<'cx>( cx: &'cx mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/bounds.rs b/src/librustc_builtin_macros/deriving/bounds.rs index 7027ca979c6a0..ceb9aab484864 100644 --- a/src/librustc_builtin_macros/deriving/bounds.rs +++ b/src/librustc_builtin_macros/deriving/bounds.rs @@ -3,8 +3,8 @@ use crate::deriving::generic::*; use crate::deriving::path_std; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::Span; use syntax::ast::MetaItem; -use syntax_pos::Span; pub fn expand_deriving_copy( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/clone.rs b/src/librustc_builtin_macros/deriving/clone.rs index a5971bb917656..0b79ee13132b9 100644 --- a/src/librustc_builtin_macros/deriving/clone.rs +++ b/src/librustc_builtin_macros/deriving/clone.rs @@ -3,10 +3,10 @@ use crate::deriving::generic::*; use crate::deriving::path_std; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::Span; use syntax::ast::{self, Expr, GenericArg, Generics, ItemKind, MetaItem, VariantData}; use syntax::ptr::P; use syntax::symbol::{kw, sym, Symbol}; -use syntax_pos::Span; pub fn expand_deriving_clone( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/cmp/eq.rs b/src/librustc_builtin_macros/deriving/cmp/eq.rs index c71ade7304c05..72c3be2365444 100644 --- a/src/librustc_builtin_macros/deriving/cmp/eq.rs +++ b/src/librustc_builtin_macros/deriving/cmp/eq.rs @@ -3,10 +3,10 @@ use crate::deriving::generic::*; use crate::deriving::path_std; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::Span; use syntax::ast::{self, Expr, GenericArg, Ident, MetaItem}; use syntax::ptr::P; use syntax::symbol::{sym, Symbol}; -use syntax_pos::Span; pub fn expand_deriving_eq( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/cmp/ord.rs b/src/librustc_builtin_macros/deriving/cmp/ord.rs index fc1349e3354fc..c16f80159503a 100644 --- a/src/librustc_builtin_macros/deriving/cmp/ord.rs +++ b/src/librustc_builtin_macros/deriving/cmp/ord.rs @@ -3,10 +3,10 @@ use crate::deriving::generic::*; use crate::deriving::path_std; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::Span; use syntax::ast::{self, Expr, MetaItem}; use syntax::ptr::P; use syntax::symbol::sym; -use syntax_pos::Span; pub fn expand_deriving_ord( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/cmp/partial_eq.rs b/src/librustc_builtin_macros/deriving/cmp/partial_eq.rs index 6475c22c009dd..daf518242d5af 100644 --- a/src/librustc_builtin_macros/deriving/cmp/partial_eq.rs +++ b/src/librustc_builtin_macros/deriving/cmp/partial_eq.rs @@ -3,10 +3,10 @@ use crate::deriving::generic::*; use crate::deriving::{path_local, path_std}; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::Span; use syntax::ast::{BinOpKind, Expr, MetaItem}; use syntax::ptr::P; use syntax::symbol::sym; -use syntax_pos::Span; pub fn expand_deriving_partial_eq( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/cmp/partial_ord.rs b/src/librustc_builtin_macros/deriving/cmp/partial_ord.rs index 3397f7886057c..5313b829ca8f6 100644 --- a/src/librustc_builtin_macros/deriving/cmp/partial_ord.rs +++ b/src/librustc_builtin_macros/deriving/cmp/partial_ord.rs @@ -5,10 +5,10 @@ use crate::deriving::generic::*; use crate::deriving::{path_local, path_std, pathvec_std}; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::Span; use syntax::ast::{self, BinOpKind, Expr, MetaItem}; use syntax::ptr::P; use syntax::symbol::{sym, Symbol}; -use syntax_pos::Span; pub fn expand_deriving_partial_ord( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/debug.rs b/src/librustc_builtin_macros/deriving/debug.rs index 4a3790e85dd43..e9c5c7ff9cc6f 100644 --- a/src/librustc_builtin_macros/deriving/debug.rs +++ b/src/librustc_builtin_macros/deriving/debug.rs @@ -3,11 +3,11 @@ use crate::deriving::generic::*; use crate::deriving::path_std; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::{Span, DUMMY_SP}; use syntax::ast::{self, Ident}; use syntax::ast::{Expr, MetaItem}; use syntax::ptr::P; use syntax::symbol::sym; -use syntax_pos::{Span, DUMMY_SP}; pub fn expand_deriving_debug( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/decodable.rs b/src/librustc_builtin_macros/deriving/decodable.rs index 290b8977b88ac..8706535cd3f70 100644 --- a/src/librustc_builtin_macros/deriving/decodable.rs +++ b/src/librustc_builtin_macros/deriving/decodable.rs @@ -5,11 +5,11 @@ use crate::deriving::generic::*; use crate::deriving::pathvec_std; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::Span; use syntax::ast; use syntax::ast::{Expr, MetaItem, Mutability}; use syntax::ptr::P; use syntax::symbol::Symbol; -use syntax_pos::Span; pub fn expand_deriving_rustc_decodable( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/default.rs b/src/librustc_builtin_macros/deriving/default.rs index 284c407f35f5c..43185f924e79c 100644 --- a/src/librustc_builtin_macros/deriving/default.rs +++ b/src/librustc_builtin_macros/deriving/default.rs @@ -3,11 +3,11 @@ use crate::deriving::generic::*; use crate::deriving::path_std; use rustc_expand::base::{Annotatable, DummyResult, ExtCtxt}; +use rustc_span::Span; use syntax::ast::{Expr, MetaItem}; use syntax::ptr::P; use syntax::span_err; use syntax::symbol::{kw, sym}; -use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/librustc_builtin_macros/deriving/encodable.rs b/src/librustc_builtin_macros/deriving/encodable.rs index 31f9e38ba3dc6..496e5e3058d1c 100644 --- a/src/librustc_builtin_macros/deriving/encodable.rs +++ b/src/librustc_builtin_macros/deriving/encodable.rs @@ -90,10 +90,10 @@ use crate::deriving::generic::*; use crate::deriving::pathvec_std; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::Span; use syntax::ast::{Expr, ExprKind, MetaItem, Mutability}; use syntax::ptr::P; use syntax::symbol::Symbol; -use syntax_pos::Span; pub fn expand_deriving_rustc_encodable( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/generic/mod.rs b/src/librustc_builtin_macros/deriving/generic/mod.rs index 8af58e9e4ce7b..da81e52fb6954 100644 --- a/src/librustc_builtin_macros/deriving/generic/mod.rs +++ b/src/librustc_builtin_macros/deriving/generic/mod.rs @@ -182,6 +182,7 @@ use std::iter; use std::vec; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::Span; use syntax::ast::{self, BinOpKind, EnumDef, Expr, Generics, Ident, PatKind}; use syntax::ast::{GenericArg, GenericParamKind, VariantData}; use syntax::attr; @@ -190,7 +191,6 @@ use syntax::sess::ParseSess; use syntax::source_map::respan; use syntax::symbol::{kw, sym, Symbol}; use syntax::util::map_in_place::MapInPlace; -use syntax_pos::Span; use ty::{LifetimeBounds, Path, Ptr, PtrTy, Self_, Ty}; diff --git a/src/librustc_builtin_macros/deriving/generic/ty.rs b/src/librustc_builtin_macros/deriving/generic/ty.rs index 993426501f525..4597bfe3d1cbb 100644 --- a/src/librustc_builtin_macros/deriving/generic/ty.rs +++ b/src/librustc_builtin_macros/deriving/generic/ty.rs @@ -5,11 +5,11 @@ pub use PtrTy::*; pub use Ty::*; use rustc_expand::base::ExtCtxt; +use rustc_span::symbol::kw; +use rustc_span::Span; use syntax::ast::{self, Expr, GenericArg, GenericParamKind, Generics, Ident, SelfKind}; use syntax::ptr::P; use syntax::source_map::{respan, DUMMY_SP}; -use syntax_pos::symbol::kw; -use syntax_pos::Span; /// The types of pointers #[derive(Clone)] diff --git a/src/librustc_builtin_macros/deriving/hash.rs b/src/librustc_builtin_macros/deriving/hash.rs index e75fe1a308c61..bb83c0449c70f 100644 --- a/src/librustc_builtin_macros/deriving/hash.rs +++ b/src/librustc_builtin_macros/deriving/hash.rs @@ -3,10 +3,10 @@ use crate::deriving::generic::*; use crate::deriving::{self, path_std, pathvec_std}; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::Span; use syntax::ast::{Expr, MetaItem, Mutability}; use syntax::ptr::P; use syntax::symbol::sym; -use syntax_pos::Span; pub fn expand_deriving_hash( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/deriving/mod.rs b/src/librustc_builtin_macros/deriving/mod.rs index 0856c0c2a9f94..6f1b3adfb46cf 100644 --- a/src/librustc_builtin_macros/deriving/mod.rs +++ b/src/librustc_builtin_macros/deriving/mod.rs @@ -1,10 +1,10 @@ //! The compiler code necessary to implement the `#[derive]` extensions. use rustc_expand::base::{Annotatable, ExtCtxt, MultiItemModifier}; +use rustc_span::Span; use syntax::ast::{self, ItemKind, MetaItem}; use syntax::ptr::P; use syntax::symbol::{sym, Symbol}; -use syntax_pos::Span; macro path_local($x:ident) { generic::ty::Path::new_local(stringify!($x)) diff --git a/src/librustc_builtin_macros/env.rs b/src/librustc_builtin_macros/env.rs index dd78cecc85fee..17489295ff69c 100644 --- a/src/librustc_builtin_macros/env.rs +++ b/src/librustc_builtin_macros/env.rs @@ -4,10 +4,10 @@ // use rustc_expand::base::{self, *}; +use rustc_span::Span; use syntax::ast::{self, GenericArg, Ident}; use syntax::symbol::{kw, sym, Symbol}; use syntax::tokenstream::TokenStream; -use syntax_pos::Span; use std::env; diff --git a/src/librustc_builtin_macros/format.rs b/src/librustc_builtin_macros/format.rs index 7b915a66dacc9..6e7853c85adab 100644 --- a/src/librustc_builtin_macros/format.rs +++ b/src/librustc_builtin_macros/format.rs @@ -8,12 +8,12 @@ use errors::Applicability; use errors::DiagnosticBuilder; use rustc_expand::base::{self, *}; +use rustc_span::{MultiSpan, Span}; use syntax::ast; use syntax::ptr::P; use syntax::symbol::{sym, Symbol}; use syntax::token; use syntax::tokenstream::TokenStream; -use syntax_pos::{MultiSpan, Span}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use std::borrow::Cow; diff --git a/src/librustc_builtin_macros/format_foreign.rs b/src/librustc_builtin_macros/format_foreign.rs index 9c151cf94b49d..cc3c403450e04 100644 --- a/src/librustc_builtin_macros/format_foreign.rs +++ b/src/librustc_builtin_macros/format_foreign.rs @@ -1,6 +1,6 @@ pub mod printf { use super::strcursor::StrCursor as Cur; - use syntax_pos::InnerSpan; + use rustc_span::InnerSpan; /// Represents a single `printf`-style substitution. #[derive(Clone, PartialEq, Debug)] @@ -604,7 +604,7 @@ pub mod printf { pub mod shell { use super::strcursor::StrCursor as Cur; - use syntax_pos::InnerSpan; + use rustc_span::InnerSpan; #[derive(Clone, PartialEq, Debug)] pub enum Substitution<'a> { diff --git a/src/librustc_builtin_macros/format_foreign/printf/tests.rs b/src/librustc_builtin_macros/format_foreign/printf/tests.rs index b9a85a84d6c99..33c54c9cee001 100644 --- a/src/librustc_builtin_macros/format_foreign/printf/tests.rs +++ b/src/librustc_builtin_macros/format_foreign/printf/tests.rs @@ -37,7 +37,7 @@ fn test_parse() { precision: $prec, length: $len, type_: $type_, - position: syntax_pos::InnerSpan::new($pos.0, $pos.1), + position: rustc_span::InnerSpan::new($pos.0, $pos.1), }), "!" )) diff --git a/src/librustc_builtin_macros/global_allocator.rs b/src/librustc_builtin_macros/global_allocator.rs index 37fcd3cadbac8..58e1c0fc2b1c9 100644 --- a/src/librustc_builtin_macros/global_allocator.rs +++ b/src/librustc_builtin_macros/global_allocator.rs @@ -1,12 +1,12 @@ use crate::util::check_builtin_macro_attribute; use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_span::Span; use syntax::ast::{self, Attribute, Expr, FnHeader, FnSig, Generics, Ident, Param}; use syntax::ast::{ItemKind, Mutability, Stmt, Ty, TyKind, Unsafety}; use syntax::expand::allocator::{AllocatorKind, AllocatorMethod, AllocatorTy, ALLOCATOR_METHODS}; use syntax::ptr::P; use syntax::symbol::{kw, sym, Symbol}; -use syntax_pos::Span; pub fn expand( ecx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/global_asm.rs b/src/librustc_builtin_macros/global_asm.rs index 97ae8012ae3ae..f36b9af77247f 100644 --- a/src/librustc_builtin_macros/global_asm.rs +++ b/src/librustc_builtin_macros/global_asm.rs @@ -10,13 +10,13 @@ use errors::DiagnosticBuilder; use rustc_expand::base::{self, *}; +use rustc_span::Span; use smallvec::smallvec; use syntax::ast; use syntax::ptr::P; use syntax::source_map::respan; use syntax::token; use syntax::tokenstream::TokenStream; -use syntax_pos::Span; pub fn expand_global_asm<'cx>( cx: &'cx mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/log_syntax.rs b/src/librustc_builtin_macros/log_syntax.rs index f873b1790da1b..7c7fc286e0a5e 100644 --- a/src/librustc_builtin_macros/log_syntax.rs +++ b/src/librustc_builtin_macros/log_syntax.rs @@ -1,11 +1,11 @@ use rustc_expand::base; +use rustc_span; use syntax::print; use syntax::tokenstream::TokenStream; -use syntax_pos; pub fn expand_log_syntax<'cx>( _cx: &'cx mut base::ExtCtxt<'_>, - sp: syntax_pos::Span, + sp: rustc_span::Span, tts: TokenStream, ) -> Box { println!("{}", print::pprust::tts_to_string(tts)); diff --git a/src/librustc_builtin_macros/proc_macro_harness.rs b/src/librustc_builtin_macros/proc_macro_harness.rs index bdd7b1d8993d2..f2e3414588bba 100644 --- a/src/librustc_builtin_macros/proc_macro_harness.rs +++ b/src/librustc_builtin_macros/proc_macro_harness.rs @@ -2,6 +2,8 @@ use std::mem; use rustc_expand::base::{ExtCtxt, Resolver}; use rustc_expand::expand::{AstFragment, ExpansionConfig}; +use rustc_span::hygiene::AstPass; +use rustc_span::{Span, DUMMY_SP}; use smallvec::smallvec; use syntax::ast::{self, Ident}; use syntax::attr; @@ -11,8 +13,6 @@ use syntax::ptr::P; use syntax::sess::ParseSess; use syntax::symbol::{kw, sym}; use syntax::visit::{self, Visitor}; -use syntax_pos::hygiene::AstPass; -use syntax_pos::{Span, DUMMY_SP}; struct ProcMacroDerive { trait_name: ast::Name, diff --git a/src/librustc_builtin_macros/source_util.rs b/src/librustc_builtin_macros/source_util.rs index 9e756c4c0e46f..e24f49909ced2 100644 --- a/src/librustc_builtin_macros/source_util.rs +++ b/src/librustc_builtin_macros/source_util.rs @@ -9,8 +9,8 @@ use syntax::symbol::Symbol; use syntax::token; use syntax::tokenstream::TokenStream; +use rustc_span::{self, Pos, Span}; use smallvec::SmallVec; -use syntax_pos::{self, Pos, Span}; use rustc_data_structures::sync::Lrc; diff --git a/src/librustc_builtin_macros/standard_library_imports.rs b/src/librustc_builtin_macros/standard_library_imports.rs index 41da95e0ecc97..e7f6c59e88970 100644 --- a/src/librustc_builtin_macros/standard_library_imports.rs +++ b/src/librustc_builtin_macros/standard_library_imports.rs @@ -1,12 +1,12 @@ use rustc_expand::base::{ExtCtxt, Resolver}; use rustc_expand::expand::ExpansionConfig; +use rustc_span::hygiene::AstPass; +use rustc_span::DUMMY_SP; use syntax::edition::Edition; use syntax::ptr::P; use syntax::sess::ParseSess; use syntax::symbol::{kw, sym, Ident, Symbol}; use syntax::{ast, attr}; -use syntax_pos::hygiene::AstPass; -use syntax_pos::DUMMY_SP; pub fn inject( mut krate: ast::Crate, diff --git a/src/librustc_builtin_macros/test.rs b/src/librustc_builtin_macros/test.rs index dccaf0199982d..280565badfdaf 100644 --- a/src/librustc_builtin_macros/test.rs +++ b/src/librustc_builtin_macros/test.rs @@ -3,12 +3,12 @@ use crate::util::check_builtin_macro_attribute; use rustc_expand::base::*; +use rustc_span::Span; use syntax::ast; use syntax::attr; use syntax::print::pprust; use syntax::source_map::respan; use syntax::symbol::{sym, Symbol}; -use syntax_pos::Span; use std::iter; diff --git a/src/librustc_builtin_macros/test_harness.rs b/src/librustc_builtin_macros/test_harness.rs index e596f3e4432a5..ea0c2d0709353 100644 --- a/src/librustc_builtin_macros/test_harness.rs +++ b/src/librustc_builtin_macros/test_harness.rs @@ -4,6 +4,8 @@ use log::debug; use rustc_expand::base::{ExtCtxt, Resolver}; use rustc_expand::expand::{AstFragment, ExpansionConfig}; use rustc_feature::Features; +use rustc_span::hygiene::{AstPass, SyntaxContext, Transparency}; +use rustc_span::{Span, DUMMY_SP}; use rustc_target::spec::PanicStrategy; use smallvec::{smallvec, SmallVec}; use syntax::ast::{self, Ident}; @@ -14,8 +16,6 @@ use syntax::ptr::P; use syntax::sess::ParseSess; use syntax::source_map::respan; use syntax::symbol::{sym, Symbol}; -use syntax_pos::hygiene::{AstPass, SyntaxContext, Transparency}; -use syntax_pos::{Span, DUMMY_SP}; use std::{iter, mem}; diff --git a/src/librustc_builtin_macros/trace_macros.rs b/src/librustc_builtin_macros/trace_macros.rs index 450a7269fd471..577a1d690c1f9 100644 --- a/src/librustc_builtin_macros/trace_macros.rs +++ b/src/librustc_builtin_macros/trace_macros.rs @@ -1,7 +1,7 @@ use rustc_expand::base::{self, ExtCtxt}; +use rustc_span::Span; use syntax::symbol::kw; use syntax::tokenstream::{TokenStream, TokenTree}; -use syntax_pos::Span; pub fn expand_trace_macros( cx: &mut ExtCtxt<'_>, diff --git a/src/librustc_builtin_macros/util.rs b/src/librustc_builtin_macros/util.rs index bd748c0c8c1f3..b7d1a5d1d7c68 100644 --- a/src/librustc_builtin_macros/util.rs +++ b/src/librustc_builtin_macros/util.rs @@ -1,8 +1,8 @@ use rustc_expand::base::ExtCtxt; use rustc_feature::AttributeTemplate; use rustc_parse::validate_attr; +use rustc_span::Symbol; use syntax::ast::MetaItem; -use syntax_pos::Symbol; pub fn check_builtin_macro_attribute(ecx: &ExtCtxt<'_>, meta_item: &MetaItem, name: Symbol) { // All the built-in macro attributes are "words" at the moment. diff --git a/src/librustc_codegen_llvm/Cargo.toml b/src/librustc_codegen_llvm/Cargo.toml index e0b303710bfad..140a896b681db 100644 --- a/src/librustc_codegen_llvm/Cargo.toml +++ b/src/librustc_codegen_llvm/Cargo.toml @@ -31,4 +31,4 @@ rustc_target = { path = "../librustc_target" } smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } syntax = { path = "../libsyntax" } rustc_expand = { path = "../librustc_expand" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } diff --git a/src/librustc_codegen_llvm/asm.rs b/src/librustc_codegen_llvm/asm.rs index 9458d4a2697ed..14e2009912fca 100644 --- a/src/librustc_codegen_llvm/asm.rs +++ b/src/librustc_codegen_llvm/asm.rs @@ -8,7 +8,7 @@ use rustc::hir; use rustc_codegen_ssa::mir::operand::OperandValue; use rustc_codegen_ssa::mir::place::PlaceRef; use rustc_codegen_ssa::traits::*; -use syntax_pos::Span; +use rustc_span::Span; use libc::{c_char, c_uint}; use log::debug; diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs index 4168d2b66e454..c757fb596b11d 100644 --- a/src/librustc_codegen_llvm/base.rs +++ b/src/librustc_codegen_llvm/base.rs @@ -35,9 +35,9 @@ use rustc_codegen_ssa::back::write::submit_codegened_module_to_llvm; use rustc_codegen_ssa::traits::*; use rustc::hir::CodegenFnAttrs; +use rustc_span::symbol::Symbol; use std::ffi::CString; use std::time::Instant; -use syntax_pos::symbol::Symbol; use crate::value::Value; diff --git a/src/librustc_codegen_llvm/consts.rs b/src/librustc_codegen_llvm/consts.rs index 12c44513159ba..2f3be077ef5c3 100644 --- a/src/librustc_codegen_llvm/consts.rs +++ b/src/librustc_codegen_llvm/consts.rs @@ -14,9 +14,9 @@ use rustc::mir::mono::MonoItem; use rustc::ty::{self, Instance, Ty}; use rustc::{bug, span_bug}; use rustc_codegen_ssa::traits::*; +use rustc_span::Span; use rustc_target::abi::HasDataLayout; use syntax::symbol::{sym, Symbol}; -use syntax_pos::Span; use rustc::ty::layout::{self, Align, LayoutOf, Size}; diff --git a/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs b/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs index 206884d63c7d6..eba05ed5d7787 100644 --- a/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs +++ b/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs @@ -9,7 +9,7 @@ use rustc::mir::{Body, SourceScope}; use libc::c_uint; -use syntax_pos::Pos; +use rustc_span::Pos; use rustc_index::bit_set::BitSet; use rustc_index::vec::Idx; diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index e3c2dfac58b3c..e752103c1d7ae 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -42,10 +42,10 @@ use rustc_data_structures::small_c_str::SmallCStr; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_fs_util::path_to_c_string; use rustc_index::vec::{Idx, IndexVec}; +use rustc_span::{self, FileName, Span}; use rustc_target::abi::HasDataLayout; use syntax::ast; use syntax::symbol::{Interner, Symbol}; -use syntax_pos::{self, FileName, Span}; use libc::{c_longlong, c_uint}; use std::collections::hash_map::Entry; @@ -506,7 +506,7 @@ fn trait_pointer_metadata( type_metadata: type_metadata( cx, cx.tcx.mk_mut_ptr(cx.tcx.types.u8), - syntax_pos::DUMMY_SP, + rustc_span::DUMMY_SP, ), offset: layout.fields.offset(0), size: data_ptr_field.size, @@ -516,7 +516,7 @@ fn trait_pointer_metadata( }, MemberDescription { name: "vtable".to_owned(), - type_metadata: type_metadata(cx, vtable_field.ty, syntax_pos::DUMMY_SP), + type_metadata: type_metadata(cx, vtable_field.ty, rustc_span::DUMMY_SP), offset: layout.fields.offset(1), size: vtable_field.size, align: vtable_field.align.abi, @@ -533,7 +533,7 @@ fn trait_pointer_metadata( member_descriptions, containing_scope, file_metadata, - syntax_pos::DUMMY_SP, + rustc_span::DUMMY_SP, ) } @@ -1816,7 +1816,7 @@ fn prepare_enum_metadata( None => { let (discriminant_size, discriminant_align) = (discr.size(cx), discr.align(cx)); let discriminant_base_type_metadata = - type_metadata(cx, discr.to_ty(cx.tcx), syntax_pos::DUMMY_SP); + type_metadata(cx, discr.to_ty(cx.tcx), rustc_span::DUMMY_SP); let discriminant_name = match enum_type.kind { ty::Adt(..) => SmallCStr::new(&cx.tcx.item_name(enum_def_id).as_str()), @@ -2146,7 +2146,7 @@ fn compute_type_parameters(cx: &CodegenCx<'ll, 'tcx>, ty: Ty<'tcx>) -> Option<&' let actual_type = cx.tcx.normalize_erasing_regions(ParamEnv::reveal_all(), ty); let actual_type_metadata = - type_metadata(cx, actual_type, syntax_pos::DUMMY_SP); + type_metadata(cx, actual_type, rustc_span::DUMMY_SP); let name = SmallCStr::new(&name.as_str()); Some(unsafe { Some(llvm::LLVMRustDIBuilderCreateTemplateTypeParameter( @@ -2327,7 +2327,7 @@ pub fn create_vtable_metadata(cx: &CodegenCx<'ll, 'tcx>, ty: Ty<'tcx>, vtable: & return; } - let type_metadata = type_metadata(cx, ty, syntax_pos::DUMMY_SP); + let type_metadata = type_metadata(cx, ty, rustc_span::DUMMY_SP); unsafe { // `LLVMRustDIBuilderCreateStructType()` wants an empty array. A null @@ -2376,7 +2376,7 @@ pub fn create_vtable_metadata(cx: &CodegenCx<'ll, 'tcx>, ty: Ty<'tcx>, vtable: & pub fn extend_scope_to_file( cx: &CodegenCx<'ll, '_>, scope_metadata: &'ll DIScope, - file: &syntax_pos::SourceFile, + file: &rustc_span::SourceFile, defining_crate: CrateNum, ) -> &'ll DILexicalBlock { let file_metadata = file_metadata(cx, &file.name, defining_crate); diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs index 8c6d1ce695b05..765643113f526 100644 --- a/src/librustc_codegen_llvm/debuginfo/mod.rs +++ b/src/librustc_codegen_llvm/debuginfo/mod.rs @@ -37,10 +37,10 @@ use std::ffi::CString; use rustc::ty::layout::{self, HasTyCtxt, LayoutOf, Size}; use rustc_codegen_ssa::traits::*; +use rustc_span::{self, BytePos, Pos, Span}; use smallvec::SmallVec; use syntax::ast; use syntax::symbol::Symbol; -use syntax_pos::{self, BytePos, Pos, Span}; mod create_scope_map; pub mod gdb; @@ -387,7 +387,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> { signature.push(if fn_abi.ret.is_ignore() { None } else { - Some(type_metadata(cx, fn_abi.ret.layout.ty, syntax_pos::DUMMY_SP)) + Some(type_metadata(cx, fn_abi.ret.layout.ty, rustc_span::DUMMY_SP)) }); // Arguments types @@ -412,14 +412,14 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> { } _ => t, }; - Some(type_metadata(cx, t, syntax_pos::DUMMY_SP)) + Some(type_metadata(cx, t, rustc_span::DUMMY_SP)) })); } else { signature.extend( fn_abi .args .iter() - .map(|arg| Some(type_metadata(cx, arg.layout.ty, syntax_pos::DUMMY_SP))), + .map(|arg| Some(type_metadata(cx, arg.layout.ty, rustc_span::DUMMY_SP))), ); } @@ -462,7 +462,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> { let actual_type = cx.tcx.normalize_erasing_regions(ParamEnv::reveal_all(), ty); let actual_type_metadata = - type_metadata(cx, actual_type, syntax_pos::DUMMY_SP); + type_metadata(cx, actual_type, rustc_span::DUMMY_SP); let name = SmallCStr::new(&name.as_str()); Some(unsafe { Some(llvm::LLVMRustDIBuilderCreateTemplateTypeParameter( @@ -515,7 +515,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> { // so avoid methods on other types (e.g., `<*mut T>::null`). match impl_self_ty.kind { ty::Adt(def, ..) if !def.is_box() => { - Some(type_metadata(cx, impl_self_ty, syntax_pos::DUMMY_SP)) + Some(type_metadata(cx, impl_self_ty, rustc_span::DUMMY_SP)) } _ => None, } @@ -549,7 +549,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> { fn extend_scope_to_file( &self, scope_metadata: &'ll DIScope, - file: &syntax_pos::SourceFile, + file: &rustc_span::SourceFile, defining_crate: CrateNum, ) -> &'ll DILexicalBlock { metadata::extend_scope_to_file(&self, scope_metadata, file, defining_crate) diff --git a/src/librustc_codegen_llvm/debuginfo/source_loc.rs b/src/librustc_codegen_llvm/debuginfo/source_loc.rs index 5fb50e1723649..6afaca44e0e96 100644 --- a/src/librustc_codegen_llvm/debuginfo/source_loc.rs +++ b/src/librustc_codegen_llvm/debuginfo/source_loc.rs @@ -11,7 +11,7 @@ use log::debug; use rustc_codegen_ssa::traits::*; use libc::c_uint; -use syntax_pos::{Pos, Span}; +use rustc_span::{Pos, Span}; /// Sets the current debug location at the beginning of the span. /// diff --git a/src/librustc_codegen_llvm/debuginfo/utils.rs b/src/librustc_codegen_llvm/debuginfo/utils.rs index e77dab998d27d..53497e396cd3e 100644 --- a/src/librustc_codegen_llvm/debuginfo/utils.rs +++ b/src/librustc_codegen_llvm/debuginfo/utils.rs @@ -11,7 +11,7 @@ use crate::llvm; use crate::llvm::debuginfo::{DIArray, DIBuilder, DIDescriptor, DIScope}; use rustc_codegen_ssa::traits::*; -use syntax_pos::Span; +use rustc_span::Span; pub fn is_node_local_to_unit(cx: &CodegenCx<'_, '_>, def_id: DefId) -> bool { // The is_local_to_unit flag indicates whether a function is local to the @@ -32,8 +32,8 @@ pub fn create_DIArray(builder: &DIBuilder<'ll>, arr: &[Option<&'ll DIDescriptor> }; } -/// Returns syntax_pos::Loc corresponding to the beginning of the span -pub fn span_start(cx: &CodegenCx<'_, '_>, span: Span) -> syntax_pos::Loc { +/// Returns rustc_span::Loc corresponding to the beginning of the span +pub fn span_start(cx: &CodegenCx<'_, '_>, span: Span) -> rustc_span::Loc { cx.sess().source_map().lookup_char_pos(span.lo()) } diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index abb17b3b0f116..0e121df1d257e 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -23,7 +23,7 @@ use syntax::ast; use rustc_codegen_ssa::common::span_invalid_monomorphization_error; use rustc_codegen_ssa::traits::*; -use syntax_pos::Span; +use rustc_span::Span; use std::cmp::Ordering; use std::{i128, iter, u128}; diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 2c1c9427e8c36..0b6a2861c42a5 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -21,7 +21,7 @@ #![feature(trusted_len)] use back::write::{create_informational_target_machine, create_target_machine}; -use syntax_pos::symbol::Symbol; +use rustc_span::symbol::Symbol; pub use llvm_util::target_features; use rustc::dep_graph::WorkProduct; diff --git a/src/librustc_codegen_llvm/llvm_util.rs b/src/librustc_codegen_llvm/llvm_util.rs index c4e0baeb04707..b57ca0d09f9c6 100644 --- a/src/librustc_codegen_llvm/llvm_util.rs +++ b/src/librustc_codegen_llvm/llvm_util.rs @@ -6,10 +6,10 @@ use rustc::session::config::PrintRequest; use rustc::session::Session; use rustc_data_structures::fx::FxHashSet; use rustc_feature::UnstableFeatures; +use rustc_span::symbol::Symbol; use rustc_target::spec::{MergeFunctions, PanicStrategy}; use std::ffi::CString; use syntax::symbol::sym; -use syntax_pos::symbol::Symbol; use std::slice; use std::str; diff --git a/src/librustc_codegen_ssa/Cargo.toml b/src/librustc_codegen_ssa/Cargo.toml index 1f20d1fbc2a2d..7eb1ae22397fb 100644 --- a/src/librustc_codegen_ssa/Cargo.toml +++ b/src/librustc_codegen_ssa/Cargo.toml @@ -21,7 +21,7 @@ tempfile = "3.1" rustc_serialize = { path = "../libserialize", package = "serialize" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } rustc = { path = "../librustc" } rustc_apfloat = { path = "../librustc_apfloat" } rustc_codegen_utils = { path = "../librustc_codegen_utils" } diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs index a5a90980c3a23..4e49d4dda935d 100644 --- a/src/librustc_codegen_ssa/back/write.rs +++ b/src/librustc_codegen_ssa/back/write.rs @@ -30,11 +30,11 @@ use rustc_incremental::{ copy_cgu_workproducts_to_incr_comp_cache_dir, in_incr_comp_dir, in_incr_comp_dir_sess, }; use rustc_session::cgu_reuse_tracker::CguReuseTracker; +use rustc_span::hygiene::ExpnId; +use rustc_span::source_map::SourceMap; +use rustc_span::symbol::{sym, Symbol}; use rustc_target::spec::MergeFunctions; use syntax::attr; -use syntax_pos::hygiene::ExpnId; -use syntax_pos::source_map::SourceMap; -use syntax_pos::symbol::{sym, Symbol}; use std::any::Any; use std::fs; diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index 2d783d6d71336..27841d67c1a9a 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -43,8 +43,8 @@ use rustc::util::nodemap::FxHashMap; use rustc_codegen_utils::{check_for_rustc_errors_attr, symbol_names_test}; use rustc_index::vec::Idx; use rustc_session::cgu_reuse_tracker::CguReuse; +use rustc_span::Span; use syntax::attr; -use syntax_pos::Span; use std::cmp; use std::ops::{Deref, DerefMut}; diff --git a/src/librustc_codegen_ssa/common.rs b/src/librustc_codegen_ssa/common.rs index 2cddce21ea99c..e0505daed8a62 100644 --- a/src/librustc_codegen_ssa/common.rs +++ b/src/librustc_codegen_ssa/common.rs @@ -2,7 +2,7 @@ use rustc::session::Session; use rustc::ty::{Ty, TyCtxt}; -use syntax_pos::Span; +use rustc_span::Span; use crate::base; use crate::traits::*; diff --git a/src/librustc_codegen_ssa/lib.rs b/src/librustc_codegen_ssa/lib.rs index 02385bdab7b19..fd31361d67950 100644 --- a/src/librustc_codegen_ssa/lib.rs +++ b/src/librustc_codegen_ssa/lib.rs @@ -34,8 +34,8 @@ use rustc::ty::query::Providers; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::Lrc; +use rustc_span::symbol::Symbol; use std::path::{Path, PathBuf}; -use syntax_pos::symbol::Symbol; pub mod back; pub mod base; diff --git a/src/librustc_codegen_ssa/mir/analyze.rs b/src/librustc_codegen_ssa/mir/analyze.rs index b6a0a9fed4c59..0ceb44d019b64 100644 --- a/src/librustc_codegen_ssa/mir/analyze.rs +++ b/src/librustc_codegen_ssa/mir/analyze.rs @@ -14,7 +14,7 @@ use rustc::ty::layout::{HasTyCtxt, LayoutOf}; use rustc_data_structures::graph::dominators::Dominators; use rustc_index::bit_set::BitSet; use rustc_index::vec::{Idx, IndexVec}; -use syntax_pos::DUMMY_SP; +use rustc_span::DUMMY_SP; pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( fx: &FunctionCx<'a, 'tcx, Bx>, diff --git a/src/librustc_codegen_ssa/mir/debuginfo.rs b/src/librustc_codegen_ssa/mir/debuginfo.rs index 0935b61a86c60..5d26b84b2c931 100644 --- a/src/librustc_codegen_ssa/mir/debuginfo.rs +++ b/src/librustc_codegen_ssa/mir/debuginfo.rs @@ -6,8 +6,8 @@ use rustc::ty::layout::{LayoutOf, Size}; use rustc::ty::TyCtxt; use rustc_index::vec::IndexVec; +use rustc_span::{BytePos, Span}; use syntax::symbol::kw; -use syntax_pos::{BytePos, Span}; use super::OperandValue; use super::{FunctionCx, LocalRef}; @@ -65,7 +65,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // Walk up the macro expansion chain until we reach a non-expanded span. // We also stop at the function body level because no line stepping can occur // at the level above that. - let span = syntax_pos::hygiene::walk_chain(source_info.span, self.mir.span.ctxt()); + let span = rustc_span::hygiene::walk_chain(source_info.span, self.mir.span.ctxt()); let scope = self.scope_metadata_for_loc(source_info.scope, span.lo()); // Use span of the outermost expansion site, while keeping the original lexical scope. (scope, span) diff --git a/src/librustc_codegen_ssa/traits/asm.rs b/src/librustc_codegen_ssa/traits/asm.rs index 612bce2d95854..6af63edbe79ed 100644 --- a/src/librustc_codegen_ssa/traits/asm.rs +++ b/src/librustc_codegen_ssa/traits/asm.rs @@ -1,7 +1,7 @@ use super::BackendTypes; use crate::mir::place::PlaceRef; use rustc::hir::{GlobalAsm, InlineAsmInner}; -use syntax_pos::Span; +use rustc_span::Span; pub trait AsmBuilderMethods<'tcx>: BackendTypes { /// Take an inline assembly expression and splat it out via LLVM diff --git a/src/librustc_codegen_ssa/traits/backend.rs b/src/librustc_codegen_ssa/traits/backend.rs index 595872bd04d2f..e0d0a2f32f331 100644 --- a/src/librustc_codegen_ssa/traits/backend.rs +++ b/src/librustc_codegen_ssa/traits/backend.rs @@ -7,8 +7,8 @@ use rustc::ty::layout::{HasTyCtxt, LayoutOf, TyLayout}; use rustc::ty::Ty; use rustc::ty::TyCtxt; use rustc_codegen_utils::codegen_backend::CodegenBackend; +use rustc_span::symbol::Symbol; use syntax::expand::allocator::AllocatorKind; -use syntax_pos::symbol::Symbol; use std::sync::mpsc; use std::sync::Arc; diff --git a/src/librustc_codegen_ssa/traits/consts.rs b/src/librustc_codegen_ssa/traits/consts.rs index 8c462e77d5e05..608fa5ef71e03 100644 --- a/src/librustc_codegen_ssa/traits/consts.rs +++ b/src/librustc_codegen_ssa/traits/consts.rs @@ -3,7 +3,7 @@ use crate::mir::place::PlaceRef; use rustc::mir::interpret::Allocation; use rustc::mir::interpret::Scalar; use rustc::ty::layout; -use syntax_pos::Symbol; +use rustc_span::Symbol; pub trait ConstMethods<'tcx>: BackendTypes { // Constant constructors diff --git a/src/librustc_codegen_ssa/traits/debuginfo.rs b/src/librustc_codegen_ssa/traits/debuginfo.rs index d78571b140f23..c2e8bad4b2dbe 100644 --- a/src/librustc_codegen_ssa/traits/debuginfo.rs +++ b/src/librustc_codegen_ssa/traits/debuginfo.rs @@ -4,9 +4,9 @@ use rustc::hir::def_id::CrateNum; use rustc::mir; use rustc::ty::layout::Size; use rustc::ty::{Instance, Ty}; +use rustc_span::{SourceFile, Span}; use rustc_target::abi::call::FnAbi; use syntax::ast::Name; -use syntax_pos::{SourceFile, Span}; pub trait DebugInfoMethods<'tcx>: BackendTypes { fn create_vtable_metadata(&self, ty: Ty<'tcx>, vtable: Self::Value); diff --git a/src/librustc_codegen_ssa/traits/intrinsic.rs b/src/librustc_codegen_ssa/traits/intrinsic.rs index 8006d778bd38e..482a76932ae42 100644 --- a/src/librustc_codegen_ssa/traits/intrinsic.rs +++ b/src/librustc_codegen_ssa/traits/intrinsic.rs @@ -1,8 +1,8 @@ use super::BackendTypes; use crate::mir::operand::OperandRef; use rustc::ty::{self, Ty}; +use rustc_span::Span; use rustc_target::abi::call::FnAbi; -use syntax_pos::Span; pub trait IntrinsicCallMethods<'tcx>: BackendTypes { /// Remember to add all intrinsics here, in librustc_typeck/check/mod.rs, diff --git a/src/librustc_codegen_ssa/traits/type_.rs b/src/librustc_codegen_ssa/traits/type_.rs index 6059a6d5b6c19..0d644e6dd30b3 100644 --- a/src/librustc_codegen_ssa/traits/type_.rs +++ b/src/librustc_codegen_ssa/traits/type_.rs @@ -5,8 +5,8 @@ use crate::common::TypeKind; use crate::mir::place::PlaceRef; use rustc::ty::layout::{self, TyLayout}; use rustc::ty::{self, Ty}; +use rustc_span::DUMMY_SP; use rustc_target::abi::call::{ArgAbi, CastTarget, FnAbi, Reg}; -use syntax_pos::DUMMY_SP; // This depends on `Backend` and not `BackendTypes`, because consumers will probably want to use // `LayoutOf` or `HasTyCtxt`. This way, they don't have to add a constraint on it themselves. diff --git a/src/librustc_codegen_utils/Cargo.toml b/src/librustc_codegen_utils/Cargo.toml index 09c6dfe5dc0de..404e556cd524e 100644 --- a/src/librustc_codegen_utils/Cargo.toml +++ b/src/librustc_codegen_utils/Cargo.toml @@ -15,7 +15,7 @@ punycode = "0.4.0" rustc-demangle = "0.1.16" syntax = { path = "../libsyntax" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } rustc = { path = "../librustc" } rustc_target = { path = "../librustc_target" } rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/librustc_codegen_utils/link.rs b/src/librustc_codegen_utils/link.rs index 89a68d775f20f..d56027f460842 100644 --- a/src/librustc_codegen_utils/link.rs +++ b/src/librustc_codegen_utils/link.rs @@ -1,9 +1,9 @@ use rustc::session::config::{self, Input, OutputFilenames, OutputType}; use rustc::session::Session; +use rustc_span::Span; use std::path::{Path, PathBuf}; use syntax::symbol::sym; use syntax::{ast, attr}; -use syntax_pos::Span; pub fn out_filename( sess: &Session, diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs index bd714f5c6b715..533ce620b678c 100644 --- a/src/librustc_codegen_utils/symbol_names.rs +++ b/src/librustc_codegen_utils/symbol_names.rs @@ -95,7 +95,7 @@ use rustc::session::config::SymbolManglingVersion; use rustc::ty::query::Providers; use rustc::ty::{self, Instance, TyCtxt}; -use syntax_pos::symbol::Symbol; +use rustc_span::symbol::Symbol; use log::debug; diff --git a/src/librustc_driver/Cargo.toml b/src/librustc_driver/Cargo.toml index c005ea12cef38..99436f427cb00 100644 --- a/src/librustc_driver/Cargo.toml +++ b/src/librustc_driver/Cargo.toml @@ -31,7 +31,7 @@ rustc_interface = { path = "../librustc_interface" } rustc_serialize = { path = "../libserialize", package = "serialize" } rustc_resolve = { path = "../librustc_resolve" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } [features] llvm = ['rustc_interface/llvm'] diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index adcf6ae2a7c45..94636725646e2 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -58,10 +58,10 @@ use std::process::{self, Command, Stdio}; use std::str; use std::time::Instant; +use rustc_span::source_map::FileLoader; +use rustc_span::symbol::sym; +use rustc_span::FileName; use syntax::ast; -use syntax_pos::source_map::FileLoader; -use syntax_pos::symbol::sym; -use syntax_pos::FileName; mod args; pub mod pretty; diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 87ce637c6f5c4..84fa5fb786bfb 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -10,9 +10,9 @@ use rustc::ty::{self, TyCtxt}; use rustc::util::common::ErrorReported; use rustc_mir::util::{write_mir_graphviz, write_mir_pretty}; +use rustc_span::FileName; use syntax::ast; use syntax::print::pprust; -use syntax_pos::FileName; use std::cell::Cell; use std::fs::File; @@ -298,7 +298,7 @@ impl<'a> pprust::PpAnn for HygieneAnnotation<'a> { pprust::AnnNode::Crate(_) => { s.s.hardbreak(); let verbose = self.sess.verbose(); - s.synth_comment(syntax_pos::hygiene::debug_hygiene_data(verbose)); + s.synth_comment(rustc_span::hygiene::debug_hygiene_data(verbose)); s.s.hardbreak_if_not_bol(); } _ => {} diff --git a/src/librustc_errors/Cargo.toml b/src/librustc_errors/Cargo.toml index 8a21150570abd..0d0989677c585 100644 --- a/src/librustc_errors/Cargo.toml +++ b/src/librustc_errors/Cargo.toml @@ -12,7 +12,7 @@ doctest = false [dependencies] log = "0.4" rustc_serialize = { path = "../libserialize", package = "serialize" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } rustc_data_structures = { path = "../librustc_data_structures" } unicode-width = "0.1.4" atty = "0.2" diff --git a/src/librustc_errors/annotate_snippet_emitter_writer.rs b/src/librustc_errors/annotate_snippet_emitter_writer.rs index e63e124fbc5d8..7413cef6d32d4 100644 --- a/src/librustc_errors/annotate_snippet_emitter_writer.rs +++ b/src/librustc_errors/annotate_snippet_emitter_writer.rs @@ -12,8 +12,8 @@ use annotate_snippets::display_list::DisplayList; use annotate_snippets::formatter::DisplayListFormatter; use annotate_snippets::snippet::*; use rustc_data_structures::sync::Lrc; -use syntax_pos::source_map::SourceMap; -use syntax_pos::{Loc, MultiSpan, SourceFile}; +use rustc_span::source_map::SourceMap; +use rustc_span::{Loc, MultiSpan, SourceFile}; /// Generates diagnostics using annotate-snippet pub struct AnnotateSnippetEmitterWriter { diff --git a/src/librustc_errors/diagnostic.rs b/src/librustc_errors/diagnostic.rs index 6112269ef7fec..5286e8c19b462 100644 --- a/src/librustc_errors/diagnostic.rs +++ b/src/librustc_errors/diagnostic.rs @@ -5,8 +5,8 @@ use crate::Level; use crate::Substitution; use crate::SubstitutionPart; use crate::SuggestionStyle; +use rustc_span::{MultiSpan, Span, DUMMY_SP}; use std::fmt; -use syntax_pos::{MultiSpan, Span, DUMMY_SP}; #[must_use] #[derive(Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)] diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index ef3a4a9a7080d..79ec9ad7b0329 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -2,10 +2,10 @@ use crate::{Applicability, Handler, Level, StashKey}; use crate::{Diagnostic, DiagnosticId, DiagnosticStyledString}; use log::debug; +use rustc_span::{MultiSpan, Span}; use std::fmt::{self, Debug}; use std::ops::{Deref, DerefMut}; use std::thread::panicking; -use syntax_pos::{MultiSpan, Span}; /// Used for emitting structured error messages and other diagnostic information. /// diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index fdac4390b2675..541b89e6fce5f 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -9,8 +9,8 @@ use Destination::*; -use syntax_pos::source_map::SourceMap; -use syntax_pos::{MultiSpan, SourceFile, Span}; +use rustc_span::source_map::SourceMap; +use rustc_span::{MultiSpan, SourceFile, Span}; use crate::snippet::{Annotation, AnnotationType, Line, MultilineAnnotation, Style, StyledString}; use crate::styled_buffer::StyledBuffer; diff --git a/src/librustc_errors/json.rs b/src/librustc_errors/json.rs index 5f529c08c7836..29d3122636e62 100644 --- a/src/librustc_errors/json.rs +++ b/src/librustc_errors/json.rs @@ -9,7 +9,7 @@ // FIXME: spec the JSON output properly. -use syntax_pos::source_map::{FilePathMapping, SourceMap}; +use rustc_span::source_map::{FilePathMapping, SourceMap}; use crate::emitter::{Emitter, HumanReadableErrorType}; use crate::registry::Registry; @@ -17,11 +17,11 @@ use crate::{Applicability, DiagnosticId}; use crate::{CodeSuggestion, SubDiagnostic}; use rustc_data_structures::sync::Lrc; +use rustc_span::{MacroBacktrace, MultiSpan, Span, SpanLabel}; use std::io::{self, Write}; use std::path::Path; use std::sync::{Arc, Mutex}; use std::vec; -use syntax_pos::{MacroBacktrace, MultiSpan, Span, SpanLabel}; use rustc_serialize::json::{as_json, as_pretty_json}; @@ -378,7 +378,7 @@ impl DiagnosticSpan { impl DiagnosticSpanLine { fn line_from_source_file( - fm: &syntax_pos::SourceFile, + fm: &rustc_span::SourceFile, index: usize, h_start: usize, h_end: usize, diff --git a/src/librustc_errors/json/tests.rs b/src/librustc_errors/json/tests.rs index a96bf715858f3..35912901d688a 100644 --- a/src/librustc_errors/json/tests.rs +++ b/src/librustc_errors/json/tests.rs @@ -1,12 +1,12 @@ use super::*; use crate::json::JsonEmitter; -use syntax_pos::source_map::{FilePathMapping, SourceMap}; +use rustc_span::source_map::{FilePathMapping, SourceMap}; use crate::emitter::{ColorConfig, HumanReadableErrorType}; use crate::Handler; use rustc_serialize::json::decode; -use syntax_pos::{BytePos, Span}; +use rustc_span::{BytePos, Span}; use std::str; @@ -40,8 +40,8 @@ impl Write for Shared { } fn with_default_globals(f: impl FnOnce()) { - let globals = syntax_pos::Globals::new(syntax_pos::edition::DEFAULT_EDITION); - syntax_pos::GLOBALS.set(&globals, || syntax_pos::GLOBALS.set(&globals, f)) + let globals = rustc_span::Globals::new(rustc_span::edition::DEFAULT_EDITION); + rustc_span::GLOBALS.set(&globals, || rustc_span::GLOBALS.set(&globals, f)) } /// Test the span yields correct positions in JSON. diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 53a673714a90a..aa2865a75f9ae 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -18,8 +18,8 @@ use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; use rustc_data_structures::stable_hasher::StableHasher; use rustc_data_structures::sync::{self, Lock, Lrc}; use rustc_data_structures::AtomicRef; -use syntax_pos::source_map::SourceMap; -use syntax_pos::{Loc, MultiSpan, Span}; +use rustc_span::source_map::SourceMap; +use rustc_span::{Loc, MultiSpan, Span}; use std::borrow::Cow; use std::panic; @@ -146,7 +146,7 @@ impl CodeSuggestion { /// Returns the assembled code suggestions, whether they should be shown with an underline /// and whether the substitution only differs in capitalization. pub fn splice_lines(&self, cm: &SourceMap) -> Vec<(String, Vec, bool)> { - use syntax_pos::{CharPos, Pos}; + use rustc_span::{CharPos, Pos}; fn push_trailing( buf: &mut String, @@ -240,7 +240,7 @@ impl CodeSuggestion { } } -pub use syntax_pos::fatal_error::{FatalError, FatalErrorMarker}; +pub use rustc_span::fatal_error::{FatalError, FatalErrorMarker}; /// Signifies that the compiler died with an explicit call to `.bug` /// or `.span_bug` rather than a failed assertion, etc. diff --git a/src/librustc_expand/Cargo.toml b/src/librustc_expand/Cargo.toml index 36273ec0806ba..f9c15fbed362f 100644 --- a/src/librustc_expand/Cargo.toml +++ b/src/librustc_expand/Cargo.toml @@ -13,7 +13,7 @@ doctest = false [dependencies] rustc_serialize = { path = "../libserialize", package = "serialize" } log = "0.4" -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_feature = { path = "../librustc_feature" } diff --git a/src/librustc_expand/base.rs b/src/librustc_expand/base.rs index 60bc591c09587..acf90651080d2 100644 --- a/src/librustc_expand/base.rs +++ b/src/librustc_expand/base.rs @@ -16,16 +16,16 @@ use syntax::visit::Visitor; use errors::{DiagnosticBuilder, DiagnosticId}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::{self, Lrc}; +use rustc_span::hygiene::{AstPass, ExpnData, ExpnId, ExpnKind}; +use rustc_span::{FileName, MultiSpan, Span, DUMMY_SP}; use smallvec::{smallvec, SmallVec}; -use syntax_pos::hygiene::{AstPass, ExpnData, ExpnId, ExpnKind}; -use syntax_pos::{FileName, MultiSpan, Span, DUMMY_SP}; use std::default::Default; use std::iter; use std::path::PathBuf; use std::rc::Rc; -crate use syntax_pos::hygiene::MacroKind; +crate use rustc_span::hygiene::MacroKind; #[derive(Debug, Clone)] pub enum Annotatable { diff --git a/src/librustc_expand/build.rs b/src/librustc_expand/build.rs index 96020acb3b4eb..3375efe41f133 100644 --- a/src/librustc_expand/build.rs +++ b/src/librustc_expand/build.rs @@ -6,7 +6,7 @@ use syntax::ptr::P; use syntax::source_map::{respan, Spanned}; use syntax::symbol::{kw, sym, Symbol}; -use syntax_pos::{Pos, Span}; +use rustc_span::{Pos, Span}; impl<'a> ExtCtxt<'a> { pub fn path(&self, span: Span, strs: Vec) -> ast::Path { diff --git a/src/librustc_expand/expand.rs b/src/librustc_expand/expand.rs index 089dd471f3b50..6ac4456c43e08 100644 --- a/src/librustc_expand/expand.rs +++ b/src/librustc_expand/expand.rs @@ -26,8 +26,8 @@ use syntax::util::map_in_place::MapInPlace; use syntax::visit::{self, Visitor}; use errors::{Applicability, FatalError, PResult}; +use rustc_span::{FileName, Span, DUMMY_SP}; use smallvec::{smallvec, SmallVec}; -use syntax_pos::{FileName, Span, DUMMY_SP}; use rustc_data_structures::sync::Lrc; use std::io::ErrorKind; diff --git a/src/librustc_expand/lib.rs b/src/librustc_expand/lib.rs index 258a747832920..feba7f633ed80 100644 --- a/src/librustc_expand/lib.rs +++ b/src/librustc_expand/lib.rs @@ -29,7 +29,7 @@ mod placeholders; mod proc_macro_server; pub use mbe::macro_rules::compile_declarative_macro; -crate use syntax_pos::hygiene; +crate use rustc_span::hygiene; pub mod base; pub mod build; pub mod expand; diff --git a/src/librustc_expand/mbe.rs b/src/librustc_expand/mbe.rs index 0473b65342472..fe207a4c87687 100644 --- a/src/librustc_expand/mbe.rs +++ b/src/librustc_expand/mbe.rs @@ -13,7 +13,7 @@ use syntax::ast; use syntax::token::{self, Token, TokenKind}; use syntax::tokenstream::DelimSpan; -use syntax_pos::Span; +use rustc_span::Span; use rustc_data_structures::sync::Lrc; diff --git a/src/librustc_expand/mbe/macro_check.rs b/src/librustc_expand/mbe/macro_check.rs index 616fddd3c1c92..819ae02d28233 100644 --- a/src/librustc_expand/mbe/macro_check.rs +++ b/src/librustc_expand/mbe/macro_check.rs @@ -113,8 +113,8 @@ use syntax::symbol::{kw, sym}; use syntax::token::{DelimToken, Token, TokenKind}; use rustc_data_structures::fx::FxHashMap; +use rustc_span::{symbol::Ident, MultiSpan, Span}; use smallvec::SmallVec; -use syntax_pos::{symbol::Ident, MultiSpan, Span}; /// Stack represented as linked list. /// diff --git a/src/librustc_expand/mbe/macro_parser.rs b/src/librustc_expand/mbe/macro_parser.rs index 37374d7071927..0585f4f46b9af 100644 --- a/src/librustc_expand/mbe/macro_parser.rs +++ b/src/librustc_expand/mbe/macro_parser.rs @@ -86,8 +86,8 @@ use syntax::token::{self, DocComment, Nonterminal, Token}; use syntax::tokenstream::TokenStream; use errors::{FatalError, PResult}; +use rustc_span::Span; use smallvec::{smallvec, SmallVec}; -use syntax_pos::Span; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::Lrc; @@ -270,7 +270,7 @@ crate enum ParseResult { /// end of macro invocation. Otherwise, it indicates that no rules expected the given token. Failure(Token, &'static str), /// Fatal error (malformed macro?). Abort compilation. - Error(syntax_pos::Span, String), + Error(rustc_span::Span, String), } /// A `ParseResult` where the `Success` variant contains a mapping of `Ident`s to `NamedMatch`es. @@ -369,7 +369,7 @@ fn nameize>( m: &TokenTree, res: &mut I, ret_val: &mut FxHashMap, - ) -> Result<(), (syntax_pos::Span, String)> { + ) -> Result<(), (rustc_span::Span, String)> { match *m { TokenTree::Sequence(_, ref seq) => { for next_m in &seq.tts { diff --git a/src/librustc_expand/mbe/macro_rules.rs b/src/librustc_expand/mbe/macro_rules.rs index 2b2ed8c9248a5..826cb43294a10 100644 --- a/src/librustc_expand/mbe/macro_rules.rs +++ b/src/librustc_expand/mbe/macro_rules.rs @@ -11,6 +11,8 @@ use crate::mbe::transcribe::transcribe; use rustc_feature::Features; use rustc_parse::parser::Parser; use rustc_parse::Directory; +use rustc_span::hygiene::Transparency; +use rustc_span::Span; use syntax::ast; use syntax::attr::{self, TransparencyError}; use syntax::edition::Edition; @@ -19,8 +21,6 @@ use syntax::sess::ParseSess; use syntax::symbol::{kw, sym, Symbol}; use syntax::token::{self, NtTT, Token, TokenKind::*}; use syntax::tokenstream::{DelimSpan, TokenStream}; -use syntax_pos::hygiene::Transparency; -use syntax_pos::Span; use errors::{DiagnosticBuilder, FatalError}; use log::debug; diff --git a/src/librustc_expand/mbe/quoted.rs b/src/librustc_expand/mbe/quoted.rs index 56b97cbb7c6b9..99026a7a09ea1 100644 --- a/src/librustc_expand/mbe/quoted.rs +++ b/src/librustc_expand/mbe/quoted.rs @@ -8,7 +8,7 @@ use syntax::symbol::kw; use syntax::token::{self, Token}; use syntax::tokenstream; -use syntax_pos::Span; +use rustc_span::Span; use rustc_data_structures::sync::Lrc; diff --git a/src/librustc_expand/mbe/transcribe.rs b/src/librustc_expand/mbe/transcribe.rs index 0605f7ff36df7..4fd68a80de81d 100644 --- a/src/librustc_expand/mbe/transcribe.rs +++ b/src/librustc_expand/mbe/transcribe.rs @@ -12,8 +12,8 @@ use smallvec::{smallvec, SmallVec}; use errors::pluralize; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::Lrc; -use syntax_pos::hygiene::{ExpnId, Transparency}; -use syntax_pos::Span; +use rustc_span::hygiene::{ExpnId, Transparency}; +use rustc_span::Span; use std::mem; diff --git a/src/librustc_expand/parse/lexer/tests.rs b/src/librustc_expand/parse/lexer/tests.rs index 2ca0224812bab..521aec335e1a4 100644 --- a/src/librustc_expand/parse/lexer/tests.rs +++ b/src/librustc_expand/parse/lexer/tests.rs @@ -1,12 +1,12 @@ use rustc_data_structures::sync::Lrc; use rustc_parse::lexer::StringReader; +use rustc_span::symbol::Symbol; +use rustc_span::{BytePos, Span}; use syntax::sess::ParseSess; use syntax::source_map::{FilePathMapping, SourceMap}; use syntax::token::{self, Token, TokenKind}; use syntax::util::comments::is_doc_comment; use syntax::with_default_globals; -use syntax_pos::symbol::Symbol; -use syntax_pos::{BytePos, Span}; use errors::{emitter::EmitterWriter, Handler}; use std::io; diff --git a/src/librustc_expand/parse/tests.rs b/src/librustc_expand/parse/tests.rs index 833fda6a2ebe4..de7be2542eeff 100644 --- a/src/librustc_expand/parse/tests.rs +++ b/src/librustc_expand/parse/tests.rs @@ -2,6 +2,7 @@ use crate::tests::{matches_codepattern, string_to_stream, with_error_checking_pa use errors::PResult; use rustc_parse::new_parser_from_source_str; +use rustc_span::{BytePos, FileName, Pos, Span}; use syntax::ast::{self, Name, PatKind}; use syntax::print::pprust::item_to_string; use syntax::ptr::P; @@ -12,7 +13,6 @@ use syntax::token::{self, Token}; use syntax::tokenstream::{DelimSpan, TokenStream, TokenTree}; use syntax::visit; use syntax::with_default_globals; -use syntax_pos::{BytePos, FileName, Pos, Span}; use std::path::PathBuf; @@ -32,7 +32,7 @@ fn parse_item_from_source_str( new_parser_from_source_str(sess, name, source).parse_item() } -// Produces a `syntax_pos::span`. +// Produces a `rustc_span::span`. fn sp(a: u32, b: u32) -> Span { Span::with_root_ctxt(BytePos(a), BytePos(b)) } diff --git a/src/librustc_expand/proc_macro.rs b/src/librustc_expand/proc_macro.rs index 9f42ec13b5655..2776bc647337b 100644 --- a/src/librustc_expand/proc_macro.rs +++ b/src/librustc_expand/proc_macro.rs @@ -8,7 +8,7 @@ use syntax::token; use syntax::tokenstream::{self, TokenStream}; use rustc_data_structures::sync::Lrc; -use syntax_pos::{Span, DUMMY_SP}; +use rustc_span::{Span, DUMMY_SP}; const EXEC_STRATEGY: pm::bridge::server::SameThread = pm::bridge::server::SameThread; diff --git a/src/librustc_expand/proc_macro_server.rs b/src/librustc_expand/proc_macro_server.rs index b41490011af3f..cf5749f506856 100644 --- a/src/librustc_expand/proc_macro_server.rs +++ b/src/librustc_expand/proc_macro_server.rs @@ -2,14 +2,14 @@ use crate::base::ExtCtxt; use rustc_parse::lexer::nfc_normalize; use rustc_parse::{nt_to_tokenstream, parse_stream_from_source_str}; +use rustc_span::symbol::{kw, sym, Symbol}; +use rustc_span::{BytePos, FileName, MultiSpan, Pos, SourceFile, Span}; use syntax::ast; use syntax::print::pprust; use syntax::sess::ParseSess; use syntax::token; use syntax::tokenstream::{self, DelimSpan, IsJoint::*, TokenStream, TreeAndJoint}; use syntax::util::comments; -use syntax_pos::symbol::{kw, sym, Symbol}; -use syntax_pos::{BytePos, FileName, MultiSpan, Pos, SourceFile, Span}; use errors::Diagnostic; use rustc_data_structures::sync::Lrc; diff --git a/src/librustc_expand/tests.rs b/src/librustc_expand/tests.rs index 4f5ff97e48d23..a1ec6d674cc5e 100644 --- a/src/librustc_expand/tests.rs +++ b/src/librustc_expand/tests.rs @@ -1,10 +1,10 @@ use rustc_parse::{new_parser_from_source_str, parser::Parser, source_file_to_stream}; +use rustc_span::{BytePos, MultiSpan, Span}; use syntax::ast; use syntax::sess::ParseSess; use syntax::source_map::{FilePathMapping, SourceMap}; use syntax::tokenstream::TokenStream; use syntax::with_default_globals; -use syntax_pos::{BytePos, MultiSpan, Span}; use errors::emitter::EmitterWriter; use errors::{Handler, PResult}; diff --git a/src/librustc_expand/tokenstream/tests.rs b/src/librustc_expand/tokenstream/tests.rs index e13999320df95..287c168f76a19 100644 --- a/src/librustc_expand/tokenstream/tests.rs +++ b/src/librustc_expand/tokenstream/tests.rs @@ -1,11 +1,11 @@ use crate::tests::string_to_stream; +use rustc_span::{BytePos, Span}; use smallvec::smallvec; use syntax::ast::Name; use syntax::token; use syntax::tokenstream::{TokenStream, TokenStreamBuilder, TokenTree}; use syntax::with_default_globals; -use syntax_pos::{BytePos, Span}; fn string_to_ts(string: &str) -> TokenStream { string_to_stream(string.to_owned()) diff --git a/src/librustc_feature/Cargo.toml b/src/librustc_feature/Cargo.toml index e9e3e471ce662..96fd15ef3044c 100644 --- a/src/librustc_feature/Cargo.toml +++ b/src/librustc_feature/Cargo.toml @@ -12,4 +12,4 @@ doctest = false [dependencies] rustc_data_structures = { path = "../librustc_data_structures" } lazy_static = "1.0.0" -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } diff --git a/src/librustc_feature/accepted.rs b/src/librustc_feature/accepted.rs index 144a3faaba50a..d880fc84b3819 100644 --- a/src/librustc_feature/accepted.rs +++ b/src/librustc_feature/accepted.rs @@ -1,7 +1,7 @@ //! List of the accepted feature gates. use super::{Feature, State}; -use syntax_pos::symbol::sym; +use rustc_span::symbol::sym; macro_rules! declare_features { ($( diff --git a/src/librustc_feature/active.rs b/src/librustc_feature/active.rs index 708e48fe6add1..8cb1684491bb8 100644 --- a/src/librustc_feature/active.rs +++ b/src/librustc_feature/active.rs @@ -2,9 +2,9 @@ use super::{Feature, State}; -use syntax_pos::edition::Edition; -use syntax_pos::symbol::{sym, Symbol}; -use syntax_pos::Span; +use rustc_span::edition::Edition; +use rustc_span::symbol::{sym, Symbol}; +use rustc_span::Span; macro_rules! set { ($field: ident) => {{ diff --git a/src/librustc_feature/builtin_attrs.rs b/src/librustc_feature/builtin_attrs.rs index 5ae87d9712da8..3cbf96b6d29a1 100644 --- a/src/librustc_feature/builtin_attrs.rs +++ b/src/librustc_feature/builtin_attrs.rs @@ -7,7 +7,7 @@ use crate::{Features, Stability}; use lazy_static::lazy_static; use rustc_data_structures::fx::FxHashMap; -use syntax_pos::symbol::{sym, Symbol}; +use rustc_span::symbol::{sym, Symbol}; type GateFn = fn(&Features) -> bool; diff --git a/src/librustc_feature/lib.rs b/src/librustc_feature/lib.rs index b85feee040ceb..71a464279253b 100644 --- a/src/librustc_feature/lib.rs +++ b/src/librustc_feature/lib.rs @@ -15,9 +15,9 @@ mod active; mod builtin_attrs; mod removed; +use rustc_span::{edition::Edition, symbol::Symbol, Span}; use std::fmt; use std::num::NonZeroU32; -use syntax_pos::{edition::Edition, symbol::Symbol, Span}; #[derive(Clone, Copy)] pub enum State { diff --git a/src/librustc_feature/removed.rs b/src/librustc_feature/removed.rs index 5512e1247aa3a..1eeedd7721416 100644 --- a/src/librustc_feature/removed.rs +++ b/src/librustc_feature/removed.rs @@ -1,7 +1,7 @@ //! List of the removed feature gates. use super::{Feature, State}; -use syntax_pos::symbol::sym; +use rustc_span::symbol::sym; macro_rules! declare_features { ($( diff --git a/src/librustc_incremental/Cargo.toml b/src/librustc_incremental/Cargo.toml index 3fd67395b6b9a..3e5570847fa5e 100644 --- a/src/librustc_incremental/Cargo.toml +++ b/src/librustc_incremental/Cargo.toml @@ -17,6 +17,6 @@ rustc = { path = "../librustc" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_serialize = { path = "../libserialize", package = "serialize" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } rustc_fs_util = { path = "../librustc_fs_util" } rustc_session = { path = "../librustc_session" } diff --git a/src/librustc_incremental/assert_dep_graph.rs b/src/librustc_incremental/assert_dep_graph.rs index 4b6244bb6e2c6..19b5f985f13b8 100644 --- a/src/librustc_incremental/assert_dep_graph.rs +++ b/src/librustc_incremental/assert_dep_graph.rs @@ -42,11 +42,11 @@ use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::ty::TyCtxt; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::graph::implementation::{Direction, NodeIndex, INCOMING, OUTGOING}; +use rustc_span::Span; use std::env; use std::fs::{self, File}; use std::io::Write; use syntax::{ast, symbol::sym}; -use syntax_pos::Span; pub fn assert_dep_graph(tcx: TyCtxt<'_>) { tcx.dep_graph.with_ignore(|| { diff --git a/src/librustc_incremental/persist/dirty_clean.rs b/src/librustc_incremental/persist/dirty_clean.rs index 2f67dbd69c4da..2ce782a98585d 100644 --- a/src/librustc_incremental/persist/dirty_clean.rs +++ b/src/librustc_incremental/persist/dirty_clean.rs @@ -23,11 +23,11 @@ use rustc::hir::{ImplItemKind, ItemKind as HirItem, TraitItemKind}; use rustc::ty::TyCtxt; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashSet; +use rustc_span::Span; use std::iter::FromIterator; use std::vec::Vec; use syntax::ast::{self, Attribute, NestedMetaItem}; use syntax::symbol::{sym, Symbol}; -use syntax_pos::Span; const EXCEPT: Symbol = sym::except; const LABEL: Symbol = sym::label; diff --git a/src/librustc_interface/Cargo.toml b/src/librustc_interface/Cargo.toml index 4926cb230814d..9e2fae178d552 100644 --- a/src/librustc_interface/Cargo.toml +++ b/src/librustc_interface/Cargo.toml @@ -17,7 +17,7 @@ syntax = { path = "../libsyntax" } rustc_builtin_macros = { path = "../librustc_builtin_macros" } rustc_expand = { path = "../librustc_expand" } rustc_parse = { path = "../librustc_parse" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } rustc_serialize = { path = "../libserialize", package = "serialize" } rustc = { path = "../librustc" } rustc_ast_lowering = { path = "../librustc_ast_lowering" } diff --git a/src/librustc_interface/callbacks.rs b/src/librustc_interface/callbacks.rs index 28e687a378646..1ed8d66863c81 100644 --- a/src/librustc_interface/callbacks.rs +++ b/src/librustc_interface/callbacks.rs @@ -11,17 +11,17 @@ use rustc::ty::tls; use rustc_errors::{Diagnostic, TRACK_DIAGNOSTICS}; +use rustc_span; use std::fmt; -use syntax_pos; /// This is a callback from libsyntax as it cannot access the implicit state /// in librustc otherwise. -fn span_debug(span: syntax_pos::Span, f: &mut fmt::Formatter<'_>) -> fmt::Result { +fn span_debug(span: rustc_span::Span, f: &mut fmt::Formatter<'_>) -> fmt::Result { tls::with_opt(|tcx| { if let Some(tcx) = tcx { write!(f, "{}", tcx.sess.source_map().span_to_string(span)) } else { - syntax_pos::default_span_debug(span, f) + rustc_span::default_span_debug(span, f) } }) } @@ -43,6 +43,6 @@ fn track_diagnostic(diagnostic: &Diagnostic) { /// Sets up the callbacks in prior crates which we want to refer to the /// TyCtxt in. pub fn setup_callbacks() { - syntax_pos::SPAN_DEBUG.swap(&(span_debug as fn(_, &mut fmt::Formatter<'_>) -> _)); + rustc_span::SPAN_DEBUG.swap(&(span_debug as fn(_, &mut fmt::Formatter<'_>) -> _)); TRACK_DIAGNOSTICS.swap(&(track_diagnostic as fn(&_))); } diff --git a/src/librustc_interface/interface.rs b/src/librustc_interface/interface.rs index 62dd2db709965..9cfd30eab29ea 100644 --- a/src/librustc_interface/interface.rs +++ b/src/librustc_interface/interface.rs @@ -13,6 +13,7 @@ use rustc_data_structures::sync::Lrc; use rustc_data_structures::OnDrop; use rustc_errors::registry::Registry; use rustc_parse::new_parser_from_source_str; +use rustc_span::edition; use std::path::PathBuf; use std::result; use std::sync::{Arc, Mutex}; @@ -20,7 +21,6 @@ use syntax::ast::{self, MetaItemKind}; use syntax::sess::ParseSess; use syntax::source_map::{FileLoader, FileName, SourceMap}; use syntax::token; -use syntax_pos::edition; pub type Result = result::Result; diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index c412aa17e4e59..4d15424112e5c 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -33,6 +33,7 @@ use rustc_passes::{self, ast_validation, hir_stats, layout_test}; use rustc_plugin_impl as plugin; use rustc_privacy; use rustc_resolve::{Resolver, ResolverArenas}; +use rustc_span::FileName; use rustc_traits; use rustc_typeck as typeck; use syntax::early_buffered_lints::BufferedEarlyLint; @@ -40,7 +41,6 @@ use syntax::mut_visit::MutVisitor; use syntax::symbol::Symbol; use syntax::util::node_count::NodeCounter; use syntax::{self, ast, visit}; -use syntax_pos::FileName; use rustc_serialize::json; use tempfile::Builder as TempFileBuilder; @@ -470,7 +470,7 @@ pub fn lower_to_hir<'res, 'tcx>( // Discard hygiene data, which isn't required after lowering to HIR. if !sess.opts.debugging_opts.keep_hygiene_data { - syntax_pos::hygiene::clear_syntax_context_map(); + rustc_span::hygiene::clear_syntax_context_map(); } Ok(hir_forest) diff --git a/src/librustc_interface/util.rs b/src/librustc_interface/util.rs index ccc2dcabec2c5..091cf3681fa7c 100644 --- a/src/librustc_interface/util.rs +++ b/src/librustc_interface/util.rs @@ -14,6 +14,7 @@ use rustc_data_structures::sync::{Lock, Lrc}; use rustc_errors::registry::Registry; use rustc_metadata::dynamic_lib::DynamicLibrary; use rustc_resolve::{self, Resolver}; +use rustc_span::edition::Edition; use smallvec::SmallVec; use std::env; use std::io::{self, Write}; @@ -30,7 +31,6 @@ use syntax::source_map::{FileLoader, RealFileLoader, SourceMap}; use syntax::symbol::{sym, Symbol}; use syntax::util::lev_distance::find_best_match_for_name; use syntax::{self, ast, attr}; -use syntax_pos::edition::Edition; /// Adds `target_feature = "..."` cfgs for a variety of platform /// specific features (SSE, NEON etc.). @@ -186,14 +186,14 @@ pub fn spawn_thread_pool R + Send, R: Send>( syntax::with_globals(edition, || { syntax::GLOBALS.with(|syntax_globals| { - syntax_pos::GLOBALS.with(|syntax_pos_globals| { + rustc_span::GLOBALS.with(|rustc_span_globals| { // The main handler runs for each Rayon worker thread and sets up - // the thread local rustc uses. syntax_globals and syntax_pos_globals are + // the thread local rustc uses. syntax_globals and rustc_span_globals are // captured and set on the new threads. ty::tls::with_thread_locals sets up // thread local callbacks from libsyntax let main_handler = move |thread: ThreadBuilder| { syntax::GLOBALS.set(syntax_globals, || { - syntax_pos::GLOBALS.set(syntax_pos_globals, || { + rustc_span::GLOBALS.set(rustc_span_globals, || { if let Some(stderr) = stderr { io::set_panic(Some(box Sink(stderr.clone()))); } @@ -718,7 +718,7 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a, '_> { stmts: s.into_iter().collect(), rules, id: resolver.next_node_id(), - span: syntax_pos::DUMMY_SP, + span: rustc_span::DUMMY_SP, } } @@ -726,14 +726,14 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a, '_> { let expr = P(ast::Expr { id: resolver.next_node_id(), kind: ast::ExprKind::Block(P(b), None), - span: syntax_pos::DUMMY_SP, + span: rustc_span::DUMMY_SP, attrs: AttrVec::new(), }); ast::Stmt { id: resolver.next_node_id(), kind: ast::StmtKind::Expr(expr), - span: syntax_pos::DUMMY_SP, + span: rustc_span::DUMMY_SP, } } @@ -741,13 +741,13 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a, '_> { let loop_expr = P(ast::Expr { kind: ast::ExprKind::Loop(P(empty_block), None), id: self.resolver.next_node_id(), - span: syntax_pos::DUMMY_SP, + span: rustc_span::DUMMY_SP, attrs: AttrVec::new(), }); let loop_stmt = ast::Stmt { id: self.resolver.next_node_id(), - span: syntax_pos::DUMMY_SP, + span: rustc_span::DUMMY_SP, kind: ast::StmtKind::Expr(loop_expr), }; diff --git a/src/librustc_lint/Cargo.toml b/src/librustc_lint/Cargo.toml index 049ea6fa1829b..600f7031ed5c0 100644 --- a/src/librustc_lint/Cargo.toml +++ b/src/librustc_lint/Cargo.toml @@ -13,7 +13,7 @@ log = "0.4" rustc = { path = "../librustc" } rustc_target = { path = "../librustc_target" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_feature = { path = "../librustc_feature" } rustc_index = { path = "../librustc_index" } diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 9cf49f8ab4b09..6e5a0f549158f 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -37,6 +37,7 @@ use rustc::util::nodemap::FxHashSet; use rustc_feature::Stability; use rustc_feature::{deprecated_attributes, AttributeGate, AttributeTemplate, AttributeType}; +use rustc_span::{BytePos, Span}; use syntax::ast::{self, Expr}; use syntax::attr::{self, HasAttrs}; use syntax::edition::Edition; @@ -47,7 +48,6 @@ use syntax::source_map::Spanned; use syntax::symbol::{kw, sym, Symbol}; use syntax::tokenstream::{TokenStream, TokenTree}; use syntax::visit::FnKind; -use syntax_pos::{BytePos, Span}; use rustc::hir::{self, GenericParamKind, PatKind}; diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 617e56ffe3674..099f154d4c887 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -41,8 +41,8 @@ use rustc::lint::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintAr use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_span::Span; use syntax::ast; -use syntax_pos::Span; use lint::LintId; diff --git a/src/librustc_lint/nonstandard_style.rs b/src/librustc_lint/nonstandard_style.rs index 12e6730e8919e..7c5520f86b4ad 100644 --- a/src/librustc_lint/nonstandard_style.rs +++ b/src/librustc_lint/nonstandard_style.rs @@ -5,12 +5,12 @@ use rustc::hir::intravisit::FnKind; use rustc::hir::{self, GenericParamKind, PatKind}; use rustc::lint; use rustc::ty; +use rustc_span::{symbol::Ident, BytePos, Span}; use rustc_target::spec::abi::Abi; use syntax::ast; use syntax::attr; use syntax::errors::Applicability; use syntax::symbol::sym; -use syntax_pos::{symbol::Ident, BytePos, Span}; #[derive(PartialEq)] pub enum MethodLateContext { diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index a57e98bd2207f..7983c0e35c8db 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -14,11 +14,11 @@ use util::nodemap::FxHashSet; use std::cmp; use std::{f32, f64, i16, i32, i64, i8, u16, u32, u64, u8}; +use rustc_span::symbol::sym; +use rustc_span::Span; use rustc_target::spec::abi::Abi; use syntax::errors::Applicability; use syntax::{ast, attr, source_map}; -use syntax_pos::symbol::sym; -use syntax_pos::Span; use rustc::hir; diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index 1501e7084a439..95f83d9a9d2b3 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -10,6 +10,7 @@ use rustc::ty::{self, Ty}; use rustc_data_structures::fx::FxHashMap; use rustc_feature::{AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP}; +use rustc_span::{BytePos, Span}; use syntax::ast; use syntax::attr; use syntax::errors::{pluralize, Applicability}; @@ -17,7 +18,6 @@ use syntax::print::pprust; use syntax::symbol::Symbol; use syntax::symbol::{kw, sym}; use syntax::util::parser; -use syntax_pos::{BytePos, Span}; use log::debug; @@ -468,13 +468,13 @@ impl EarlyLintPass for UnusedParens { } If(ref cond, ref block, ..) => { - let left = e.span.lo() + syntax_pos::BytePos(2); + let left = e.span.lo() + rustc_span::BytePos(2); let right = block.span.lo(); (cond, "`if` condition", true, Some(left), Some(right)) } While(ref cond, ref block, ..) => { - let left = e.span.lo() + syntax_pos::BytePos(5); + let left = e.span.lo() + rustc_span::BytePos(5); let right = block.span.lo(); (cond, "`while` condition", true, Some(left), Some(right)) } @@ -485,12 +485,12 @@ impl EarlyLintPass for UnusedParens { } Match(ref head, _) => { - let left = e.span.lo() + syntax_pos::BytePos(5); + let left = e.span.lo() + rustc_span::BytePos(5); (head, "`match` head expression", true, Some(left), None) } Ret(Some(ref value)) => { - let left = e.span.lo() + syntax_pos::BytePos(3); + let left = e.span.lo() + rustc_span::BytePos(3); (value, "`return` value", false, Some(left), None) } diff --git a/src/librustc_metadata/Cargo.toml b/src/librustc_metadata/Cargo.toml index e22a808865414..c8ef9f1edb0ad 100644 --- a/src/librustc_metadata/Cargo.toml +++ b/src/librustc_metadata/Cargo.toml @@ -24,5 +24,5 @@ stable_deref_trait = "1.0.0" syntax = { path = "../libsyntax" } rustc_expand = { path = "../librustc_expand" } rustc_parse = { path = "../librustc_parse" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } rustc_error_codes = { path = "../librustc_error_codes" } diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index 88ad5aba88ed1..adb73d1c5fcc3 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -23,13 +23,13 @@ use std::{cmp, fs}; use log::{debug, info, log_enabled}; use proc_macro::bridge::client::ProcMacro; use rustc_expand::base::SyntaxExtension; +use rustc_span::{Span, DUMMY_SP}; use syntax::ast; use syntax::attr; use syntax::edition::Edition; use syntax::expand::allocator::{global_allocator_spans, AllocatorKind}; use syntax::span_fatal; use syntax::symbol::{sym, Symbol}; -use syntax_pos::{Span, DUMMY_SP}; use rustc_error_codes::*; diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs index 0e72433e2f547..0fec4bff1633d 100644 --- a/src/librustc_metadata/lib.rs +++ b/src/librustc_metadata/lib.rs @@ -38,7 +38,7 @@ pub mod locator; pub fn validate_crate_name( sess: Option<&rustc::session::Session>, s: &str, - sp: Option, + sp: Option, ) { let mut err_count = 0; { diff --git a/src/librustc_metadata/locator.rs b/src/librustc_metadata/locator.rs index 48c847fc037c4..93b29cf81d752 100644 --- a/src/librustc_metadata/locator.rs +++ b/src/librustc_metadata/locator.rs @@ -225,11 +225,11 @@ use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::MetadataRef; use errors::DiagnosticBuilder; +use rustc_span::Span; use rustc_target::spec::{Target, TargetTriple}; use syntax::struct_span_err; use syntax::symbol::{sym, Symbol}; use syntax::{span_err, span_fatal}; -use syntax_pos::Span; use std::cmp; use std::fmt; diff --git a/src/librustc_metadata/native_libs.rs b/src/librustc_metadata/native_libs.rs index d836d985345fa..06240994da3a8 100644 --- a/src/librustc_metadata/native_libs.rs +++ b/src/librustc_metadata/native_libs.rs @@ -171,7 +171,7 @@ impl Collector<'tcx> { feature_err( &self.tcx.sess.parse_sess, sym::static_nobundle, - span.unwrap_or_else(|| syntax_pos::DUMMY_SP), + span.unwrap_or_else(|| rustc_span::DUMMY_SP), "kind=\"static-nobundle\" is unstable", ) .emit(); @@ -180,7 +180,7 @@ impl Collector<'tcx> { feature_err( &self.tcx.sess.parse_sess, sym::raw_dylib, - span.unwrap_or_else(|| syntax_pos::DUMMY_SP), + span.unwrap_or_else(|| rustc_span::DUMMY_SP), "kind=\"raw-dylib\" is unstable", ) .emit(); diff --git a/src/librustc_metadata/rmeta/decoder.rs b/src/librustc_metadata/rmeta/decoder.rs index 5b25e192f902d..8984eeccbf778 100644 --- a/src/librustc_metadata/rmeta/decoder.rs +++ b/src/librustc_metadata/rmeta/decoder.rs @@ -36,11 +36,11 @@ use proc_macro::bridge::client::ProcMacro; use rustc_expand::base::{SyntaxExtension, SyntaxExtensionKind}; use rustc_expand::proc_macro::{AttrProcMacro, BangProcMacro, ProcMacroDerive}; use rustc_serialize::{opaque, Decodable, Decoder, SpecializedDecoder}; +use rustc_span::symbol::{sym, Symbol}; +use rustc_span::{self, hygiene::MacroKind, BytePos, Pos, Span, DUMMY_SP}; use syntax::ast::{self, Ident}; use syntax::attr; use syntax::source_map::{self, respan, Spanned}; -use syntax_pos::symbol::{sym, Symbol}; -use syntax_pos::{self, hygiene::MacroKind, BytePos, Pos, Span, DUMMY_SP}; pub use cstore_impl::{provide, provide_extern}; @@ -111,15 +111,15 @@ crate struct CrateMetadata { extern_crate: Lock>, } -/// Holds information about a syntax_pos::SourceFile imported from another crate. +/// Holds information about a rustc_span::SourceFile imported from another crate. /// See `imported_source_files()` for more information. struct ImportedSourceFile { /// This SourceFile's byte-offset within the source_map of its original crate - original_start_pos: syntax_pos::BytePos, + original_start_pos: rustc_span::BytePos, /// The end of this SourceFile within the source_map of its original crate - original_end_pos: syntax_pos::BytePos, + original_end_pos: rustc_span::BytePos, /// The imported SourceFile's representation within the local source_map - translated_source_file: Lrc, + translated_source_file: Lrc, } pub(super) struct DecodeContext<'a, 'tcx> { @@ -1459,7 +1459,7 @@ impl<'a, 'tcx> CrateMetadata { .map(|source_file_to_import| { // We can't reuse an existing SourceFile, so allocate a new one // containing the information we need. - let syntax_pos::SourceFile { + let rustc_span::SourceFile { name, name_was_remapped, src_hash, diff --git a/src/librustc_metadata/rmeta/decoder/cstore_impl.rs b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs index 23ef896017d59..804e40c31ecef 100644 --- a/src/librustc_metadata/rmeta/decoder/cstore_impl.rs +++ b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs @@ -26,6 +26,7 @@ use smallvec::SmallVec; use std::any::Any; use std::sync::Arc; +use rustc_span::{FileName, Span}; use syntax::ast; use syntax::attr; use syntax::expand::allocator::AllocatorKind; @@ -34,7 +35,6 @@ use syntax::source_map; use syntax::source_map::Spanned; use syntax::symbol::Symbol; use syntax::tokenstream::DelimSpan; -use syntax_pos::{FileName, Span}; macro_rules! provide { (<$lt:tt> $tcx:ident, $def_id:ident, $other:ident, $cdata:ident, diff --git a/src/librustc_metadata/rmeta/encoder.rs b/src/librustc_metadata/rmeta/encoder.rs index b14c9c0eb590c..681358a178a37 100644 --- a/src/librustc_metadata/rmeta/encoder.rs +++ b/src/librustc_metadata/rmeta/encoder.rs @@ -25,6 +25,7 @@ use rustc_data_structures::sync::Lrc; use rustc_serialize::{opaque, Encodable, Encoder, SpecializedEncoder}; use log::{debug, trace}; +use rustc_span::{self, FileName, SourceFile, Span}; use std::hash::Hash; use std::num::NonZeroUsize; use std::path::Path; @@ -34,7 +35,6 @@ use syntax::attr; use syntax::expand::is_proc_macro_attr; use syntax::source_map::Spanned; use syntax::symbol::{kw, sym, Ident, Symbol}; -use syntax_pos::{self, FileName, SourceFile, Span}; use rustc::hir::intravisit; use rustc::hir::intravisit::{NestedVisitorMap, Visitor}; @@ -332,7 +332,7 @@ impl<'tcx> EncodeContext<'tcx> { fn encode_info_for_items(&mut self) { let krate = self.tcx.hir().krate(); - let vis = Spanned { span: syntax_pos::DUMMY_SP, node: hir::VisibilityKind::Public }; + let vis = Spanned { span: rustc_span::DUMMY_SP, node: hir::VisibilityKind::Public }; self.encode_info_for_mod(hir::CRATE_HIR_ID, &krate.module, &krate.attrs, &vis); krate.visit_all_item_likes(&mut self.as_deep_visitor()); for macro_def in krate.exported_macros { @@ -345,7 +345,7 @@ impl<'tcx> EncodeContext<'tcx> { self.lazy(definitions.def_path_table()) } - fn encode_source_map(&mut self) -> Lazy<[syntax_pos::SourceFile]> { + fn encode_source_map(&mut self) -> Lazy<[rustc_span::SourceFile]> { let source_map = self.tcx.sess.source_map(); let all_source_files = source_map.files(); diff --git a/src/librustc_metadata/rmeta/mod.rs b/src/librustc_metadata/rmeta/mod.rs index 8859695cc9474..00142477b2868 100644 --- a/src/librustc_metadata/rmeta/mod.rs +++ b/src/librustc_metadata/rmeta/mod.rs @@ -15,11 +15,11 @@ use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::MetadataRef; use rustc_index::vec::IndexVec; use rustc_serialize::opaque::Encoder; +use rustc_span::{self, Span}; use rustc_target::spec::{PanicStrategy, TargetTriple}; use syntax::edition::Edition; use syntax::symbol::Symbol; use syntax::{ast, attr}; -use syntax_pos::{self, Span}; use std::marker::PhantomData; use std::num::NonZeroUsize; @@ -190,7 +190,7 @@ crate struct CrateRoot<'tcx> { diagnostic_items: Lazy<[(Symbol, DefIndex)]>, native_libraries: Lazy<[NativeLibrary]>, foreign_modules: Lazy<[ForeignModule]>, - source_map: Lazy<[syntax_pos::SourceFile]>, + source_map: Lazy<[rustc_span::SourceFile]>, def_path_table: Lazy, impls: Lazy<[TraitImpls]>, exported_symbols: Lazy!([(ExportedSymbol<'tcx>, SymbolExportLevel)]), diff --git a/src/librustc_mir/Cargo.toml b/src/librustc_mir/Cargo.toml index dce6c2a65e023..3f9e2c025866e 100644 --- a/src/librustc_mir/Cargo.toml +++ b/src/librustc_mir/Cargo.toml @@ -26,7 +26,7 @@ rustc_lexer = { path = "../librustc_lexer" } rustc_macros = { path = "../librustc_macros" } rustc_serialize = { path = "../libserialize", package = "serialize" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } rustc_apfloat = { path = "../librustc_apfloat" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } rustc_error_codes = { path = "../librustc_error_codes" } diff --git a/src/librustc_mir/borrow_check/constraints/graph.rs b/src/librustc_mir/borrow_check/constraints/graph.rs index 1eef76e591da6..c60a11e348d70 100644 --- a/src/librustc_mir/borrow_check/constraints/graph.rs +++ b/src/librustc_mir/borrow_check/constraints/graph.rs @@ -2,7 +2,7 @@ use rustc::mir::ConstraintCategory; use rustc::ty::RegionVid; use rustc_data_structures::graph; use rustc_index::vec::IndexVec; -use syntax_pos::DUMMY_SP; +use rustc_span::DUMMY_SP; use crate::borrow_check::{ constraints::OutlivesConstraintIndex, diff --git a/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs b/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs index af6fcb6922a8b..5eca32ce00c8b 100644 --- a/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs +++ b/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs @@ -11,8 +11,8 @@ use rustc::ty::{self, Ty}; use rustc_data_structures::fx::FxHashSet; use rustc_errors::{Applicability, DiagnosticBuilder}; use rustc_index::vec::Idx; +use rustc_span::Span; use syntax::source_map::DesugaringKind; -use syntax_pos::Span; use crate::dataflow::drop_flag_effects; use crate::dataflow::indexes::{MoveOutIndex, MovePathIndex}; diff --git a/src/librustc_mir/borrow_check/diagnostics/explain_borrow.rs b/src/librustc_mir/borrow_check/diagnostics/explain_borrow.rs index 3b7aac5c7f9f2..58f62bf7e40b3 100644 --- a/src/librustc_mir/borrow_check/diagnostics/explain_borrow.rs +++ b/src/librustc_mir/borrow_check/diagnostics/explain_borrow.rs @@ -11,8 +11,8 @@ use rustc::ty::{self, TyCtxt}; use rustc_data_structures::fx::FxHashSet; use rustc_errors::DiagnosticBuilder; use rustc_index::vec::IndexVec; -use syntax_pos::symbol::Symbol; -use syntax_pos::Span; +use rustc_span::symbol::Symbol; +use rustc_span::Span; use crate::borrow_check::{ borrow_set::BorrowData, nll::ConstraintDescription, region_infer::Cause, MirBorrowckCtxt, diff --git a/src/librustc_mir/borrow_check/diagnostics/mod.rs b/src/librustc_mir/borrow_check/diagnostics/mod.rs index 5272054346e17..e006c6ddf19ab 100644 --- a/src/librustc_mir/borrow_check/diagnostics/mod.rs +++ b/src/librustc_mir/borrow_check/diagnostics/mod.rs @@ -13,7 +13,7 @@ use rustc::ty::layout::VariantIdx; use rustc::ty::print::Print; use rustc::ty::{self, DefIdTree, Ty, TyCtxt}; use rustc_errors::DiagnosticBuilder; -use syntax_pos::Span; +use rustc_span::Span; use super::borrow_set::BorrowData; use super::MirBorrowckCtxt; diff --git a/src/librustc_mir/borrow_check/diagnostics/move_errors.rs b/src/librustc_mir/borrow_check/diagnostics/move_errors.rs index 5f06623f9dbd7..3f4204bc12f6a 100644 --- a/src/librustc_mir/borrow_check/diagnostics/move_errors.rs +++ b/src/librustc_mir/borrow_check/diagnostics/move_errors.rs @@ -1,7 +1,7 @@ use rustc::mir::*; use rustc::ty; use rustc_errors::{Applicability, DiagnosticBuilder}; -use syntax_pos::Span; +use rustc_span::Span; use crate::borrow_check::diagnostics::UseSpans; use crate::borrow_check::prefixes::PrefixSet; diff --git a/src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs b/src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs index b46b26444f61b..99fedc8b67d6f 100644 --- a/src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs +++ b/src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs @@ -4,8 +4,8 @@ use rustc::mir::{self, ClearCrossCrate, Local, LocalInfo, Location, ReadOnlyBody use rustc::mir::{Mutability, Place, PlaceBase, PlaceRef, ProjectionElem}; use rustc::ty::{self, Ty, TyCtxt}; use rustc_index::vec::Idx; -use syntax_pos::symbol::kw; -use syntax_pos::Span; +use rustc_span::symbol::kw; +use rustc_span::Span; use crate::borrow_check::diagnostics::BorrowedContentSource; use crate::borrow_check::MirBorrowckCtxt; diff --git a/src/librustc_mir/borrow_check/diagnostics/region_errors.rs b/src/librustc_mir/borrow_check/diagnostics/region_errors.rs index d560f7c517551..f45246301d33e 100644 --- a/src/librustc_mir/borrow_check/diagnostics/region_errors.rs +++ b/src/librustc_mir/borrow_check/diagnostics/region_errors.rs @@ -9,10 +9,10 @@ use rustc::mir::{Body, ConstraintCategory, Location}; use rustc::ty::{self, RegionVid, Ty}; use rustc_errors::DiagnosticBuilder; use rustc_index::vec::IndexVec; +use rustc_span::Span; use std::collections::VecDeque; use syntax::errors::Applicability; use syntax::symbol::kw; -use syntax_pos::Span; use crate::util::borrowck_errors; diff --git a/src/librustc_mir/borrow_check/diagnostics/region_name.rs b/src/librustc_mir/borrow_check/diagnostics/region_name.rs index 33a37ecb7f573..3b8043e8f1bef 100644 --- a/src/librustc_mir/borrow_check/diagnostics/region_name.rs +++ b/src/librustc_mir/borrow_check/diagnostics/region_name.rs @@ -7,8 +7,8 @@ use rustc::ty::subst::{GenericArgKind, SubstsRef}; use rustc::ty::{self, RegionVid, Ty, TyCtxt}; use rustc_data_structures::fx::FxHashMap; use rustc_errors::DiagnosticBuilder; +use rustc_span::{symbol::Symbol, Span, DUMMY_SP}; use syntax::symbol::kw; -use syntax_pos::{symbol::Symbol, Span, DUMMY_SP}; use crate::borrow_check::{ nll::ToRegionVid, region_infer::RegionInferenceContext, universal_regions::DefiningTy, diff --git a/src/librustc_mir/borrow_check/diagnostics/var_name.rs b/src/librustc_mir/borrow_check/diagnostics/var_name.rs index 76ad7bf886be5..d9bfcaf57f5fc 100644 --- a/src/librustc_mir/borrow_check/diagnostics/var_name.rs +++ b/src/librustc_mir/borrow_check/diagnostics/var_name.rs @@ -3,8 +3,8 @@ use crate::borrow_check::{nll::ToRegionVid, region_infer::RegionInferenceContext use rustc::mir::{Body, Local}; use rustc::ty::{RegionVid, TyCtxt}; use rustc_index::vec::{Idx, IndexVec}; +use rustc_span::symbol::Symbol; use syntax::source_map::Span; -use syntax_pos::symbol::Symbol; impl<'tcx> RegionInferenceContext<'tcx> { crate fn get_var_name_and_span_for_region( diff --git a/src/librustc_mir/borrow_check/member_constraints.rs b/src/librustc_mir/borrow_check/member_constraints.rs index 9d310fedaf1e9..9f10ddbc2527c 100644 --- a/src/librustc_mir/borrow_check/member_constraints.rs +++ b/src/librustc_mir/borrow_check/member_constraints.rs @@ -3,9 +3,9 @@ use rustc::hir::def_id::DefId; use rustc::infer::region_constraints::MemberConstraint; use rustc_data_structures::fx::FxHashMap; use rustc_index::vec::{Idx, IndexVec}; +use rustc_span::Span; use std::hash::Hash; use std::ops::Index; -use syntax_pos::Span; /// Compactly stores a set of `R0 member of [R1...Rn]` constraints, /// indexed by the region `R0`. diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 59e6b0bb14ea3..2c6aa7eb1b16b 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -25,8 +25,8 @@ use std::collections::BTreeMap; use std::mem; use std::rc::Rc; +use rustc_span::{Span, DUMMY_SP}; use syntax::ast::Name; -use syntax_pos::{Span, DUMMY_SP}; use crate::dataflow::indexes::{BorrowIndex, InitIndex, MoveOutIndex, MovePathIndex}; use crate::dataflow::move_paths::{HasMoveData, InitLocation, LookupResult, MoveData, MoveError}; diff --git a/src/librustc_mir/borrow_check/region_infer/mod.rs b/src/librustc_mir/borrow_check/region_infer/mod.rs index 746b11733b36f..73267b0f39973 100644 --- a/src/librustc_mir/borrow_check/region_infer/mod.rs +++ b/src/librustc_mir/borrow_check/region_infer/mod.rs @@ -16,7 +16,7 @@ use rustc_data_structures::graph::vec_graph::VecGraph; use rustc_data_structures::graph::WithSuccessors; use rustc_index::bit_set::BitSet; use rustc_index::vec::IndexVec; -use syntax_pos::Span; +use rustc_span::Span; use crate::borrow_check::{ constraints::{ diff --git a/src/librustc_mir/borrow_check/type_check/constraint_conversion.rs b/src/librustc_mir/borrow_check/type_check/constraint_conversion.rs index 957ee94460355..8f65a0f01c6e0 100644 --- a/src/librustc_mir/borrow_check/type_check/constraint_conversion.rs +++ b/src/librustc_mir/borrow_check/type_check/constraint_conversion.rs @@ -7,7 +7,7 @@ use rustc::infer::{self, InferCtxt, SubregionOrigin}; use rustc::mir::ConstraintCategory; use rustc::ty::subst::GenericArgKind; use rustc::ty::{self, TyCtxt}; -use syntax_pos::DUMMY_SP; +use rustc_span::DUMMY_SP; use crate::borrow_check::{ constraints::OutlivesConstraint, diff --git a/src/librustc_mir/borrow_check/type_check/free_region_relations.rs b/src/librustc_mir/borrow_check/type_check/free_region_relations.rs index 344a762fe9410..0e4801b88d87e 100644 --- a/src/librustc_mir/borrow_check/type_check/free_region_relations.rs +++ b/src/librustc_mir/borrow_check/type_check/free_region_relations.rs @@ -7,8 +7,8 @@ use rustc::traits::query::outlives_bounds::{self, OutlivesBound}; use rustc::traits::query::type_op::{self, TypeOp}; use rustc::ty::{self, RegionVid, Ty}; use rustc_data_structures::transitive_relation::TransitiveRelation; +use rustc_span::DUMMY_SP; use std::rc::Rc; -use syntax_pos::DUMMY_SP; use crate::borrow_check::{ nll::ToRegionVid, diff --git a/src/librustc_mir/borrow_check/type_check/input_output.rs b/src/librustc_mir/borrow_check/type_check/input_output.rs index f705d073b6409..3d3b1e5cbf6a9 100644 --- a/src/librustc_mir/borrow_check/type_check/input_output.rs +++ b/src/librustc_mir/borrow_check/type_check/input_output.rs @@ -12,7 +12,7 @@ use rustc::mir::*; use rustc::ty::Ty; use rustc_index::vec::Idx; -use syntax_pos::Span; +use rustc_span::Span; use crate::borrow_check::universal_regions::UniversalRegions; diff --git a/src/librustc_mir/borrow_check/type_check/mod.rs b/src/librustc_mir/borrow_check/type_check/mod.rs index db7db03bde002..369bce64724ab 100644 --- a/src/librustc_mir/borrow_check/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/type_check/mod.rs @@ -31,7 +31,7 @@ use rustc::ty::{ use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_error_codes::*; use rustc_index::vec::{Idx, IndexVec}; -use syntax_pos::{Span, DUMMY_SP}; +use rustc_span::{Span, DUMMY_SP}; use crate::dataflow::move_paths::MoveData; use crate::dataflow::FlowAtLocation; diff --git a/src/librustc_mir/build/block.rs b/src/librustc_mir/build/block.rs index da8bb6adf84a9..4b1a5d0c9a281 100644 --- a/src/librustc_mir/build/block.rs +++ b/src/librustc_mir/build/block.rs @@ -4,7 +4,7 @@ use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder}; use crate::hair::*; use rustc::hir; use rustc::mir::*; -use syntax_pos::Span; +use rustc_span::Span; impl<'a, 'tcx> Builder<'a, 'tcx> { pub fn ast_block( diff --git a/src/librustc_mir/build/expr/as_place.rs b/src/librustc_mir/build/expr/as_place.rs index a39ab747094be..29eac5e4b3f54 100644 --- a/src/librustc_mir/build/expr/as_place.rs +++ b/src/librustc_mir/build/expr/as_place.rs @@ -8,7 +8,7 @@ use rustc::middle::region; use rustc::mir::interpret::PanicInfo::BoundsCheck; use rustc::mir::*; use rustc::ty::{self, CanonicalUserTypeAnnotation, Ty, TyCtxt, Variance}; -use syntax_pos::Span; +use rustc_span::Span; use rustc_index::vec::Idx; diff --git a/src/librustc_mir/build/expr/as_rvalue.rs b/src/librustc_mir/build/expr/as_rvalue.rs index ee218d84cd8b5..34b0cbf3b25cd 100644 --- a/src/librustc_mir/build/expr/as_rvalue.rs +++ b/src/librustc_mir/build/expr/as_rvalue.rs @@ -9,7 +9,7 @@ use rustc::middle::region; use rustc::mir::interpret::PanicInfo; use rustc::mir::*; use rustc::ty::{self, Ty, UpvarSubsts}; -use syntax_pos::Span; +use rustc_span::Span; impl<'a, 'tcx> Builder<'a, 'tcx> { /// Returns an rvalue suitable for use until the end of the current diff --git a/src/librustc_mir/build/expr/as_temp.rs b/src/librustc_mir/build/expr/as_temp.rs index d2269f91ae25e..9c7b1129916a3 100644 --- a/src/librustc_mir/build/expr/as_temp.rs +++ b/src/librustc_mir/build/expr/as_temp.rs @@ -6,7 +6,7 @@ use crate::hair::*; use rustc::hir; use rustc::middle::region; use rustc::mir::*; -use syntax_pos::symbol::sym; +use rustc_span::symbol::sym; impl<'a, 'tcx> Builder<'a, 'tcx> { /// Compile `expr` into a fresh temporary. This is used when building diff --git a/src/librustc_mir/build/expr/into.rs b/src/librustc_mir/build/expr/into.rs index 2c61ac3ed928a..2a2c818cb8a95 100644 --- a/src/librustc_mir/build/expr/into.rs +++ b/src/librustc_mir/build/expr/into.rs @@ -7,7 +7,7 @@ use rustc::hir; use rustc::mir::*; use rustc::ty::{self, CanonicalUserTypeAnnotation}; use rustc_data_structures::fx::FxHashMap; -use syntax_pos::symbol::sym; +use rustc_span::symbol::sym; use rustc_target::spec::abi::Abi; diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs index e611c2d504e3f..468a36267251c 100644 --- a/src/librustc_mir/build/matches/mod.rs +++ b/src/librustc_mir/build/matches/mod.rs @@ -17,9 +17,9 @@ use rustc::ty::layout::VariantIdx; use rustc::ty::{self, CanonicalUserTypeAnnotation, Ty}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_index::bit_set::BitSet; +use rustc_span::Span; use smallvec::{smallvec, SmallVec}; use syntax::ast::Name; -use syntax_pos::Span; // helper functions, broken out by category: mod simplify; diff --git a/src/librustc_mir/build/matches/test.rs b/src/librustc_mir/build/matches/test.rs index cdb27099c28f4..b87cf7610c244 100644 --- a/src/librustc_mir/build/matches/test.rs +++ b/src/librustc_mir/build/matches/test.rs @@ -16,7 +16,7 @@ use rustc::ty::util::IntTypeExt; use rustc::ty::{self, adjustment::PointerCast, Ty}; use rustc_data_structures::fx::FxHashMap; use rustc_index::bit_set::BitSet; -use syntax_pos::symbol::sym; +use rustc_span::symbol::sym; use std::cmp::Ordering; diff --git a/src/librustc_mir/build/misc.rs b/src/librustc_mir/build/misc.rs index e8ee71149cc0f..7c358fef7d102 100644 --- a/src/librustc_mir/build/misc.rs +++ b/src/librustc_mir/build/misc.rs @@ -6,7 +6,7 @@ use crate::build::Builder; use rustc::ty::{self, Ty}; use rustc::mir::*; -use syntax_pos::{Span, DUMMY_SP}; +use rustc_span::{Span, DUMMY_SP}; impl<'a, 'tcx> Builder<'a, 'tcx> { /// Adds a new temporary value of type `ty` storing the result of diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index f459ca8dbbaf5..322898cc1812b 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -14,12 +14,12 @@ use rustc::ty::subst::Subst; use rustc::ty::{self, Ty, TyCtxt}; use rustc::util::nodemap::HirIdMap; use rustc_index::vec::{Idx, IndexVec}; +use rustc_span::Span; use rustc_target::spec::abi::Abi; use rustc_target::spec::PanicStrategy; use std::u32; use syntax::attr::{self, UnwindAttr}; use syntax::symbol::kw; -use syntax_pos::Span; use super::lints; diff --git a/src/librustc_mir/build/scope.rs b/src/librustc_mir/build/scope.rs index fba80562fd82d..b05b1d246307c 100644 --- a/src/librustc_mir/build/scope.rs +++ b/src/librustc_mir/build/scope.rs @@ -89,9 +89,9 @@ use rustc::hir::GeneratorKind; use rustc::middle::region; use rustc::mir::*; use rustc_data_structures::fx::FxHashMap; +use rustc_span::{Span, DUMMY_SP}; use std::collections::hash_map::Entry; use std::mem; -use syntax_pos::{Span, DUMMY_SP}; #[derive(Debug)] struct Scope { diff --git a/src/librustc_mir/dataflow/impls/indirect_mutation.rs b/src/librustc_mir/dataflow/impls/indirect_mutation.rs index 8b05a36beb3a5..38401b42b48a8 100644 --- a/src/librustc_mir/dataflow/impls/indirect_mutation.rs +++ b/src/librustc_mir/dataflow/impls/indirect_mutation.rs @@ -2,7 +2,7 @@ use rustc::mir::visit::Visitor; use rustc::mir::{self, Local, Location}; use rustc::ty::{self, TyCtxt}; use rustc_index::bit_set::BitSet; -use syntax_pos::DUMMY_SP; +use rustc_span::DUMMY_SP; use crate::dataflow::{self, GenKillSet}; diff --git a/src/librustc_mir/dataflow/move_paths/mod.rs b/src/librustc_mir/dataflow/move_paths/mod.rs index 436b3ca055dd4..6b711c37dae38 100644 --- a/src/librustc_mir/dataflow/move_paths/mod.rs +++ b/src/librustc_mir/dataflow/move_paths/mod.rs @@ -3,8 +3,8 @@ use rustc::mir::*; use rustc::ty::{ParamEnv, Ty, TyCtxt}; use rustc::util::nodemap::FxHashMap; use rustc_index::vec::{Enumerated, Idx, IndexVec}; +use rustc_span::Span; use smallvec::SmallVec; -use syntax_pos::Span; use std::fmt; use std::ops::{Index, IndexMut}; diff --git a/src/librustc_mir/hair/constant.rs b/src/librustc_mir/hair/constant.rs index cb7e02031c40c..a4bedfa6490e2 100644 --- a/src/librustc_mir/hair/constant.rs +++ b/src/librustc_mir/hair/constant.rs @@ -1,7 +1,7 @@ use rustc::mir::interpret::{ConstValue, Scalar}; use rustc::ty::{self, layout::Size, ParamEnv, Ty, TyCtxt}; +use rustc_span::symbol::Symbol; use syntax::ast; -use syntax_pos::symbol::Symbol; #[derive(PartialEq)] crate enum LitToConstError { diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index 124b788fe8dd2..569ac96d369c0 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -12,7 +12,7 @@ use rustc::ty::adjustment::{Adjust, Adjustment, AutoBorrow, AutoBorrowMutability use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::ty::{self, AdtKind, Ty}; use rustc_index::vec::Idx; -use syntax_pos::Span; +use rustc_span::Span; impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr<'tcx> { type Output = Expr<'tcx>; diff --git a/src/librustc_mir/hair/mod.rs b/src/librustc_mir/hair/mod.rs index 8973c19d58f63..800507e868ca6 100644 --- a/src/librustc_mir/hair/mod.rs +++ b/src/librustc_mir/hair/mod.rs @@ -14,7 +14,7 @@ use rustc::ty::adjustment::PointerCast; use rustc::ty::layout::VariantIdx; use rustc::ty::subst::SubstsRef; use rustc::ty::{AdtDef, Const, Ty, UpvarSubsts, UserType}; -use syntax_pos::Span; +use rustc_span::Span; mod constant; pub mod cx; diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index c6efbe8833279..61d2eceb30877 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -246,8 +246,8 @@ use rustc::mir::Field; use rustc::util::captures::Captures; use rustc::util::common::ErrorReported; +use rustc_span::{Span, DUMMY_SP}; use syntax::attr::{SignedInt, UnsignedInt}; -use syntax_pos::{Span, DUMMY_SP}; use arena::TypedArena; diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 8cf49edd0a276..12d75033da2cf 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -15,10 +15,10 @@ use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::ty::{self, Ty, TyCtxt}; use rustc_error_codes::*; use rustc_errors::{Applicability, DiagnosticBuilder}; +use rustc_span::symbol::sym; +use rustc_span::{MultiSpan, Span}; use syntax::ast::Mutability; use syntax::feature_gate::feature_err; -use syntax_pos::symbol::sym; -use syntax_pos::{MultiSpan, Span}; use std::slice; diff --git a/src/librustc_mir/hair/pattern/const_to_pat.rs b/src/librustc_mir/hair/pattern/const_to_pat.rs index b9ec6ea5f97de..dd97565f55abe 100644 --- a/src/librustc_mir/hair/pattern/const_to_pat.rs +++ b/src/librustc_mir/hair/pattern/const_to_pat.rs @@ -9,7 +9,7 @@ use rustc::ty::{self, Ty, TyCtxt}; use rustc_index::vec::Idx; -use syntax_pos::Span; +use rustc_span::Span; use std::cell::Cell; diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index 3c0bdd00391c5..f5d8ed877ec5c 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -22,10 +22,10 @@ use rustc::ty::{CanonicalUserType, CanonicalUserTypeAnnotation, CanonicalUserTyp use rustc_index::vec::Idx; +use rustc_span::{Span, DUMMY_SP}; use std::cmp::Ordering; use std::fmt; use syntax::ast; -use syntax_pos::{Span, DUMMY_SP}; use rustc_error_codes::*; diff --git a/src/librustc_mir/interpret/intern.rs b/src/librustc_mir/interpret/intern.rs index dffc8e8256c42..9f54d4c3212e9 100644 --- a/src/librustc_mir/interpret/intern.rs +++ b/src/librustc_mir/interpret/intern.rs @@ -199,7 +199,7 @@ impl<'rt, 'mir, 'tcx, M: CompileTimeMachine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx self.intern_shallow(vtable.alloc_id, Mutability::Not, None)?; } else { self.ecx().tcx.sess.delay_span_bug( - syntax_pos::DUMMY_SP, + rustc_span::DUMMY_SP, "vtables pointers cannot be integer pointers", ); } diff --git a/src/librustc_mir/interpret/intrinsics.rs b/src/librustc_mir/interpret/intrinsics.rs index da7cff97ee2c2..cc38cbbac8d65 100644 --- a/src/librustc_mir/interpret/intrinsics.rs +++ b/src/librustc_mir/interpret/intrinsics.rs @@ -12,8 +12,8 @@ use rustc::ty; use rustc::ty::layout::{LayoutOf, Primitive, Size}; use rustc::ty::subst::SubstsRef; use rustc::ty::TyCtxt; -use syntax_pos::symbol::{sym, Symbol}; -use syntax_pos::Span; +use rustc_span::symbol::{sym, Symbol}; +use rustc_span::Span; use super::{ImmTy, InterpCx, Machine, OpTy, PlaceTy}; diff --git a/src/librustc_mir/interpret/intrinsics/caller_location.rs b/src/librustc_mir/interpret/intrinsics/caller_location.rs index aff08feeeb026..da0a9fb4f1be5 100644 --- a/src/librustc_mir/interpret/intrinsics/caller_location.rs +++ b/src/librustc_mir/interpret/intrinsics/caller_location.rs @@ -1,7 +1,7 @@ use rustc::middle::lang_items::PanicLocationLangItem; use rustc::ty::subst::Subst; +use rustc_span::{Span, Symbol}; use rustc_target::abi::LayoutOf; -use syntax_pos::{Span, Symbol}; use crate::interpret::{ intrinsics::{InterpCx, Machine}, diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs index e77ba9fa4cb0d..3b444ac46ef26 100644 --- a/src/librustc_mir/interpret/machine.rs +++ b/src/librustc_mir/interpret/machine.rs @@ -8,7 +8,7 @@ use std::hash::Hash; use rustc::hir::def_id::DefId; use rustc::mir; use rustc::ty::{self, Ty, TyCtxt}; -use syntax_pos::Span; +use rustc_span::Span; use super::{ AllocId, Allocation, AllocationExtra, AssertMessage, Frame, ImmTy, InterpCx, InterpResult, diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs index 448a2765fd3e0..b55f66dc75124 100644 --- a/src/librustc_mir/interpret/validity.rs +++ b/src/librustc_mir/interpret/validity.rs @@ -11,7 +11,7 @@ use rustc::hir; use rustc::ty; use rustc::ty::layout::{self, LayoutOf, TyLayout, VariantIdx}; use rustc_data_structures::fx::FxHashSet; -use syntax_pos::symbol::{sym, Symbol}; +use rustc_span::symbol::{sym, Symbol}; use std::hash::Hash; diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 844bebdf7b874..6c8f8f6c2275c 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -855,7 +855,7 @@ fn find_vtable_types_for_unsizing<'tcx>( let ptr_vtable = |inner_source: Ty<'tcx>, inner_target: Ty<'tcx>| { let param_env = ty::ParamEnv::reveal_all(); let type_has_metadata = |ty: Ty<'tcx>| -> bool { - use syntax_pos::DUMMY_SP; + use rustc_span::DUMMY_SP; if ty.is_sized(tcx.at(DUMMY_SP), param_env) { return false; } diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index 923fa3a20b72f..5d88f3b93aeb3 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -8,8 +8,8 @@ use rustc::ty::{self, Ty, TyCtxt}; use rustc_index::vec::{Idx, IndexVec}; +use rustc_span::{sym, Span}; use rustc_target::spec::abi::Abi; -use syntax_pos::{sym, Span}; use std::fmt; use std::iter; diff --git a/src/librustc_mir/transform/check_consts/ops.rs b/src/librustc_mir/transform/check_consts/ops.rs index dccb8ad06ec8f..37435fbf4d16f 100644 --- a/src/librustc_mir/transform/check_consts/ops.rs +++ b/src/librustc_mir/transform/check_consts/ops.rs @@ -3,9 +3,9 @@ use rustc::hir::def_id::DefId; use rustc::session::config::nightly_options; use rustc::ty::TyCtxt; +use rustc_span::{Span, Symbol}; use syntax::feature_gate::feature_err; use syntax::symbol::sym; -use syntax_pos::{Span, Symbol}; use super::{ConstKind, Item}; diff --git a/src/librustc_mir/transform/check_consts/qualifs.rs b/src/librustc_mir/transform/check_consts/qualifs.rs index bd895171e358e..0799cc2374ad4 100644 --- a/src/librustc_mir/transform/check_consts/qualifs.rs +++ b/src/librustc_mir/transform/check_consts/qualifs.rs @@ -2,7 +2,7 @@ use rustc::mir::*; use rustc::ty::{self, Ty}; -use syntax_pos::DUMMY_SP; +use rustc_span::DUMMY_SP; use super::Item as ConstCx; diff --git a/src/librustc_mir/transform/check_consts/validation.rs b/src/librustc_mir/transform/check_consts/validation.rs index afe119725b7b5..19cad453e25e6 100644 --- a/src/librustc_mir/transform/check_consts/validation.rs +++ b/src/librustc_mir/transform/check_consts/validation.rs @@ -9,8 +9,8 @@ use rustc::ty::cast::CastTy; use rustc::ty::{self, TyCtxt}; use rustc_error_codes::*; use rustc_index::bit_set::BitSet; +use rustc_span::Span; use syntax::symbol::sym; -use syntax_pos::Span; use std::borrow::Cow; use std::ops::Deref; diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index c36f793511553..e1c2b494337e7 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -24,8 +24,8 @@ use rustc::ty::subst::InternalSubsts; use rustc::ty::{self, Instance, ParamEnv, Ty, TyCtxt, TypeFoldable}; use rustc_data_structures::fx::FxHashMap; use rustc_index::vec::IndexVec; +use rustc_span::{Span, DUMMY_SP}; use syntax::ast::Mutability; -use syntax_pos::{Span, DUMMY_SP}; use crate::const_eval::error_to_const_error; use crate::interpret::{ diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index 43c8628a161c7..269465fb88b42 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -15,8 +15,8 @@ use rustc::ty::layout::VariantIdx; use rustc::ty::{self, TyCtxt}; use rustc::util::nodemap::FxHashMap; use rustc_index::bit_set::BitSet; +use rustc_span::Span; use std::fmt; -use syntax_pos::Span; pub struct ElaborateDrops; diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index 39647b587f56e..62f7a3f539acb 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -8,9 +8,9 @@ use rustc::ty::steal::Steal; use rustc::ty::{InstanceDef, TyCtxt, TypeFoldable}; use rustc::util::nodemap::DefIdSet; use rustc_index::vec::IndexVec; +use rustc_span::Span; use std::borrow::Cow; use syntax::ast; -use syntax_pos::Span; pub mod add_call_guards; pub mod add_moves_for_packed_drops; diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index b52231e55f9a0..804e6dbb20251 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -19,9 +19,9 @@ use rustc::mir::*; use rustc::ty::cast::CastTy; use rustc::ty::subst::InternalSubsts; use rustc::ty::{self, List, TyCtxt, TypeFoldable}; +use rustc_span::{Span, DUMMY_SP}; use syntax::ast::LitKind; use syntax::symbol::sym; -use syntax_pos::{Span, DUMMY_SP}; use rustc_index::vec::{Idx, IndexVec}; use rustc_target::spec::abi::Abi; diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index 6064df9ba4b09..7bb1a4e3921bf 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -2,10 +2,10 @@ use rustc::hir; use rustc::hir::def_id::DefId; use rustc::mir::*; use rustc::ty::{self, adjustment::PointerCast, Predicate, Ty, TyCtxt}; +use rustc_span::Span; use std::borrow::Cow; use syntax::attr; use syntax::symbol::{sym, Symbol}; -use syntax_pos::Span; type McfResult = Result<(), (Span, Cow<'static, str>)>; diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs index 095d8474c5d13..7066ed906eb4f 100644 --- a/src/librustc_mir/transform/rustc_peek.rs +++ b/src/librustc_mir/transform/rustc_peek.rs @@ -1,7 +1,7 @@ +use rustc_span::Span; use rustc_target::spec::abi::Abi; use syntax::ast; use syntax::symbol::sym; -use syntax_pos::Span; use crate::transform::{MirPass, MirSource}; use rustc::hir::def_id::DefId; diff --git a/src/librustc_mir/util/borrowck_errors.rs b/src/librustc_mir/util/borrowck_errors.rs index d14168703df99..9f67109b34a1b 100644 --- a/src/librustc_mir/util/borrowck_errors.rs +++ b/src/librustc_mir/util/borrowck_errors.rs @@ -1,6 +1,6 @@ use rustc::ty::{self, Ty, TyCtxt}; use rustc_errors::{DiagnosticBuilder, DiagnosticId}; -use syntax_pos::{MultiSpan, Span}; +use rustc_span::{MultiSpan, Span}; use rustc_error_codes::*; diff --git a/src/librustc_mir/util/patch.rs b/src/librustc_mir/util/patch.rs index f6a4eb38a2ebb..68aa82f902f01 100644 --- a/src/librustc_mir/util/patch.rs +++ b/src/librustc_mir/util/patch.rs @@ -1,7 +1,7 @@ use rustc::mir::*; use rustc::ty::Ty; use rustc_index::vec::{Idx, IndexVec}; -use syntax_pos::Span; +use rustc_span::Span; /// This struct represents a patch to MIR, which can add /// new statements and basic blocks and patch over block diff --git a/src/librustc_parse/Cargo.toml b/src/librustc_parse/Cargo.toml index 086e6a6bf5c53..d41d89902efcd 100644 --- a/src/librustc_parse/Cargo.toml +++ b/src/librustc_parse/Cargo.toml @@ -18,6 +18,6 @@ rustc_lexer = { path = "../librustc_lexer" } rustc_errors = { path = "../librustc_errors" } rustc_error_codes = { path = "../librustc_error_codes" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } syntax = { path = "../libsyntax" } unicode-normalization = "0.1.11" diff --git a/src/librustc_parse/config.rs b/src/librustc_parse/config.rs index 63892eb8995a1..0dbbda37ee411 100644 --- a/src/librustc_parse/config.rs +++ b/src/librustc_parse/config.rs @@ -11,6 +11,8 @@ use crate::{parse_in, validate_attr}; use rustc_errors::Applicability; use rustc_feature::Features; +use rustc_span::symbol::sym; +use rustc_span::Span; use syntax::ast::{self, AttrItem, Attribute, MetaItem}; use syntax::attr; use syntax::attr::HasAttrs; @@ -20,8 +22,6 @@ use syntax::mut_visit::*; use syntax::ptr::P; use syntax::sess::ParseSess; use syntax::util::map_in_place::MapInPlace; -use syntax_pos::symbol::sym; -use syntax_pos::Span; use smallvec::SmallVec; diff --git a/src/librustc_parse/lexer/mod.rs b/src/librustc_parse/lexer/mod.rs index 30ec202e0ffe3..02e4808679f00 100644 --- a/src/librustc_parse/lexer/mod.rs +++ b/src/librustc_parse/lexer/mod.rs @@ -2,11 +2,11 @@ use rustc_data_structures::sync::Lrc; use rustc_errors::{DiagnosticBuilder, FatalError}; use rustc_lexer::unescape; use rustc_lexer::Base; +use rustc_span::symbol::{sym, Symbol}; +use rustc_span::{BytePos, Pos, Span}; use syntax::sess::ParseSess; use syntax::token::{self, Token, TokenKind}; use syntax::util::comments; -use syntax_pos::symbol::{sym, Symbol}; -use syntax_pos::{BytePos, Pos, Span}; use log::debug; use std::char; @@ -43,7 +43,7 @@ pub struct StringReader<'a> { impl<'a> StringReader<'a> { pub fn new( sess: &'a ParseSess, - source_file: Lrc, + source_file: Lrc, override_span: Option, ) -> Self { if source_file.src.is_none() { diff --git a/src/librustc_parse/lexer/tokentrees.rs b/src/librustc_parse/lexer/tokentrees.rs index e517cc9c3db21..5beda290b9144 100644 --- a/src/librustc_parse/lexer/tokentrees.rs +++ b/src/librustc_parse/lexer/tokentrees.rs @@ -2,6 +2,7 @@ use super::{StringReader, UnmatchedBrace}; use rustc_data_structures::fx::FxHashMap; use rustc_errors::PResult; +use rustc_span::Span; use syntax::print::pprust::token_to_string; use syntax::token::{self, Token}; use syntax::tokenstream::{ @@ -9,7 +10,6 @@ use syntax::tokenstream::{ IsJoint::{self, *}, TokenStream, TokenTree, TreeAndJoint, }; -use syntax_pos::Span; impl<'a> StringReader<'a> { crate fn into_token_trees(self) -> (PResult<'a, TokenStream>, Vec) { diff --git a/src/librustc_parse/lexer/unescape_error_reporting.rs b/src/librustc_parse/lexer/unescape_error_reporting.rs index 3b3f9e7cce64f..151c63a49b57c 100644 --- a/src/librustc_parse/lexer/unescape_error_reporting.rs +++ b/src/librustc_parse/lexer/unescape_error_reporting.rs @@ -4,7 +4,7 @@ use std::iter::once; use std::ops::Range; use rustc_lexer::unescape::{EscapeError, Mode}; -use syntax_pos::{BytePos, Span}; +use rustc_span::{BytePos, Span}; use syntax::errors::{Applicability, Handler}; diff --git a/src/librustc_parse/lexer/unicode_chars.rs b/src/librustc_parse/lexer/unicode_chars.rs index fbc5dc5cc896a..ac395f6cbc2fd 100644 --- a/src/librustc_parse/lexer/unicode_chars.rs +++ b/src/librustc_parse/lexer/unicode_chars.rs @@ -4,7 +4,7 @@ use super::StringReader; use crate::token; use rustc_errors::{Applicability, DiagnosticBuilder}; -use syntax_pos::{symbol::kw, BytePos, Pos, Span}; +use rustc_span::{symbol::kw, BytePos, Pos, Span}; #[rustfmt::skip] // for line breaks const UNICODE_ARRAY: &[(char, &str, char)] = &[ diff --git a/src/librustc_parse/lib.rs b/src/librustc_parse/lib.rs index f35e5cbb4fd03..9227e968ecc4f 100644 --- a/src/librustc_parse/lib.rs +++ b/src/librustc_parse/lib.rs @@ -12,7 +12,7 @@ use syntax::tokenstream::{self, TokenStream, TokenTree}; use rustc_data_structures::sync::Lrc; use rustc_errors::{Diagnostic, FatalError, Level, PResult}; -use syntax_pos::{FileName, SourceFile, Span}; +use rustc_span::{FileName, SourceFile, Span}; use std::borrow::Cow; use std::path::Path; @@ -373,7 +373,7 @@ fn prepend_attrs( sess: &ParseSess, attrs: &[ast::Attribute], tokens: Option<&tokenstream::TokenStream>, - span: syntax_pos::Span, + span: rustc_span::Span, ) -> Option { let tokens = tokens?; if attrs.len() == 0 { diff --git a/src/librustc_parse/parser/attr.rs b/src/librustc_parse/parser/attr.rs index 26df4f1c090d6..81f31b2eda1d4 100644 --- a/src/librustc_parse/parser/attr.rs +++ b/src/librustc_parse/parser/attr.rs @@ -1,11 +1,11 @@ use super::{Parser, PathStyle, TokenType}; use rustc_errors::PResult; +use rustc_span::{Span, Symbol}; use syntax::ast; use syntax::attr; use syntax::print::pprust; use syntax::token::{self, Nonterminal}; use syntax::util::comments; -use syntax_pos::{Span, Symbol}; use log::debug; diff --git a/src/librustc_parse/parser/diagnostics.rs b/src/librustc_parse/parser/diagnostics.rs index 05754357bc822..bf03f731c9f90 100644 --- a/src/librustc_parse/parser/diagnostics.rs +++ b/src/librustc_parse/parser/diagnostics.rs @@ -3,6 +3,8 @@ use super::{BlockMode, Parser, PathStyle, SemiColonMode, SeqSep, TokenExpectType use rustc_data_structures::fx::FxHashSet; use rustc_error_codes::*; use rustc_errors::{self, pluralize, Applicability, DiagnosticBuilder, Handler, PResult}; +use rustc_span::symbol::kw; +use rustc_span::{MultiSpan, Span, SpanSnippetError, DUMMY_SP}; use syntax::ast::{ self, BinOpKind, BindingMode, BlockCheckMode, Expr, ExprKind, Ident, Item, Param, }; @@ -12,8 +14,6 @@ use syntax::ptr::P; use syntax::struct_span_err; use syntax::token::{self, token_can_begin_expr, TokenKind}; use syntax::util::parser::AssocOp; -use syntax_pos::symbol::kw; -use syntax_pos::{MultiSpan, Span, SpanSnippetError, DUMMY_SP}; use log::{debug, trace}; use std::mem; diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs index ab7c156e3706d..90f15375aec42 100644 --- a/src/librustc_parse/parser/expr.rs +++ b/src/librustc_parse/parser/expr.rs @@ -5,6 +5,8 @@ use super::{SemiColonMode, SeqSep, TokenExpectType}; use crate::maybe_recover_from_interpolated_ty_qpath; use rustc_errors::{Applicability, PResult}; +use rustc_span::source_map::{self, Span}; +use rustc_span::symbol::{kw, sym, Symbol}; use std::mem; use syntax::ast::{self, AttrStyle, AttrVec, CaptureBy, Field, Ident, Lit, DUMMY_NODE_ID}; use syntax::ast::{ @@ -17,8 +19,6 @@ use syntax::token::{self, Token, TokenKind}; use syntax::util::classify; use syntax::util::literal::LitError; use syntax::util::parser::{prec_let_scrutinee_needs_par, AssocOp, Fixity}; -use syntax_pos::source_map::{self, Span}; -use syntax_pos::symbol::{kw, sym, Symbol}; /// Possibly accepts an `token::Interpolated` expression (a pre-parsed expression /// dropped into the token stream, which happens while parsing the result of diff --git a/src/librustc_parse/parser/generics.rs b/src/librustc_parse/parser/generics.rs index 113a613b91307..c0cc9deafb818 100644 --- a/src/librustc_parse/parser/generics.rs +++ b/src/librustc_parse/parser/generics.rs @@ -1,10 +1,10 @@ use super::Parser; use rustc_errors::PResult; +use rustc_span::symbol::{kw, sym}; use syntax::ast::{self, Attribute, GenericBounds, GenericParam, GenericParamKind, WhereClause}; use syntax::source_map::DUMMY_SP; use syntax::token; -use syntax_pos::symbol::{kw, sym}; impl<'a> Parser<'a> { /// Parses bounds of a lifetime parameter `BOUND + BOUND + BOUND`, possibly with trailing `+`. diff --git a/src/librustc_parse/parser/item.rs b/src/librustc_parse/parser/item.rs index e5a7361b12ab7..a05bc48981efe 100644 --- a/src/librustc_parse/parser/item.rs +++ b/src/librustc_parse/parser/item.rs @@ -5,6 +5,9 @@ use crate::maybe_whole; use rustc_error_codes::*; use rustc_errors::{Applicability, DiagnosticBuilder, PResult, StashKey}; +use rustc_span::source_map::{self, respan, Span}; +use rustc_span::symbol::{kw, sym, Symbol}; +use rustc_span::BytePos; use syntax::ast::{self, AttrKind, AttrStyle, AttrVec, Attribute, Ident, DUMMY_NODE_ID}; use syntax::ast::{AssocItem, AssocItemKind, Item, ItemKind, UseTree, UseTreeKind}; use syntax::ast::{BindingMode, Block, FnDecl, FnSig, Mac, MacArgs, MacDelimiter, Param, SelfKind}; @@ -16,9 +19,6 @@ use syntax::ptr::P; use syntax::struct_span_err; use syntax::token; use syntax::tokenstream::{DelimSpan, TokenStream, TokenTree}; -use syntax_pos::source_map::{self, respan, Span}; -use syntax_pos::symbol::{kw, sym, Symbol}; -use syntax_pos::BytePos; use log::debug; use std::mem; diff --git a/src/librustc_parse/parser/mod.rs b/src/librustc_parse/parser/mod.rs index ec6468f4f0a32..6dcffcf0bd7b8 100644 --- a/src/librustc_parse/parser/mod.rs +++ b/src/librustc_parse/parser/mod.rs @@ -16,6 +16,9 @@ use crate::{Directory, DirectoryOwnership}; use log::debug; use rustc_errors::{Applicability, DiagnosticBuilder, FatalError, PResult}; +use rustc_span::source_map::respan; +use rustc_span::symbol::{kw, sym, Symbol}; +use rustc_span::{BytePos, FileName, Span, DUMMY_SP}; use syntax::ast::{self, AttrStyle, AttrVec, CrateSugar, Extern, Ident, Unsafety, DUMMY_NODE_ID}; use syntax::ast::{IsAsync, MacArgs, MacDelimiter, Mutability, StrLit, Visibility, VisibilityKind}; use syntax::print::pprust; @@ -25,9 +28,6 @@ use syntax::struct_span_err; use syntax::token::{self, DelimToken, Token, TokenKind}; use syntax::tokenstream::{self, DelimSpan, TokenStream, TokenTree, TreeAndJoint}; use syntax::util::comments::{doc_comment_style, strip_doc_comment_decoration}; -use syntax_pos::source_map::respan; -use syntax_pos::symbol::{kw, sym, Symbol}; -use syntax_pos::{BytePos, FileName, Span, DUMMY_SP}; use std::borrow::Cow; use std::path::PathBuf; diff --git a/src/librustc_parse/parser/module.rs b/src/librustc_parse/parser/module.rs index 84ffa6f7fcd8f..3254ab5b46325 100644 --- a/src/librustc_parse/parser/module.rs +++ b/src/librustc_parse/parser/module.rs @@ -5,11 +5,11 @@ use super::Parser; use crate::{new_sub_parser_from_file, DirectoryOwnership}; use rustc_errors::PResult; +use rustc_span::source_map::{FileName, SourceMap, Span, DUMMY_SP}; +use rustc_span::symbol::sym; use syntax::ast::{self, Attribute, Crate, Ident, ItemKind, Mod}; use syntax::attr; use syntax::token::{self, TokenKind}; -use syntax_pos::source_map::{FileName, SourceMap, Span, DUMMY_SP}; -use syntax_pos::symbol::sym; use std::path::{self, Path, PathBuf}; diff --git a/src/librustc_parse/parser/pat.rs b/src/librustc_parse/parser/pat.rs index e608b86c76a29..bf7f5735f134b 100644 --- a/src/librustc_parse/parser/pat.rs +++ b/src/librustc_parse/parser/pat.rs @@ -1,14 +1,14 @@ use super::{Parser, PathStyle}; use crate::{maybe_recover_from_interpolated_ty_qpath, maybe_whole}; use rustc_errors::{Applicability, DiagnosticBuilder, PResult}; +use rustc_span::source_map::{respan, Span, Spanned}; +use rustc_span::symbol::{kw, sym}; use syntax::ast::{self, AttrVec, Attribute, FieldPat, Mac, Pat, PatKind, RangeEnd, RangeSyntax}; use syntax::ast::{BindingMode, Expr, ExprKind, Ident, Mutability, Path, QSelf}; use syntax::mut_visit::{noop_visit_mac, noop_visit_pat, MutVisitor}; use syntax::print::pprust; use syntax::ptr::P; use syntax::token; -use syntax_pos::source_map::{respan, Span, Spanned}; -use syntax_pos::symbol::{kw, sym}; type Expected = Option<&'static str>; diff --git a/src/librustc_parse/parser/path.rs b/src/librustc_parse/parser/path.rs index 325ad56cd2a43..0358458c0991d 100644 --- a/src/librustc_parse/parser/path.rs +++ b/src/librustc_parse/parser/path.rs @@ -1,13 +1,13 @@ use super::{Parser, TokenType}; use crate::maybe_whole; use rustc_errors::{pluralize, Applicability, PResult}; +use rustc_span::source_map::{BytePos, Span}; +use rustc_span::symbol::{kw, sym}; use syntax::ast::{self, AngleBracketedArgs, Ident, ParenthesizedArgs, Path, PathSegment, QSelf}; use syntax::ast::{ AnonConst, AssocTyConstraint, AssocTyConstraintKind, BlockCheckMode, GenericArg, }; use syntax::token::{self, Token}; -use syntax_pos::source_map::{BytePos, Span}; -use syntax_pos::symbol::{kw, sym}; use log::debug; use std::mem; diff --git a/src/librustc_parse/parser/stmt.rs b/src/librustc_parse/parser/stmt.rs index bf092ed14e342..a94d8228bbe85 100644 --- a/src/librustc_parse/parser/stmt.rs +++ b/src/librustc_parse/parser/stmt.rs @@ -7,14 +7,14 @@ use crate::maybe_whole; use crate::DirectoryOwnership; use rustc_errors::{Applicability, PResult}; +use rustc_span::source_map::{respan, Span}; +use rustc_span::symbol::{kw, sym, Symbol}; use syntax::ast; use syntax::ast::{AttrStyle, AttrVec, Attribute, Mac, MacStmtStyle, VisibilityKind}; use syntax::ast::{Block, BlockCheckMode, Expr, ExprKind, Local, Stmt, StmtKind, DUMMY_NODE_ID}; use syntax::ptr::P; use syntax::token; use syntax::util::classify; -use syntax_pos::source_map::{respan, Span}; -use syntax_pos::symbol::{kw, sym, Symbol}; use std::mem; diff --git a/src/librustc_parse/parser/ty.rs b/src/librustc_parse/parser/ty.rs index 4f7bcf01e1b82..4122aa17f83d3 100644 --- a/src/librustc_parse/parser/ty.rs +++ b/src/librustc_parse/parser/ty.rs @@ -5,6 +5,8 @@ use crate::{maybe_recover_from_interpolated_ty_qpath, maybe_whole}; use rustc_error_codes::*; use rustc_errors::{pluralize, Applicability, PResult}; +use rustc_span::source_map::Span; +use rustc_span::symbol::kw; use syntax::ast::{ self, BareFnTy, FunctionRetTy, GenericParam, Ident, Lifetime, MutTy, Ty, TyKind, }; @@ -15,8 +17,6 @@ use syntax::ast::{Mac, Mutability}; use syntax::ptr::P; use syntax::struct_span_err; use syntax::token::{self, Token}; -use syntax_pos::source_map::Span; -use syntax_pos::symbol::kw; /// Returns `true` if `IDENT t` can start a type -- `IDENT::a::b`, `IDENT`, /// `IDENT<::AssocTy>`. diff --git a/src/librustc_parse/validate_attr.rs b/src/librustc_parse/validate_attr.rs index 9b96702fa1f9d..f089361220777 100644 --- a/src/librustc_parse/validate_attr.rs +++ b/src/librustc_parse/validate_attr.rs @@ -4,11 +4,11 @@ use crate::parse_in; use rustc_errors::{Applicability, PResult}; use rustc_feature::{AttributeTemplate, BUILTIN_ATTRIBUTE_MAP}; +use rustc_span::{sym, Symbol}; use syntax::ast::{self, Attribute, MacArgs, MacDelimiter, MetaItem, MetaItemKind}; use syntax::early_buffered_lints::ILL_FORMED_ATTRIBUTE_INPUT; use syntax::sess::ParseSess; use syntax::tokenstream::DelimSpan; -use syntax_pos::{sym, Symbol}; pub fn check_meta(sess: &ParseSess, attr: &Attribute) { if attr.is_doc_comment() { diff --git a/src/librustc_passes/Cargo.toml b/src/librustc_passes/Cargo.toml index ffce0d1cb1a28..b33b891d4bb53 100644 --- a/src/librustc_passes/Cargo.toml +++ b/src/librustc_passes/Cargo.toml @@ -17,6 +17,6 @@ rustc_index = { path = "../librustc_index" } rustc_parse = { path = "../librustc_parse" } rustc_target = { path = "../librustc_target" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_error_codes = { path = "../librustc_error_codes" } diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index d89db403b15f7..a0d5467893de0 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -11,6 +11,7 @@ use rustc::lint; use rustc::session::Session; use rustc_data_structures::fx::FxHashMap; use rustc_parse::validate_attr; +use rustc_span::Span; use std::mem; use syntax::ast::*; use syntax::attr; @@ -20,7 +21,6 @@ use syntax::source_map::Spanned; use syntax::symbol::{kw, sym}; use syntax::visit::{self, Visitor}; use syntax::{span_err, struct_span_err, walk_list}; -use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/librustc_passes/check_const.rs b/src/librustc_passes/check_const.rs index fbfe213501295..c08aab2e200fc 100644 --- a/src/librustc_passes/check_const.rs +++ b/src/librustc_passes/check_const.rs @@ -15,10 +15,10 @@ use rustc::session::config::nightly_options; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; use rustc_error_codes::*; +use rustc_span::{sym, Span, Symbol}; use syntax::ast::Mutability; use syntax::feature_gate::feature_err; use syntax::span_err; -use syntax_pos::{sym, Span, Symbol}; use std::fmt; diff --git a/src/librustc_passes/dead.rs b/src/librustc_passes/dead.rs index 09d6d2a1be251..fc7f9c9e58c61 100644 --- a/src/librustc_passes/dead.rs +++ b/src/librustc_passes/dead.rs @@ -17,9 +17,9 @@ use rustc::util::nodemap::FxHashSet; use rustc_data_structures::fx::FxHashMap; +use rustc_span; use syntax::symbol::sym; use syntax::{ast, attr}; -use syntax_pos; // Any local node that may call something in its body block should be // explored. For example, if it's a live Node::Item that is a @@ -231,7 +231,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> { _: ast::Name, _: &hir::Generics<'_>, _: hir::HirId, - _: syntax_pos::Span, + _: rustc_span::Span, ) { let has_repr_c = self.repr_has_repr_c; let inherited_pub_visibility = self.inherited_pub_visibility; @@ -549,7 +549,7 @@ impl DeadVisitor<'tcx> { fn warn_dead_code( &mut self, id: hir::HirId, - span: syntax_pos::Span, + span: rustc_span::Span, name: ast::Name, node_type: &str, participle: &str, diff --git a/src/librustc_passes/entry.rs b/src/librustc_passes/entry.rs index 5cb6fdfc3c45b..3b7728a18d36d 100644 --- a/src/librustc_passes/entry.rs +++ b/src/librustc_passes/entry.rs @@ -6,10 +6,10 @@ use rustc::session::config::EntryFnType; use rustc::session::{config, Session}; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_span::Span; use syntax::attr; use syntax::entry::EntryPointType; use syntax::symbol::sym; -use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/librustc_passes/hir_stats.rs b/src/librustc_passes/hir_stats.rs index 49ec8d01d952d..d52f31ceeeadf 100644 --- a/src/librustc_passes/hir_stats.rs +++ b/src/librustc_passes/hir_stats.rs @@ -6,9 +6,9 @@ use rustc::hir::intravisit as hir_visit; use rustc::hir::{self, HirId}; use rustc::util::common::to_readable_str; use rustc::util::nodemap::{FxHashMap, FxHashSet}; +use rustc_span::Span; use syntax::ast::{self, AttrId, NodeId}; use syntax::visit as ast_visit; -use syntax_pos::Span; #[derive(Copy, Clone, PartialEq, Eq, Hash)] enum Id { diff --git a/src/librustc_passes/intrinsicck.rs b/src/librustc_passes/intrinsicck.rs index 92903e95a0dc4..95dc31cc29bf4 100644 --- a/src/librustc_passes/intrinsicck.rs +++ b/src/librustc_passes/intrinsicck.rs @@ -7,8 +7,8 @@ use rustc::ty::{self, Ty, TyCtxt}; use rustc::hir; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc_index::vec::Idx; +use rustc_span::{sym, Span}; use rustc_target::spec::abi::Abi::RustIntrinsic; -use syntax_pos::{sym, Span}; use rustc_error_codes::*; diff --git a/src/librustc_passes/lib_features.rs b/src/librustc_passes/lib_features.rs index 0b0183f3cce04..2f486e3038fb8 100644 --- a/src/librustc_passes/lib_features.rs +++ b/src/librustc_passes/lib_features.rs @@ -9,9 +9,9 @@ use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::middle::lib_features::LibFeatures; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_span::{sym, Span}; use syntax::ast::{Attribute, MetaItem, MetaItemKind}; use syntax::symbol::Symbol; -use syntax_pos::{sym, Span}; use rustc_error_codes::*; diff --git a/src/librustc_passes/liveness.rs b/src/librustc_passes/liveness.rs index 4f7db91dcdaa6..b32f6420f6685 100644 --- a/src/librustc_passes/liveness.rs +++ b/src/librustc_passes/liveness.rs @@ -109,6 +109,7 @@ use rustc::util::nodemap::{HirIdMap, HirIdSet}; use errors::Applicability; use rustc_data_structures::fx::FxIndexMap; +use rustc_span::Span; use std::collections::VecDeque; use std::io; use std::io::prelude::*; @@ -116,7 +117,6 @@ use std::rc::Rc; use std::{fmt, u32}; use syntax::ast; use syntax::symbol::sym; -use syntax_pos::Span; #[derive(Copy, Clone, PartialEq)] struct Variable(u32); diff --git a/src/librustc_passes/loops.rs b/src/librustc_passes/loops.rs index 463e6899c4f74..f5011ceef142e 100644 --- a/src/librustc_passes/loops.rs +++ b/src/librustc_passes/loops.rs @@ -9,8 +9,8 @@ use rustc::hir::map::Map; use rustc::hir::{self, Destination, Movability, Node}; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_span::Span; use syntax::struct_span_err; -use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/librustc_passes/region.rs b/src/librustc_passes/region.rs index 7630e3e8950c1..1004e639b6ef7 100644 --- a/src/librustc_passes/region.rs +++ b/src/librustc_passes/region.rs @@ -17,8 +17,8 @@ use rustc::ty::TyCtxt; use rustc::util::nodemap::FxHashSet; use rustc_index::vec::Idx; +use rustc_span::Span; use syntax::source_map; -use syntax_pos::Span; use std::mem; diff --git a/src/librustc_plugin_impl/Cargo.toml b/src/librustc_plugin_impl/Cargo.toml index 05046ae3a0dd6..a9bbe429c00cc 100644 --- a/src/librustc_plugin_impl/Cargo.toml +++ b/src/librustc_plugin_impl/Cargo.toml @@ -14,5 +14,5 @@ doctest = false rustc = { path = "../librustc" } rustc_metadata = { path = "../librustc_metadata" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } rustc_error_codes = { path = "../librustc_error_codes" } diff --git a/src/librustc_plugin_impl/build.rs b/src/librustc_plugin_impl/build.rs index ea462b4965190..caa43b3380275 100644 --- a/src/librustc_plugin_impl/build.rs +++ b/src/librustc_plugin_impl/build.rs @@ -5,9 +5,9 @@ use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_span::Span; use syntax::attr; use syntax::symbol::sym; -use syntax_pos::Span; struct RegistrarFinder { registrars: Vec<(hir::HirId, Span)>, diff --git a/src/librustc_plugin_impl/load.rs b/src/librustc_plugin_impl/load.rs index 7eeeed1e92be1..3010691dba20d 100644 --- a/src/librustc_plugin_impl/load.rs +++ b/src/librustc_plugin_impl/load.rs @@ -5,6 +5,7 @@ use rustc::middle::cstore::MetadataLoader; use rustc::session::Session; use rustc_metadata::locator; +use rustc_span::Span; use std::borrow::ToOwned; use std::env; use std::mem; @@ -12,7 +13,6 @@ use std::path::PathBuf; use syntax::ast::{Crate, Ident}; use syntax::struct_span_err; use syntax::symbol::sym; -use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/librustc_privacy/Cargo.toml b/src/librustc_privacy/Cargo.toml index 8a2fbf8974d4b..e39c0b427dab1 100644 --- a/src/librustc_privacy/Cargo.toml +++ b/src/librustc_privacy/Cargo.toml @@ -12,7 +12,7 @@ path = "lib.rs" rustc = { path = "../librustc" } rustc_typeck = { path = "../librustc_typeck" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_error_codes = { path = "../librustc_error_codes" } log = "0.4" diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index d666c80b899e9..6c3053f016bf0 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -20,11 +20,11 @@ use rustc::ty::subst::InternalSubsts; use rustc::ty::{self, GenericParamDefKind, TraitRef, Ty, TyCtxt, TypeFoldable}; use rustc::util::nodemap::HirIdSet; use rustc_data_structures::fx::FxHashSet; +use rustc_span::hygiene::Transparency; +use rustc_span::Span; use syntax::ast::Ident; use syntax::attr; use syntax::symbol::{kw, sym}; -use syntax_pos::hygiene::Transparency; -use syntax_pos::Span; use std::marker::PhantomData; use std::{cmp, fmt, mem}; diff --git a/src/librustc_resolve/Cargo.toml b/src/librustc_resolve/Cargo.toml index 00ca06872c99e..a7ad0db99cfe0 100644 --- a/src/librustc_resolve/Cargo.toml +++ b/src/librustc_resolve/Cargo.toml @@ -17,7 +17,7 @@ syntax = { path = "../libsyntax" } rustc_expand = { path = "../librustc_expand" } arena = { path = "../libarena" } errors = { path = "../librustc_errors", package = "rustc_errors" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } rustc = { path = "../librustc" } rustc_ast_lowering = { path = "../librustc_ast_lowering" } rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 388b00e9911b1..911de5d2174e6 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -31,6 +31,8 @@ use errors::Applicability; use rustc_expand::base::SyntaxExtension; use rustc_expand::expand::AstFragment; +use rustc_span::hygiene::{ExpnId, MacroKind}; +use rustc_span::{Span, DUMMY_SP}; use syntax::ast::{self, Block, ForeignItem, ForeignItemKind, Item, ItemKind, NodeId}; use syntax::ast::{AssocItem, AssocItemKind, MetaItemKind, StmtKind}; use syntax::ast::{Ident, Name}; @@ -40,8 +42,6 @@ use syntax::span_err; use syntax::symbol::{kw, sym}; use syntax::token::{self, Token}; use syntax::visit::{self, Visitor}; -use syntax_pos::hygiene::{ExpnId, MacroKind}; -use syntax_pos::{Span, DUMMY_SP}; use log::debug; diff --git a/src/librustc_resolve/check_unused.rs b/src/librustc_resolve/check_unused.rs index 93217aa147713..4f25d55db3610 100644 --- a/src/librustc_resolve/check_unused.rs +++ b/src/librustc_resolve/check_unused.rs @@ -31,9 +31,9 @@ use errors::pluralize; use rustc::util::nodemap::NodeMap; use rustc::{lint, ty}; use rustc_data_structures::fx::FxHashSet; +use rustc_span::{MultiSpan, Span, DUMMY_SP}; use syntax::ast; use syntax::visit::{self, Visitor}; -use syntax_pos::{MultiSpan, Span, DUMMY_SP}; struct UnusedImport<'a> { use_tree: &'a ast::UseTree, diff --git a/src/librustc_resolve/def_collector.rs b/src/librustc_resolve/def_collector.rs index e76f1f82f65ee..4662440ec31e1 100644 --- a/src/librustc_resolve/def_collector.rs +++ b/src/librustc_resolve/def_collector.rs @@ -2,12 +2,12 @@ use log::debug; use rustc::hir::def_id::DefIndex; use rustc::hir::map::definitions::*; use rustc_expand::expand::AstFragment; +use rustc_span::hygiene::ExpnId; +use rustc_span::Span; use syntax::ast::*; use syntax::symbol::{kw, sym}; use syntax::token::{self, Token}; use syntax::visit; -use syntax_pos::hygiene::ExpnId; -use syntax_pos::Span; crate fn collect_definitions( definitions: &mut Definitions, diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 82b9e5347b7a7..2553ac6208c57 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -10,14 +10,14 @@ use rustc::session::Session; use rustc::ty::{self, DefIdTree}; use rustc::util::nodemap::FxHashSet; use rustc_feature::BUILTIN_ATTRIBUTES; +use rustc_span::hygiene::MacroKind; +use rustc_span::{BytePos, MultiSpan, Span}; use syntax::ast::{self, Ident, Path}; use syntax::print::pprust; use syntax::source_map::SourceMap; use syntax::struct_span_err; use syntax::symbol::{kw, Symbol}; use syntax::util::lev_distance::find_best_match_for_name; -use syntax_pos::hygiene::MacroKind; -use syntax_pos::{BytePos, MultiSpan, Span}; use crate::imports::{ImportDirective, ImportDirectiveSubclass, ImportResolver}; use crate::path_names_to_string; diff --git a/src/librustc_resolve/imports.rs b/src/librustc_resolve/imports.rs index afbfb647b3cac..c79a97f93f07f 100644 --- a/src/librustc_resolve/imports.rs +++ b/src/librustc_resolve/imports.rs @@ -23,12 +23,12 @@ use rustc::util::nodemap::FxHashSet; use rustc::{bug, span_bug}; use rustc_data_structures::ptr_key::PtrKey; +use rustc_span::hygiene::ExpnId; +use rustc_span::{MultiSpan, Span}; use syntax::ast::{Ident, Name, NodeId}; use syntax::symbol::kw; use syntax::util::lev_distance::find_best_match_for_name; use syntax::{struct_span_err, unwrap_or}; -use syntax_pos::hygiene::ExpnId; -use syntax_pos::{MultiSpan, Span}; use rustc_error_codes::*; diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index ae0a9255497e9..a0d59fa4829e8 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -18,6 +18,7 @@ use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX}; use rustc::hir::TraitCandidate; use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc::{bug, lint, span_bug}; +use rustc_span::Span; use smallvec::{smallvec, SmallVec}; use syntax::ast::*; use syntax::ptr::P; @@ -25,7 +26,6 @@ use syntax::symbol::{kw, sym}; use syntax::util::lev_distance::find_best_match_for_name; use syntax::visit::{self, FnKind, Visitor}; use syntax::{unwrap_or, walk_list}; -use syntax_pos::Span; use std::collections::BTreeSet; use std::mem::replace; diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index 6fb5c2f2de31f..5e59efac53647 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -12,11 +12,11 @@ use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX}; use rustc::hir::PrimTy; use rustc::session::config::nightly_options; use rustc::util::nodemap::FxHashSet; +use rustc_span::hygiene::MacroKind; +use rustc_span::Span; use syntax::ast::{self, Expr, ExprKind, Ident, NodeId, Path, Ty, TyKind}; use syntax::symbol::kw; use syntax::util::lev_distance::find_best_match_for_name; -use syntax_pos::hygiene::MacroKind; -use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 069029d097b50..b1be98834795a 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -38,6 +38,8 @@ use rustc_metadata::creader::{CStore, CrateLoader}; use errors::{Applicability, DiagnosticBuilder}; use rustc_expand::base::SyntaxExtension; +use rustc_span::hygiene::{ExpnId, ExpnKind, MacroKind, SyntaxContext, Transparency}; +use rustc_span::{Span, DUMMY_SP}; use syntax::ast::{self, FloatTy, Ident, IntTy, Name, NodeId, UintTy}; use syntax::ast::{Crate, CRATE_NODE_ID}; use syntax::ast::{ItemKind, Path}; @@ -47,8 +49,6 @@ use syntax::source_map::Spanned; use syntax::symbol::{kw, sym}; use syntax::visit::{self, Visitor}; use syntax::{struct_span_err, unwrap_or}; -use syntax_pos::hygiene::{ExpnId, ExpnKind, MacroKind, SyntaxContext, Transparency}; -use syntax_pos::{Span, DUMMY_SP}; use log::debug; diff --git a/src/librustc_resolve/lifetimes.rs b/src/librustc_resolve/lifetimes.rs index 345974ae243e9..1f8573e44f1e1 100644 --- a/src/librustc_resolve/lifetimes.rs +++ b/src/librustc_resolve/lifetimes.rs @@ -15,13 +15,13 @@ use errors::{pluralize, Applicability, DiagnosticBuilder}; use rustc::lint; use rustc::session::Session; use rustc::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, HirIdMap, HirIdSet}; +use rustc_span::Span; use std::borrow::Cow; use std::cell::Cell; use std::mem::{replace, take}; use syntax::ast; use syntax::attr; use syntax::symbol::{kw, sym}; -use syntax_pos::Span; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::hir::{self, GenericParamKind, LifetimeParamKind}; diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index d9c3cf0f5f056..0903afeef4da4 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -17,18 +17,18 @@ use rustc_expand::base::{self, Indeterminate, InvocationRes}; use rustc_expand::compile_declarative_macro; use rustc_expand::expand::{AstFragment, AstFragmentKind, Invocation, InvocationKind}; use rustc_feature::is_builtin_attr_name; +use rustc_span::hygiene::{self, ExpnData, ExpnId, ExpnKind}; +use rustc_span::symbol::{kw, sym, Symbol}; +use rustc_span::{Span, DUMMY_SP}; use syntax::ast::{self, Ident, NodeId}; use syntax::attr::{self, StabilityLevel}; use syntax::edition::Edition; use syntax::feature_gate::feature_err; use syntax::print::pprust; -use syntax_pos::hygiene::{self, ExpnData, ExpnId, ExpnKind}; -use syntax_pos::symbol::{kw, sym, Symbol}; -use syntax_pos::{Span, DUMMY_SP}; use rustc_data_structures::sync::Lrc; +use rustc_span::hygiene::{AstPass, MacroKind}; use std::{mem, ptr}; -use syntax_pos::hygiene::{AstPass, MacroKind}; type Res = def::Res; diff --git a/src/librustc_save_analysis/Cargo.toml b/src/librustc_save_analysis/Cargo.toml index 7570944a4354c..cc31f78c5e941 100644 --- a/src/librustc_save_analysis/Cargo.toml +++ b/src/librustc_save_analysis/Cargo.toml @@ -16,6 +16,6 @@ rustc_codegen_utils = { path = "../librustc_codegen_utils" } rustc_parse = { path = "../librustc_parse" } serde_json = "1" syntax = { path = "../libsyntax" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } rls-data = "0.19" rls-span = "0.5" diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index c30a26d625b78..e898b8acfbefc 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -23,6 +23,7 @@ use rustc_data_structures::fx::FxHashSet; use std::env; use std::path::Path; +use rustc_span::*; use syntax::ast::{self, Attribute, NodeId, PatKind}; use syntax::print::pprust::{bounds_to_string, generic_params_to_string, ty_to_string}; use syntax::ptr::P; @@ -30,7 +31,6 @@ use syntax::source_map::{respan, DUMMY_SP}; use syntax::token; use syntax::visit::{self, Visitor}; use syntax::walk_list; -use syntax_pos::*; use crate::dumper::{Access, Dumper}; use crate::sig; diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 9f4fcb1f330a8..bebe5309b4465 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -26,13 +26,13 @@ use std::fs::File; use std::io::BufWriter; use std::path::{Path, PathBuf}; +use rustc_span::*; use syntax::ast::{self, Attribute, NodeId, PatKind, DUMMY_NODE_ID}; use syntax::print::pprust; use syntax::print::pprust::{param_to_string, ty_to_string}; use syntax::source_map::Spanned; use syntax::util::comments::strip_doc_comment_decoration; use syntax::visit::{self, Visitor}; -use syntax_pos::*; use dump_visitor::DumpVisitor; use span_utils::SpanUtils; diff --git a/src/librustc_save_analysis/span_utils.rs b/src/librustc_save_analysis/span_utils.rs index 59be4a0a9fbe6..f904a0bb9f806 100644 --- a/src/librustc_save_analysis/span_utils.rs +++ b/src/librustc_save_analysis/span_utils.rs @@ -1,8 +1,8 @@ use crate::generated_code; use rustc::session::Session; use rustc_parse::lexer::{self, StringReader}; +use rustc_span::*; use syntax::token::{self, TokenKind}; -use syntax_pos::*; #[derive(Clone)] pub struct SpanUtils<'a> { diff --git a/src/librustc_session/Cargo.toml b/src/librustc_session/Cargo.toml index 847a368d4cf55..47c23bc4dcf98 100644 --- a/src/librustc_session/Cargo.toml +++ b/src/librustc_session/Cargo.toml @@ -15,7 +15,7 @@ rustc_feature = { path = "../librustc_feature" } rustc_target = { path = "../librustc_target" } rustc_serialize = { path = "../libserialize", package = "serialize" } rustc_data_structures = { path = "../librustc_data_structures" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } rustc_index = { path = "../librustc_index" } rustc_fs_util = { path = "../librustc_fs_util" } num_cpus = "1.0" diff --git a/src/librustc_session/cgu_reuse_tracker.rs b/src/librustc_session/cgu_reuse_tracker.rs index 1230f63cdc7da..2f06ff95b1923 100644 --- a/src/librustc_session/cgu_reuse_tracker.rs +++ b/src/librustc_session/cgu_reuse_tracker.rs @@ -4,8 +4,8 @@ use log::debug; use rustc_data_structures::fx::FxHashMap; +use rustc_span::Span; use std::sync::{Arc, Mutex}; -use syntax_pos::Span; #[derive(Copy, Clone, Debug, PartialEq, PartialOrd)] pub enum CguReuse { diff --git a/src/librustc_session/config.rs b/src/librustc_session/config.rs index 75bd6babe16ec..164803d92b127 100644 --- a/src/librustc_session/config.rs +++ b/src/librustc_session/config.rs @@ -15,9 +15,9 @@ use rustc_target::spec::{Target, TargetTriple}; use crate::parse::CrateConfig; use rustc_feature::UnstableFeatures; -use syntax_pos::edition::{Edition, DEFAULT_EDITION, EDITION_NAME_LIST}; -use syntax_pos::source_map::{FileName, FilePathMapping}; -use syntax_pos::symbol::{sym, Symbol}; +use rustc_span::edition::{Edition, DEFAULT_EDITION, EDITION_NAME_LIST}; +use rustc_span::source_map::{FileName, FilePathMapping}; +use rustc_span::symbol::{sym, Symbol}; use rustc_errors::emitter::HumanReadableErrorType; use rustc_errors::{ColorConfig, FatalError, Handler}; @@ -1966,12 +1966,12 @@ crate mod dep_tracking { use crate::lint; use crate::utils::NativeLibraryKind; use rustc_feature::UnstableFeatures; + use rustc_span::edition::Edition; use rustc_target::spec::{MergeFunctions, PanicStrategy, RelroLevel, TargetTriple}; use std::collections::hash_map::DefaultHasher; use std::collections::BTreeMap; use std::hash::Hash; use std::path::PathBuf; - use syntax_pos::edition::Edition; pub trait DepTrackingHash { fn hash(&self, hasher: &mut DefaultHasher, error_format: ErrorOutputType); diff --git a/src/librustc_session/lint.rs b/src/librustc_session/lint.rs index 937cec6534476..0cce7e848fd60 100644 --- a/src/librustc_session/lint.rs +++ b/src/librustc_session/lint.rs @@ -1,8 +1,8 @@ pub use self::Level::*; use crate::node_id::NodeId; use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey}; -use syntax_pos::edition::Edition; -use syntax_pos::{sym, MultiSpan, Symbol}; +use rustc_span::edition::Edition; +use rustc_span::{sym, MultiSpan, Symbol}; /// Setting for how to handle a lint. #[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)] diff --git a/src/librustc_session/node_id.rs b/src/librustc_session/node_id.rs index 59e227895b508..b94c11391ebac 100644 --- a/src/librustc_session/node_id.rs +++ b/src/librustc_session/node_id.rs @@ -1,7 +1,7 @@ use rustc_index::vec::Idx; use rustc_serialize::{Decoder, Encoder}; +use rustc_span::ExpnId; use std::fmt; -use syntax_pos::ExpnId; rustc_index::newtype_index! { pub struct NodeId { diff --git a/src/librustc_session/options.rs b/src/librustc_session/options.rs index 3683daf7a87de..7e44ef7d4a433 100644 --- a/src/librustc_session/options.rs +++ b/src/librustc_session/options.rs @@ -9,7 +9,7 @@ use rustc_target::spec::TargetTriple; use rustc_target::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, RelroLevel}; use rustc_feature::UnstableFeatures; -use syntax_pos::edition::Edition; +use rustc_span::edition::Edition; use getopts; diff --git a/src/librustc_session/parse.rs b/src/librustc_session/parse.rs index 0c6295a184c7c..6cc6a1ec276ca 100644 --- a/src/librustc_session/parse.rs +++ b/src/librustc_session/parse.rs @@ -10,10 +10,10 @@ use rustc_errors::{ emitter::SilentEmitter, Applicability, ColorConfig, DiagnosticBuilder, Handler, }; use rustc_feature::UnstableFeatures; -use syntax_pos::edition::Edition; -use syntax_pos::hygiene::ExpnId; -use syntax_pos::source_map::{FilePathMapping, SourceMap}; -use syntax_pos::{MultiSpan, Span, Symbol}; +use rustc_span::edition::Edition; +use rustc_span::hygiene::ExpnId; +use rustc_span::source_map::{FilePathMapping, SourceMap}; +use rustc_span::{MultiSpan, Span, Symbol}; use std::path::PathBuf; use std::str; diff --git a/src/librustc_session/session.rs b/src/librustc_session/session.rs index 8e9de69539a86..28acbd5713f12 100644 --- a/src/librustc_session/session.rs +++ b/src/librustc_session/session.rs @@ -24,9 +24,9 @@ use rustc_errors::emitter::HumanReadableErrorType; use rustc_errors::emitter::{Emitter, EmitterWriter}; use rustc_errors::json::JsonEmitter; use rustc_errors::{Applicability, DiagnosticBuilder, DiagnosticId}; -use syntax_pos::edition::Edition; -use syntax_pos::source_map; -use syntax_pos::{MultiSpan, Span}; +use rustc_span::edition::Edition; +use rustc_span::source_map; +use rustc_span::{MultiSpan, Span}; use rustc_data_structures::flock; use rustc_data_structures::jobserver::{self, Client}; diff --git a/src/librustc_span/symbol.rs b/src/librustc_span/symbol.rs index 7ae037faf151d..7357153d4d627 100644 --- a/src/librustc_span/symbol.rs +++ b/src/librustc_span/symbol.rs @@ -102,7 +102,7 @@ symbols! { Union: "union", } - // Symbols that can be referred to with syntax_pos::sym::*. The symbol is + // Symbols that can be referred to with rustc_span::sym::*. The symbol is // the stringified identifier unless otherwise specified (e.g. // `proc_dash_macro` represents "proc-macro"). // diff --git a/src/librustc_target/Cargo.toml b/src/librustc_target/Cargo.toml index 8b60bde4dc42b..0e234036879e5 100644 --- a/src/librustc_target/Cargo.toml +++ b/src/librustc_target/Cargo.toml @@ -14,5 +14,5 @@ log = "0.4" rustc_data_structures = { path = "../librustc_data_structures" } rustc_macros = { path = "../librustc_macros" } rustc_serialize = { path = "../libserialize", package = "serialize" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } rustc_index = { path = "../librustc_index" } diff --git a/src/librustc_target/abi/mod.rs b/src/librustc_target/abi/mod.rs index 1b0701914b299..3f44339bf4cc2 100644 --- a/src/librustc_target/abi/mod.rs +++ b/src/librustc_target/abi/mod.rs @@ -7,7 +7,7 @@ use std::ops::{Add, AddAssign, Deref, Mul, Range, RangeInclusive, Sub}; use rustc_index::vec::{Idx, IndexVec}; use rustc_macros::HashStable_Generic; -use syntax_pos::Span; +use rustc_span::Span; pub mod call; diff --git a/src/librustc_traits/Cargo.toml b/src/librustc_traits/Cargo.toml index 5573b4bc84060..979587f7ac394 100644 --- a/src/librustc_traits/Cargo.toml +++ b/src/librustc_traits/Cargo.toml @@ -15,6 +15,6 @@ rustc_data_structures = { path = "../librustc_data_structures" } rustc_macros = { path = "../librustc_macros" } rustc_target = { path = "../librustc_target" } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } chalk-engine = { version = "0.9.0", default-features=false } smallvec = { version = "1.0", features = ["union", "may_dangle"] } diff --git a/src/librustc_traits/chalk_context/mod.rs b/src/librustc_traits/chalk_context/mod.rs index 96b81711464f9..4b10b08ddd94c 100644 --- a/src/librustc_traits/chalk_context/mod.rs +++ b/src/librustc_traits/chalk_context/mod.rs @@ -19,7 +19,7 @@ use rustc::ty::query::Providers; use rustc::ty::subst::{GenericArg, GenericArgKind}; use rustc::ty::{self, TyCtxt}; use rustc_macros::{Lift, TypeFoldable}; -use syntax_pos::DUMMY_SP; +use rustc_span::DUMMY_SP; use std::fmt::{self, Debug}; use std::marker::PhantomData; diff --git a/src/librustc_traits/chalk_context/resolvent_ops.rs b/src/librustc_traits/chalk_context/resolvent_ops.rs index 3b54b4a26e45f..70e3c4c7ab18b 100644 --- a/src/librustc_traits/chalk_context/resolvent_ops.rs +++ b/src/librustc_traits/chalk_context/resolvent_ops.rs @@ -8,7 +8,7 @@ use rustc::traits::{ use rustc::ty::relate::{Relate, RelateResult, TypeRelation}; use rustc::ty::subst::GenericArg; use rustc::ty::{self, Ty, TyCtxt}; -use syntax_pos::DUMMY_SP; +use rustc_span::DUMMY_SP; use super::unify::*; use super::{ChalkArenas, ChalkExClause, ChalkInferenceContext, ConstrainedSubst}; diff --git a/src/librustc_traits/chalk_context/unify.rs b/src/librustc_traits/chalk_context/unify.rs index 52ddc4aa0ec23..fcb3c3b177357 100644 --- a/src/librustc_traits/chalk_context/unify.rs +++ b/src/librustc_traits/chalk_context/unify.rs @@ -3,7 +3,7 @@ use rustc::infer::{InferCtxt, RegionVariableOrigin}; use rustc::traits::{DomainGoal, Environment, Goal, InEnvironment}; use rustc::ty; use rustc::ty::relate::{Relate, RelateResult, TypeRelation}; -use syntax_pos::DUMMY_SP; +use rustc_span::DUMMY_SP; crate struct UnificationResult<'tcx> { crate goals: Vec>>, diff --git a/src/librustc_traits/normalize_projection_ty.rs b/src/librustc_traits/normalize_projection_ty.rs index 9b0dfa4b987c1..6b539b8993160 100644 --- a/src/librustc_traits/normalize_projection_ty.rs +++ b/src/librustc_traits/normalize_projection_ty.rs @@ -4,8 +4,8 @@ use rustc::traits::query::{normalize::NormalizationResult, CanonicalProjectionGo use rustc::traits::{self, ObligationCause, SelectionContext, TraitEngineExt}; use rustc::ty::query::Providers; use rustc::ty::{ParamEnvAnd, TyCtxt}; +use rustc_span::DUMMY_SP; use std::sync::atomic::Ordering; -use syntax_pos::DUMMY_SP; crate fn provide(p: &mut Providers<'_>) { *p = Providers { normalize_projection_ty, ..*p }; diff --git a/src/librustc_traits/type_op.rs b/src/librustc_traits/type_op.rs index 2c02ac63d739e..6357df6d6e9c6 100644 --- a/src/librustc_traits/type_op.rs +++ b/src/librustc_traits/type_op.rs @@ -15,8 +15,8 @@ use rustc::ty::subst::{GenericArg, Subst, UserSelfTy, UserSubsts}; use rustc::ty::{ FnSig, Lift, ParamEnv, ParamEnvAnd, PolyFnSig, Predicate, Ty, TyCtxt, TypeFoldable, Variance, }; +use rustc_span::DUMMY_SP; use std::fmt; -use syntax_pos::DUMMY_SP; crate fn provide(p: &mut Providers<'_>) { *p = Providers { diff --git a/src/librustc_typeck/Cargo.toml b/src/librustc_typeck/Cargo.toml index bf1932ccf26d6..167ba8458936a 100644 --- a/src/librustc_typeck/Cargo.toml +++ b/src/librustc_typeck/Cargo.toml @@ -19,6 +19,6 @@ errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_target = { path = "../librustc_target" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } syntax = { path = "../libsyntax" } -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } rustc_index = { path = "../librustc_index" } rustc_error_codes = { path = "../librustc_error_codes" } diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 41d493cceec69..8934fd4df742a 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -22,6 +22,7 @@ use rustc::ty::subst::{self, InternalSubsts, Subst, SubstsRef}; use rustc::ty::wf::object_region_bounds; use rustc::ty::{self, Const, DefIdTree, ToPredicate, Ty, TyCtxt, TypeFoldable}; use rustc::ty::{GenericParamDef, GenericParamDefKind}; +use rustc_span::{MultiSpan, Span, DUMMY_SP}; use rustc_target::spec::abi; use smallvec::SmallVec; use syntax::ast; @@ -29,7 +30,6 @@ use syntax::errors::pluralize; use syntax::feature_gate::feature_err; use syntax::symbol::sym; use syntax::util::lev_distance::find_best_match_for_name; -use syntax_pos::{MultiSpan, Span, DUMMY_SP}; use std::collections::BTreeSet; use std::iter; diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 841dd226b4058..4c0ef45cae5c5 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -5,7 +5,7 @@ use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc::traits::ObligationCauseCode; use rustc::traits::{IfExpressionCause, MatchExpressionArmCause, ObligationCause}; use rustc::ty::Ty; -use syntax_pos::Span; +use rustc_span::Span; impl<'a, 'tcx> FnCtxt<'a, 'tcx> { pub fn check_match( diff --git a/src/librustc_typeck/check/autoderef.rs b/src/librustc_typeck/check/autoderef.rs index 897ee9c68e100..45c9922c579ce 100644 --- a/src/librustc_typeck/check/autoderef.rs +++ b/src/librustc_typeck/check/autoderef.rs @@ -9,8 +9,8 @@ use rustc::ty::adjustment::{Adjust, Adjustment, OverloadedDeref}; use rustc::ty::{self, TraitRef, Ty, TyCtxt}; use rustc::ty::{ToPredicate, TypeFoldable}; +use rustc_span::Span; use syntax::ast::Ident; -use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index 116f5ffc2513d..4b6bb2e05bfaa 100644 --- a/src/librustc_typeck/check/callee.rs +++ b/src/librustc_typeck/check/callee.rs @@ -10,9 +10,9 @@ use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoB use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; use rustc::{infer, traits}; +use rustc_span::Span; use rustc_target::spec::abi; use syntax::ast::Ident; -use syntax_pos::Span; use rustc::hir; diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index f82bb1a751ff8..445a723e3cb7d 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -43,8 +43,8 @@ use rustc::ty::cast::{CastKind, CastTy}; use rustc::ty::error::TypeError; use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TypeAndMut, TypeFoldable}; +use rustc_span::Span; use syntax::ast; -use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index 552e6a57c1d25..e079b42f81d5e 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -65,12 +65,12 @@ use rustc::ty::fold::TypeFoldable; use rustc::ty::relate::RelateResult; use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TypeAndMut}; +use rustc_span; use rustc_target::spec::abi::Abi; use smallvec::{smallvec, SmallVec}; use std::ops::Deref; use syntax::feature_gate; use syntax::symbol::sym; -use syntax_pos; use rustc_error_codes::*; @@ -826,7 +826,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let source = self.resolve_vars_with_obligations(expr_ty); debug!("coercion::can({:?} -> {:?})", source, target); - let cause = self.cause(syntax_pos::DUMMY_SP, ObligationCauseCode::ExprAssignable); + let cause = self.cause(rustc_span::DUMMY_SP, ObligationCauseCode::ExprAssignable); // We don't ever need two-phase here since we throw out the result of the coercion let coerce = Coerce::new(self, cause, AllowTwoPhase::No); self.probe(|_| coerce.coerce(source, target)).is_ok() diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index 79bad233fd10d..d6ef3889ee83d 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -9,8 +9,8 @@ use rustc::ty::util::ExplicitSelf; use rustc::ty::{self, GenericParamDefKind, TyCtxt}; use rustc::util::common::ErrorReported; +use rustc_span::Span; use syntax::errors::pluralize; -use syntax_pos::Span; use super::{potentially_plural_count, FnCtxt, Inherited}; diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 48403687aabdc..104321bcb79b0 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -6,9 +6,9 @@ use errors::{Applicability, DiagnosticBuilder}; use rustc::hir::{self, is_range_literal, print, Node}; use rustc::ty::adjustment::AllowTwoPhase; use rustc::ty::{self, AssocItem, Ty}; +use rustc_span::symbol::sym; +use rustc_span::Span; use syntax::util::parser::PREC_POSTFIX; -use syntax_pos::symbol::sym; -use syntax_pos::Span; use super::method::probe; diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs index 025bb05f63a4a..6f2d529bc34f7 100644 --- a/src/librustc_typeck/check/dropck.rs +++ b/src/librustc_typeck/check/dropck.rs @@ -12,7 +12,7 @@ use rustc::ty::relate::{Relate, RelateResult, TypeRelation}; use rustc::ty::subst::{Subst, SubstsRef}; use rustc::ty::{self, Predicate, Ty, TyCtxt}; -use syntax_pos::Span; +use rustc_span::Span; use rustc_error_codes::*; diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index 6c4b4ee179806..9ac047faa52fc 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -31,11 +31,11 @@ use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoB use rustc::ty::Ty; use rustc::ty::TypeFoldable; use rustc::ty::{AdtKind, Visibility}; +use rustc_span::hygiene::DesugaringKind; use syntax::ast; use syntax::source_map::Span; use syntax::symbol::{kw, sym, Symbol}; use syntax::util::lev_distance::find_best_match_for_name; -use syntax_pos::hygiene::DesugaringKind; use rustc_error_codes::*; diff --git a/src/librustc_typeck/check/generator_interior.rs b/src/librustc_typeck/check/generator_interior.rs index 3069f1b1d77d4..f63971039bc5a 100644 --- a/src/librustc_typeck/check/generator_interior.rs +++ b/src/librustc_typeck/check/generator_interior.rs @@ -11,7 +11,7 @@ use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::hir::{self, Expr, ExprKind, Pat, PatKind}; use rustc::middle::region::{self, YieldData}; use rustc::ty::{self, Ty}; -use syntax_pos::Span; +use rustc_span::Span; struct InteriorVisitor<'a, 'tcx> { fcx: &'a FnCtxt<'a, 'tcx>, @@ -30,7 +30,7 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> { expr: Option<&'tcx Expr<'tcx>>, source_span: Span, ) { - use syntax_pos::DUMMY_SP; + use rustc_span::DUMMY_SP; debug!( "generator_interior: attempting to record type {:?} {:?} {:?} {:?}", diff --git a/src/librustc_typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs index 4b5963af283a0..0f4d7e24df029 100644 --- a/src/librustc_typeck/check/method/confirm.rs +++ b/src/librustc_typeck/check/method/confirm.rs @@ -12,7 +12,7 @@ use rustc::ty::adjustment::{AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; use rustc::ty::fold::TypeFoldable; use rustc::ty::subst::{Subst, SubstsRef}; use rustc::ty::{self, GenericParamDefKind, Ty}; -use syntax_pos::Span; +use rustc_span::Span; use std::ops::Deref; @@ -142,7 +142,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { Some(n) => n, None => { self.tcx.sess.delay_span_bug( - syntax_pos::DUMMY_SP, + rustc_span::DUMMY_SP, &format!("failed autoderef {}", pick.autoderefs), ); return self.tcx.types.err; diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs index 877b1a3cc24c6..fe168b7ddbc47 100644 --- a/src/librustc_typeck/check/method/mod.rs +++ b/src/librustc_typeck/check/method/mod.rs @@ -23,8 +23,8 @@ use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::ty::GenericParamDefKind; use rustc::ty::{self, ToPolyTraitRef, ToPredicate, TraitRef, Ty, TypeFoldable}; use rustc_data_structures::sync::Lrc; +use rustc_span::Span; use syntax::ast; -use syntax_pos::Span; use self::probe::{IsSuggestion, ProbeScope}; diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 30631c0f6bac2..acf449d384cca 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -29,13 +29,13 @@ use rustc::ty::{ }; use rustc::util::nodemap::FxHashSet; use rustc_data_structures::sync::Lrc; +use rustc_span::{symbol::Symbol, Span, DUMMY_SP}; use std::cmp::max; use std::iter; use std::mem; use std::ops::Deref; use syntax::ast; use syntax::util::lev_distance::{find_best_match_for_name, lev_distance}; -use syntax_pos::{symbol::Symbol, Span, DUMMY_SP}; use rustc_error_codes::*; diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index d98a11b879ec6..7c5671f0f5024 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -14,9 +14,9 @@ use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc::traits::Obligation; use rustc::ty::print::with_crate_prefix; use rustc::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable}; +use rustc_span::{FileName, Span}; use syntax::util::lev_distance; use syntax::{ast, source_map}; -use syntax_pos::{FileName, Span}; use rustc_error_codes::*; diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 042c2fbd13a62..86f92ce9b8923 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -118,6 +118,8 @@ use rustc::ty::{ ToPredicate, Ty, TyCtxt, UserType, }; use rustc_index::vec::Idx; +use rustc_span::hygiene::DesugaringKind; +use rustc_span::{self, BytePos, MultiSpan, Span}; use rustc_target::spec::abi::Abi; use syntax::ast; use syntax::attr; @@ -125,8 +127,6 @@ use syntax::feature_gate::feature_err; use syntax::source_map::{original_sp, DUMMY_SP}; use syntax::symbol::{kw, sym, Ident}; use syntax::util::parser::ExprPrecedence; -use syntax_pos::hygiene::DesugaringKind; -use syntax_pos::{self, BytePos, MultiSpan, Span}; use rustc_error_codes::*; @@ -3354,7 +3354,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } }; debug!("fallback_if_possible: defaulting `{:?}` to `{:?}`", ty, fallback); - self.demand_eqtype(syntax_pos::DUMMY_SP, ty, fallback); + self.demand_eqtype(rustc_span::DUMMY_SP, ty, fallback); true } @@ -4414,7 +4414,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// if false { return 0i32; } else { 1u32 } /// // ^^^^ point at this instead of the whole `if` expression /// ``` - fn get_expr_coercion_span(&self, expr: &hir::Expr<'_>) -> syntax_pos::Span { + fn get_expr_coercion_span(&self, expr: &hir::Expr<'_>) -> rustc_span::Span { if let hir::ExprKind::Match(_, arms, _) = &expr.kind { let arm_spans: Vec = arms .iter() diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs index 873a9b86fd60f..e0035c4afc7cc 100644 --- a/src/librustc_typeck/check/op.rs +++ b/src/librustc_typeck/check/op.rs @@ -8,8 +8,8 @@ use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; use rustc::ty::TyKind::{Adt, Array, Char, FnDef, Never, Ref, Str, Tuple, Uint}; use rustc::ty::{self, Ty, TypeFoldable}; +use rustc_span::Span; use syntax::ast::Ident; -use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/librustc_typeck/check/pat.rs b/src/librustc_typeck/check/pat.rs index 7591189339603..251c8427ffd54 100644 --- a/src/librustc_typeck/check/pat.rs +++ b/src/librustc_typeck/check/pat.rs @@ -9,10 +9,10 @@ use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc::traits::Pattern; use rustc::ty::subst::GenericArg; use rustc::ty::{self, BindingMode, Ty, TypeFoldable}; +use rustc_span::hygiene::DesugaringKind; +use rustc_span::Span; use syntax::ast; use syntax::util::lev_distance::find_best_match_for_name; -use syntax_pos::hygiene::DesugaringKind; -use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs index a42b666f11620..90d8d0623a75b 100644 --- a/src/librustc_typeck/check/regionck.rs +++ b/src/librustc_typeck/check/regionck.rs @@ -85,9 +85,9 @@ use rustc::ty::{self, Ty}; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::hir::{self, PatKind}; +use rustc_span::Span; use std::mem; use std::ops::Deref; -use syntax_pos::Span; // a variation on try that just returns unit macro_rules! ignore_err { diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs index bdccced42c4b3..4376f9b6fa4a8 100644 --- a/src/librustc_typeck/check/upvar.rs +++ b/src/librustc_typeck/check/upvar.rs @@ -42,8 +42,8 @@ use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::infer::UpvarRegion; use rustc::ty::{self, Ty, TyCtxt, UpvarSubsts}; use rustc_data_structures::fx::FxIndexMap; +use rustc_span::Span; use syntax::ast; -use syntax_pos::Span; impl<'a, 'tcx> FnCtxt<'a, 'tcx> { pub fn closure_analyze(&self, body: &'tcx hir::Body<'tcx>) { diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index fa829d1b990d0..bf2c6776d1aa5 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -10,10 +10,10 @@ use rustc::ty::{self, GenericParamDefKind, ToPredicate, Ty, TyCtxt, TypeFoldable use rustc::util::nodemap::{FxHashMap, FxHashSet}; use errors::DiagnosticBuilder; +use rustc_span::Span; use syntax::ast; use syntax::feature_gate; use syntax::symbol::sym; -use syntax_pos::Span; use rustc::hir; use rustc::hir::itemlikevisit::ParItemLikeVisitor; diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index 2db6e24be052b..a19e6a113be61 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -14,8 +14,8 @@ use rustc::ty::fold::{TypeFoldable, TypeFolder}; use rustc::ty::{self, Ty, TyCtxt}; use rustc::util::nodemap::DefIdSet; use rustc_data_structures::sync::Lrc; +use rustc_span::Span; use syntax::symbol::sym; -use syntax_pos::Span; use std::mem; diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs index 3199815c35021..9b88345a2117a 100644 --- a/src/librustc_typeck/check_unused.rs +++ b/src/librustc_typeck/check_unused.rs @@ -2,8 +2,8 @@ use crate::lint; use rustc::ty::TyCtxt; use errors::Applicability; +use rustc_span::Span; use syntax::ast; -use syntax_pos::Span; use rustc::hir; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; diff --git a/src/librustc_typeck/coherence/inherent_impls.rs b/src/librustc_typeck/coherence/inherent_impls.rs index a497540bdcf22..4e75134a04cfd 100644 --- a/src/librustc_typeck/coherence/inherent_impls.rs +++ b/src/librustc_typeck/coherence/inherent_impls.rs @@ -12,8 +12,8 @@ use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::{self, CrateInherentImpls, TyCtxt}; +use rustc_span::Span; use syntax::ast; -use syntax_pos::Span; use rustc_error_codes::*; diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index e8193ae944891..dfbeb0353a61c 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -32,12 +32,12 @@ use rustc::util::captures::Captures; use rustc::util::nodemap::FxHashMap; use rustc_target::spec::abi; +use rustc_span::{Span, DUMMY_SP}; use syntax::ast; use syntax::ast::{Ident, MetaItemKind}; use syntax::attr::{list_contains_name, mark_used, InlineAttr, OptimizeAttr}; use syntax::feature_gate; use syntax::symbol::{kw, sym, Symbol}; -use syntax_pos::{Span, DUMMY_SP}; use rustc::hir::def::{CtorKind, DefKind, Res}; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; diff --git a/src/librustc_typeck/expr_use_visitor.rs b/src/librustc_typeck/expr_use_visitor.rs index b1467d508dcec..030b8a6214948 100644 --- a/src/librustc_typeck/expr_use_visitor.rs +++ b/src/librustc_typeck/expr_use_visitor.rs @@ -15,7 +15,7 @@ use rustc::infer::InferCtxt; use rustc::ty::{self, adjustment, TyCtxt}; use crate::mem_categorization as mc; -use syntax_pos::Span; +use rustc_span::Span; /////////////////////////////////////////////////////////////////////////// // The Delegate trait diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index 55b2ad4446790..82632bbc17c05 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -17,7 +17,7 @@ use rustc::ty::{self, TyCtxt, TypeFoldable}; use rustc::util::nodemap::{FxHashMap, FxHashSet}; use std::collections::hash_map::Entry::{Occupied, Vacant}; -use syntax_pos::Span; +use rustc_span::Span; use rustc_error_codes::*; diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index f06fe1e4bf211..289a4dc3ecb6d 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -106,8 +106,8 @@ use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TyCtxt}; use rustc::util; use rustc::util::common::ErrorReported; +use rustc_span::{Span, DUMMY_SP}; use rustc_target::spec::abi::Abi; -use syntax_pos::{Span, DUMMY_SP}; use util::common::time; use rustc_error_codes::*; diff --git a/src/librustc_typeck/mem_categorization.rs b/src/librustc_typeck/mem_categorization.rs index 4f5b55e4cd64e..4c5e7c81b27ff 100644 --- a/src/librustc_typeck/mem_categorization.rs +++ b/src/librustc_typeck/mem_categorization.rs @@ -57,7 +57,7 @@ use rustc::ty::adjustment; use rustc::ty::fold::TypeFoldable; use rustc::ty::{self, Ty, TyCtxt}; -use syntax_pos::Span; +use rustc_span::Span; use rustc_data_structures::fx::FxIndexMap; diff --git a/src/librustc_typeck/outlives/implicit_infer.rs b/src/librustc_typeck/outlives/implicit_infer.rs index 6de1f4649b0a5..9b96506b06e1b 100644 --- a/src/librustc_typeck/outlives/implicit_infer.rs +++ b/src/librustc_typeck/outlives/implicit_infer.rs @@ -4,7 +4,7 @@ use rustc::hir::{self, Node}; use rustc::ty::subst::{GenericArg, GenericArgKind, Subst}; use rustc::ty::{self, Ty, TyCtxt}; use rustc::util::nodemap::FxHashMap; -use syntax_pos::Span; +use rustc_span::Span; use super::explicit::ExplicitPredicatesMap; use super::utils::*; diff --git a/src/librustc_typeck/outlives/mod.rs b/src/librustc_typeck/outlives/mod.rs index 831ae6b91b086..a57553f3ea66c 100644 --- a/src/librustc_typeck/outlives/mod.rs +++ b/src/librustc_typeck/outlives/mod.rs @@ -4,8 +4,8 @@ use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc::ty::query::Providers; use rustc::ty::subst::GenericArgKind; use rustc::ty::{self, CratePredicatesMap, TyCtxt}; +use rustc_span::Span; use syntax::symbol::sym; -use syntax_pos::Span; mod explicit; mod implicit_infer; diff --git a/src/librustc_typeck/outlives/utils.rs b/src/librustc_typeck/outlives/utils.rs index 4858ba63a0644..2d7fc9d62e5fb 100644 --- a/src/librustc_typeck/outlives/utils.rs +++ b/src/librustc_typeck/outlives/utils.rs @@ -1,9 +1,9 @@ use rustc::ty::outlives::Component; use rustc::ty::subst::{GenericArg, GenericArgKind}; use rustc::ty::{self, Region, RegionKind, Ty, TyCtxt}; +use rustc_span::Span; use smallvec::smallvec; use std::collections::BTreeMap; -use syntax_pos::Span; /// Tracks the `T: 'a` or `'a: 'a` predicates that we have inferred /// must be added to the struct header. diff --git a/src/librustc_typeck/structured_errors.rs b/src/librustc_typeck/structured_errors.rs index c8e5a635c15cb..251732b6f1233 100644 --- a/src/librustc_typeck/structured_errors.rs +++ b/src/librustc_typeck/structured_errors.rs @@ -1,7 +1,7 @@ use errors::{Applicability, DiagnosticBuilder, DiagnosticId}; use rustc::session::Session; use rustc::ty::{Ty, TypeFoldable}; -use syntax_pos::Span; +use rustc_span::Span; use rustc_error_codes::*; diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs index b2c39be5d005f..635713bdf1db4 100644 --- a/src/librustdoc/clean/blanket_impl.rs +++ b/src/librustdoc/clean/blanket_impl.rs @@ -4,7 +4,7 @@ use rustc::infer::InferOk; use rustc::traits; use rustc::ty::subst::Subst; use rustc::ty::ToPredicate; -use syntax_pos::DUMMY_SP; +use rustc_span::DUMMY_SP; use super::*; diff --git a/src/librustdoc/clean/cfg.rs b/src/librustdoc/clean/cfg.rs index ad1886df6648e..8b739b704fba3 100644 --- a/src/librustdoc/clean/cfg.rs +++ b/src/librustdoc/clean/cfg.rs @@ -12,7 +12,7 @@ use syntax::ast::{LitKind, MetaItem, MetaItemKind, NestedMetaItem}; use syntax::sess::ParseSess; use syntax::symbol::{sym, Symbol}; -use syntax_pos::Span; +use rustc_span::Span; use crate::html::escape::Escape; diff --git a/src/librustdoc/clean/cfg/tests.rs b/src/librustdoc/clean/cfg/tests.rs index 620b3d928990d..3ea971e3138d9 100644 --- a/src/librustdoc/clean/cfg/tests.rs +++ b/src/librustdoc/clean/cfg/tests.rs @@ -1,10 +1,10 @@ use super::*; +use rustc_span::DUMMY_SP; use syntax::ast::*; use syntax::attr; use syntax::symbol::Symbol; use syntax::with_default_globals; -use syntax_pos::DUMMY_SP; fn word_cfg(s: &str) -> Cfg { Cfg::Cfg(Symbol::intern(s), None) diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index e12d9affdfabc..d3169de632e48 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -2,10 +2,10 @@ use std::iter::once; +use rustc_span::hygiene::MacroKind; +use rustc_span::Span; use syntax::ast; use syntax::symbol::sym; -use syntax_pos::hygiene::MacroKind; -use syntax_pos::Span; use rustc::hir::def::{CtorKind, DefKind, Res}; use rustc::hir::def_id::DefId; diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index defdeb52186cb..0ba7370f3ebe1 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -21,12 +21,12 @@ use rustc::ty::subst::InternalSubsts; use rustc::ty::{self, AdtKind, Lift, Ty, TyCtxt}; use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc_index::vec::{Idx, IndexVec}; +use rustc_span::hygiene::MacroKind; +use rustc_span::symbol::{kw, sym}; +use rustc_span::{self, Pos}; use rustc_typeck::hir_ty_to_ty; use syntax::ast::{self, Ident}; use syntax::attr; -use syntax_pos::hygiene::MacroKind; -use syntax_pos::symbol::{kw, sym}; -use syntax_pos::{self, Pos}; use std::collections::hash_map::Entry; use std::default::Default; @@ -1903,7 +1903,7 @@ impl Clean for hir::VariantData<'_> { } } -impl Clean for syntax_pos::Span { +impl Clean for rustc_span::Span { fn clean(&self, cx: &DocContext<'_>) -> Span { if self.is_dummy() { return Span::empty(); diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index a8781604622c6..0c4323a62f568 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -16,14 +16,14 @@ use rustc::middle::stability; use rustc::ty::layout::VariantIdx; use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc_index::vec::IndexVec; +use rustc_span::hygiene::MacroKind; +use rustc_span::symbol::{sym, Symbol}; +use rustc_span::{self, FileName}; use rustc_target::spec::abi::Abi; use syntax::ast::{self, AttrStyle, Ident}; use syntax::attr; use syntax::source_map::DUMMY_SP; use syntax::util::comments::strip_doc_comment_decoration; -use syntax_pos::hygiene::MacroKind; -use syntax_pos::symbol::{sym, Symbol}; -use syntax_pos::{self, FileName}; use crate::clean::cfg::Cfg; use crate::clean::external_path; @@ -360,12 +360,12 @@ impl> NestedAttributesExt for I { #[derive(Clone, PartialEq, Eq, Debug, Hash)] pub enum DocFragment { /// A doc fragment created from a `///` or `//!` doc comment. - SugaredDoc(usize, syntax_pos::Span, String), + SugaredDoc(usize, rustc_span::Span, String), /// A doc fragment created from a "raw" `#[doc=""]` attribute. - RawDoc(usize, syntax_pos::Span, String), + RawDoc(usize, rustc_span::Span, String), /// A doc fragment created from a `#[doc(include="filename")]` attribute. Contains both the /// given filename and the file contents. - Include(usize, syntax_pos::Span, String, String), + Include(usize, rustc_span::Span, String, String), } impl DocFragment { @@ -377,7 +377,7 @@ impl DocFragment { } } - pub fn span(&self) -> syntax_pos::Span { + pub fn span(&self) -> rustc_span::Span { match *self { DocFragment::SugaredDoc(_, span, _) | DocFragment::RawDoc(_, span, _) @@ -411,7 +411,7 @@ pub struct Attributes { pub doc_strings: Vec, pub other_attrs: Vec, pub cfg: Option>, - pub span: Option, + pub span: Option, /// map from Rust paths to resolved defs and potential URL fragments pub links: Vec<(String, Option, Option)>, pub inner_docs: bool, @@ -1349,7 +1349,7 @@ pub struct Span { pub locol: usize, pub hiline: usize, pub hicol: usize, - pub original: syntax_pos::Span, + pub original: rustc_span::Span, } impl Span { @@ -1360,11 +1360,11 @@ impl Span { locol: 0, hiline: 0, hicol: 0, - original: syntax_pos::DUMMY_SP, + original: rustc_span::DUMMY_SP, } } - pub fn span(&self) -> syntax_pos::Span { + pub fn span(&self) -> rustc_span::Span { self.original } } diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index e52afe501c34f..be4ae1c911975 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -16,9 +16,9 @@ use rustc::mir::interpret::{sign_extend, ConstValue, Scalar}; use rustc::ty::subst::{GenericArgKind, SubstsRef}; use rustc::ty::{self, DefIdTree, Ty}; use rustc::util::nodemap::FxHashSet; +use rustc_span; +use rustc_span::symbol::{kw, sym, Symbol}; use std::mem; -use syntax_pos; -use syntax_pos::symbol::{kw, sym, Symbol}; pub fn krate(mut cx: &mut DocContext<'_>) -> Crate { use crate::visit_lib::LibEmbargoVisitor; @@ -399,7 +399,7 @@ pub trait ToSource { fn to_src(&self, cx: &DocContext<'_>) -> String; } -impl ToSource for syntax_pos::Span { +impl ToSource for rustc_span::Span { fn to_src(&self, cx: &DocContext<'_>) -> String { debug!("converting span {:?} to snippet", self.clean(cx)); let sn = match cx.sess().source_map().span_to_snippet(*self) { diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 62218d8078542..bd19eeecf7726 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -17,11 +17,11 @@ use rustc_resolve as resolve; use errors::emitter::{Emitter, EmitterWriter}; use errors::json::JsonEmitter; +use rustc_span::DUMMY_SP; use syntax::ast::CRATE_NODE_ID; use syntax::attr; use syntax::source_map; use syntax::symbol::sym; -use syntax_pos::DUMMY_SP; use rustc_data_structures::sync::{self, Lrc}; use std::cell::RefCell; diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs index 07a3f66314522..81f2db91fd513 100644 --- a/src/librustdoc/doctree.rs +++ b/src/librustdoc/doctree.rs @@ -2,10 +2,10 @@ //! manner (and with prettier names) before cleaning. pub use self::StructType::*; +use rustc_span::hygiene::MacroKind; +use rustc_span::{self, Span}; use syntax::ast; use syntax::ast::Name; -use syntax_pos::hygiene::MacroKind; -use syntax_pos::{self, Span}; use rustc::hir; use rustc::hir::def_id::CrateNum; @@ -47,8 +47,8 @@ impl Module<'hir> { name: name, id: hir::CRATE_HIR_ID, vis, - where_outer: syntax_pos::DUMMY_SP, - where_inner: syntax_pos::DUMMY_SP, + where_outer: rustc_span::DUMMY_SP, + where_inner: rustc_span::DUMMY_SP, attrs, extern_crates: Vec::new(), imports: Vec::new(), diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index a2261edffffee..d8786a5e10e25 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -12,11 +12,11 @@ use std::io; use std::io::prelude::*; use rustc_parse::lexer; +use rustc_span::{FileName, Span}; use syntax::sess::ParseSess; use syntax::source_map::SourceMap; use syntax::symbol::{kw, sym}; use syntax::token::{self, Token}; -use syntax_pos::{FileName, Span}; /// Highlights `src`, returning the HTML output. pub fn render_with_highlighting( diff --git a/src/librustdoc/html/item_type.rs b/src/librustdoc/html/item_type.rs index 19cf7180eeefb..4a0f4e5a4c9c8 100644 --- a/src/librustdoc/html/item_type.rs +++ b/src/librustdoc/html/item_type.rs @@ -4,7 +4,7 @@ use std::fmt; use serde::{Serialize, Serializer}; -use syntax_pos::hygiene::MacroKind; +use rustc_span::hygiene::MacroKind; use crate::clean; diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index b578e69e60bcf..2c41e91b01b6a 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -50,6 +50,7 @@ use rustc::middle::stability; use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc_data_structures::flock; use rustc_feature::UnstableFeatures; +use rustc_span::hygiene::MacroKind; use serde::ser::SerializeSeq; use serde::{Serialize, Serializer}; use syntax::ast; @@ -57,7 +58,6 @@ use syntax::edition::Edition; use syntax::print::pprust; use syntax::source_map::FileName; use syntax::symbol::{sym, Symbol}; -use syntax_pos::hygiene::MacroKind; use crate::clean::{self, AttributesExt, Deprecation, GetDefId, SelfTy}; use crate::config::RenderOptions; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index b0496dabc7213..998b28b8807d3 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -34,7 +34,7 @@ extern crate rustc_lint; extern crate rustc_metadata; extern crate rustc_parse; extern crate rustc_resolve; -extern crate rustc_span as syntax_pos; +extern crate rustc_span as rustc_span; extern crate rustc_target; extern crate rustc_typeck; extern crate syntax; diff --git a/src/librustdoc/passes/calculate_doc_coverage.rs b/src/librustdoc/passes/calculate_doc_coverage.rs index 75f874d83274e..7432e8b0ce087 100644 --- a/src/librustdoc/passes/calculate_doc_coverage.rs +++ b/src/librustdoc/passes/calculate_doc_coverage.rs @@ -3,9 +3,9 @@ use crate::core::DocContext; use crate::fold::{self, DocFolder}; use crate::passes::Pass; +use rustc_span::FileName; use syntax::attr; use syntax::symbol::sym; -use syntax_pos::FileName; use std::collections::BTreeMap; use std::ops; diff --git a/src/librustdoc/passes/check_code_block_syntax.rs b/src/librustdoc/passes/check_code_block_syntax.rs index 7bbed4af23838..2b320b610473f 100644 --- a/src/librustdoc/passes/check_code_block_syntax.rs +++ b/src/librustdoc/passes/check_code_block_syntax.rs @@ -1,9 +1,9 @@ use errors::Applicability; use rustc_parse::lexer::StringReader as Lexer; +use rustc_span::{FileName, InnerSpan}; use syntax::sess::ParseSess; use syntax::source_map::FilePathMapping; use syntax::token; -use syntax_pos::{FileName, InnerSpan}; use crate::clean; use crate::core::DocContext; diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 75a87e7cc5dd9..7b89738b43cca 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -11,10 +11,10 @@ use rustc::ty; use rustc_expand::base::SyntaxExtensionKind; use rustc_feature::UnstableFeatures; use rustc_resolve::ParentScope; +use rustc_span::DUMMY_SP; use syntax; use syntax::ast::{self, Ident}; use syntax::symbol::Symbol; -use syntax_pos::DUMMY_SP; use std::ops::Range; diff --git a/src/librustdoc/passes/mod.rs b/src/librustdoc/passes/mod.rs index b69207be3fb36..7ac3009d8271d 100644 --- a/src/librustdoc/passes/mod.rs +++ b/src/librustdoc/passes/mod.rs @@ -5,9 +5,9 @@ use rustc::hir::def_id::DefId; use rustc::lint; use rustc::middle::privacy::AccessLevels; use rustc::util::nodemap::DefIdSet; +use rustc_span::{InnerSpan, Span, DUMMY_SP}; use std::mem; use std::ops::Range; -use syntax_pos::{InnerSpan, Span, DUMMY_SP}; use crate::clean::{self, GetDefId, Item}; use crate::core::DocContext; diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index f8ae044c8db2a..0066d36d55f11 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -5,6 +5,7 @@ use rustc::util::common::ErrorReported; use rustc_data_structures::sync::Lrc; use rustc_feature::UnstableFeatures; use rustc_interface::interface; +use rustc_span::{BytePos, FileName, Pos, Span, DUMMY_SP}; use rustc_target::spec::TargetTriple; use std::env; use std::io::{self, Write}; @@ -17,7 +18,6 @@ use syntax::edition::Edition; use syntax::source_map::SourceMap; use syntax::symbol::sym; use syntax::with_globals; -use syntax_pos::{BytePos, FileName, Pos, Span, DUMMY_SP}; use tempfile::Builder as TempFileBuilder; use testing; diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 642e949e984d3..4722539fd8481 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -7,11 +7,11 @@ use rustc::hir::{self, Node}; use rustc::middle::privacy::AccessLevel; use rustc::ty::TyCtxt; use rustc::util::nodemap::{FxHashMap, FxHashSet}; +use rustc_span::hygiene::MacroKind; +use rustc_span::{self, Span}; use syntax::ast; use syntax::source_map::Spanned; use syntax::symbol::sym; -use syntax_pos::hygiene::MacroKind; -use syntax_pos::{self, Span}; use std::mem; @@ -65,7 +65,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { let mut module = self.visit_mod_contents( krate.span, krate.attrs, - &Spanned { span: syntax_pos::DUMMY_SP, node: hir::VisibilityKind::Public }, + &Spanned { span: rustc_span::DUMMY_SP, node: hir::VisibilityKind::Public }, hir::CRATE_HIR_ID, &krate.module, None, diff --git a/src/libsyntax/Cargo.toml b/src/libsyntax/Cargo.toml index de35f1744c1fb..2098656db9822 100644 --- a/src/libsyntax/Cargo.toml +++ b/src/libsyntax/Cargo.toml @@ -15,7 +15,7 @@ rustc_serialize = { path = "../libserialize", package = "serialize" } log = "0.4" scoped-tls = "1.0" lazy_static = "1.0.0" -syntax_pos = { path = "../librustc_span", package = "rustc_span" } +rustc_span = { path = "../librustc_span" } errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_feature = { path = "../librustc_feature" } diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 0a2004a8229e9..7bf7ea0a424ef 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -22,15 +22,15 @@ pub use crate::util::parser::ExprPrecedence; pub use GenericArgs::*; pub use UnsafeSource::*; -pub use syntax_pos::symbol::{Ident, Symbol as Name}; +pub use rustc_span::symbol::{Ident, Symbol as Name}; use crate::ptr::P; use crate::source_map::{dummy_spanned, respan, Spanned}; use crate::token::{self, DelimToken}; use crate::tokenstream::{DelimSpan, TokenStream, TokenTree}; -use syntax_pos::symbol::{kw, sym, Symbol}; -use syntax_pos::{Span, DUMMY_SP}; +use rustc_span::symbol::{kw, sym, Symbol}; +use rustc_span::{Span, DUMMY_SP}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::Lrc; diff --git a/src/libsyntax/attr/builtin.rs b/src/libsyntax/attr/builtin.rs index bf64333830ea2..04c28dd5c5bcb 100644 --- a/src/libsyntax/attr/builtin.rs +++ b/src/libsyntax/attr/builtin.rs @@ -9,9 +9,9 @@ use crate::sess::ParseSess; use errors::{Applicability, Handler}; use rustc_feature::{find_gated_cfg, is_builtin_attr_name, Features, GatedCfg}; use rustc_macros::HashStable_Generic; +use rustc_span::hygiene::Transparency; +use rustc_span::{symbol::sym, symbol::Symbol, Span}; use std::num::NonZeroU32; -use syntax_pos::hygiene::Transparency; -use syntax_pos::{symbol::sym, symbol::Symbol, Span}; use rustc_error_codes::*; diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs index 0cd300384f856..3102aa5dd28e0 100644 --- a/src/libsyntax/attr/mod.rs +++ b/src/libsyntax/attr/mod.rs @@ -21,7 +21,7 @@ use crate::tokenstream::{DelimSpan, TokenStream, TokenTree, TreeAndJoint}; use crate::GLOBALS; use log::debug; -use syntax_pos::Span; +use rustc_span::Span; use std::iter; use std::ops::DerefMut; diff --git a/src/libsyntax/expand/allocator.rs b/src/libsyntax/expand/allocator.rs index 7ab8e370926f5..fbeeb47c23e9d 100644 --- a/src/libsyntax/expand/allocator.rs +++ b/src/libsyntax/expand/allocator.rs @@ -1,6 +1,6 @@ use crate::{ast, attr, visit}; -use syntax_pos::symbol::{sym, Symbol}; -use syntax_pos::Span; +use rustc_span::symbol::{sym, Symbol}; +use rustc_span::Span; #[derive(Clone, Copy)] pub enum AllocatorKind { diff --git a/src/libsyntax/expand/mod.rs b/src/libsyntax/expand/mod.rs index 761dc2f5684ee..50df8fa39eddf 100644 --- a/src/libsyntax/expand/mod.rs +++ b/src/libsyntax/expand/mod.rs @@ -1,7 +1,7 @@ //! Definitions shared by macros / syntax extensions and e.g. librustc. use crate::ast::Attribute; -use syntax_pos::symbol::sym; +use rustc_span::symbol::sym; pub mod allocator; diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index 6fd926f2048c6..e5635eaf1e915 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -17,7 +17,7 @@ use crate::visit::{self, FnKind, Visitor}; use errors::{Applicability, DiagnosticBuilder, Handler}; use log::debug; use rustc_data_structures::fx::FxHashMap; -use syntax_pos::{MultiSpan, Span, DUMMY_SP}; +use rustc_span::{MultiSpan, Span, DUMMY_SP}; use rustc_error_codes::*; diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 7b8819377e67c..b537f16ffcd9a 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 syntax_pos::edition::Edition; +use rustc_span::edition::Edition; #[macro_export] macro_rules! unwrap_or { @@ -36,7 +36,7 @@ macro_rules! unwrap_or { pub struct Globals { used_attrs: Lock>, known_attrs: Lock>, - syntax_pos_globals: syntax_pos::Globals, + rustc_span_globals: rustc_span::Globals, } impl Globals { @@ -46,7 +46,7 @@ impl Globals { // initiate the vectors with 0 bits. We'll grow them as necessary. used_attrs: Lock::new(GrowableBitSet::new_empty()), known_attrs: Lock::new(GrowableBitSet::new_empty()), - syntax_pos_globals: syntax_pos::Globals::new(edition), + rustc_span_globals: rustc_span::Globals::new(edition), } } } @@ -56,7 +56,7 @@ where F: FnOnce() -> R, { let globals = Globals::new(edition); - GLOBALS.set(&globals, || syntax_pos::GLOBALS.set(&globals.syntax_pos_globals, f)) + GLOBALS.set(&globals, || rustc_span::GLOBALS.set(&globals.rustc_span_globals, f)) } pub fn with_default_globals(f: F) -> R @@ -87,7 +87,7 @@ pub mod util { pub mod ast; pub mod attr; pub mod expand; -pub use syntax_pos::source_map; +pub use rustc_span::source_map; pub mod entry; pub mod feature_gate { mod check; @@ -97,8 +97,8 @@ pub mod mut_visit; pub mod ptr; pub mod show_span; pub use rustc_session::parse as sess; -pub use syntax_pos::edition; -pub use syntax_pos::symbol; +pub use rustc_span::edition; +pub use rustc_span::symbol; pub mod token; pub mod tokenstream; pub mod visit; @@ -114,4 +114,4 @@ pub mod early_buffered_lints; /// Requirements for a `StableHashingContext` to be used in this crate. /// This is a hack to allow using the `HashStable_Generic` derive macro /// instead of implementing everything in librustc. -pub trait HashStableContext: syntax_pos::HashStableContext {} +pub trait HashStableContext: rustc_span::HashStableContext {} diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs index f6817c713a4a6..965a6fcf23b12 100644 --- a/src/libsyntax/mut_visit.rs +++ b/src/libsyntax/mut_visit.rs @@ -14,8 +14,8 @@ use crate::token::{self, Token}; use crate::tokenstream::*; use crate::util::map_in_place::MapInPlace; +use rustc_span::Span; use smallvec::{smallvec, Array, SmallVec}; -use syntax_pos::Span; use rustc_data_structures::sync::Lrc; use std::ops::DerefMut; diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index b1b667f03bee2..eaad3a180005b 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -14,8 +14,8 @@ use crate::util::classify; use crate::util::comments; use crate::util::parser::{self, AssocOp, Fixity}; -use syntax_pos::{self, BytePos}; -use syntax_pos::{FileName, Span}; +use rustc_span::{self, BytePos}; +use rustc_span::{FileName, Span}; use std::borrow::Cow; @@ -71,7 +71,7 @@ impl<'a> Comments<'a> { pub fn trailing_comment( &mut self, - span: syntax_pos::Span, + span: rustc_span::Span, next_pos: Option, ) -> Option { if let Some(cmnt) = self.next() { @@ -131,7 +131,7 @@ pub fn print_crate<'a>( // Currently, in Rust 2018 we don't have `extern crate std;` at the crate // root, so this is not needed, and actually breaks things. - if sess.edition == syntax_pos::edition::Edition::Edition2015 { + if sess.edition == rustc_span::edition::Edition::Edition2015 { // `#![no_std]` let no_std_meta = attr::mk_word_item(ast::Ident::with_dummy_span(sym::no_std)); let fake_attr = attr::mk_attr_inner(no_std_meta); @@ -799,7 +799,7 @@ pub trait PrintState<'a>: std::ops::Deref + std::ops::Dere self.end(); // Close the head-box. } - fn bclose_maybe_open(&mut self, span: syntax_pos::Span, close_box: bool) { + fn bclose_maybe_open(&mut self, span: rustc_span::Span, close_box: bool) { self.maybe_print_comment(span.hi()); self.break_offset_if_not_bol(1, -(INDENT_UNIT as isize)); self.word("}"); @@ -808,7 +808,7 @@ pub trait PrintState<'a>: std::ops::Deref + std::ops::Dere } } - fn bclose(&mut self, span: syntax_pos::Span) { + fn bclose(&mut self, span: rustc_span::Span) { self.bclose_maybe_open(span, true) } @@ -896,7 +896,7 @@ impl<'a> State<'a> { crate fn commasep_cmnt(&mut self, b: Breaks, elts: &[T], mut op: F, mut get_span: G) where F: FnMut(&mut State<'_>, &T), - G: FnMut(&T) -> syntax_pos::Span, + G: FnMut(&T) -> rustc_span::Span, { self.rbox(0, b); let len = elts.len(); @@ -1366,7 +1366,7 @@ impl<'a> State<'a> { enum_definition: &ast::EnumDef, generics: &ast::Generics, ident: ast::Ident, - span: syntax_pos::Span, + span: rustc_span::Span, visibility: &ast::Visibility, ) { self.head(visibility_qualified(visibility, "enum")); @@ -1377,7 +1377,7 @@ impl<'a> State<'a> { self.print_variants(&enum_definition.variants, span) } - crate fn print_variants(&mut self, variants: &[ast::Variant], span: syntax_pos::Span) { + crate fn print_variants(&mut self, variants: &[ast::Variant], span: rustc_span::Span) { self.bopen(); for v in variants { self.space_if_not_bol(); @@ -1422,7 +1422,7 @@ impl<'a> State<'a> { struct_def: &ast::VariantData, generics: &ast::Generics, ident: ast::Ident, - span: syntax_pos::Span, + span: rustc_span::Span, print_finalizer: bool, ) { self.print_ident(ident); @@ -2701,8 +2701,8 @@ impl<'a> State<'a> { } let generics = ast::Generics { params: Vec::new(), - where_clause: ast::WhereClause { predicates: Vec::new(), span: syntax_pos::DUMMY_SP }, - span: syntax_pos::DUMMY_SP, + where_clause: ast::WhereClause { predicates: Vec::new(), span: rustc_span::DUMMY_SP }, + span: rustc_span::DUMMY_SP, }; self.print_fn( decl, @@ -2716,7 +2716,7 @@ impl<'a> State<'a> { crate fn maybe_print_trailing_comment( &mut self, - span: syntax_pos::Span, + span: rustc_span::Span, next_pos: Option, ) { if let Some(cmnts) = self.comments() { diff --git a/src/libsyntax/print/pprust/tests.rs b/src/libsyntax/print/pprust/tests.rs index 2a1a1ad58f142..07657e3061e4c 100644 --- a/src/libsyntax/print/pprust/tests.rs +++ b/src/libsyntax/print/pprust/tests.rs @@ -3,7 +3,7 @@ use super::*; use crate::ast; use crate::source_map; use crate::with_default_globals; -use syntax_pos; +use rustc_span; fn fun_to_string( decl: &ast::FnDecl, @@ -36,7 +36,7 @@ fn test_fun_to_string() { let decl = ast::FnDecl { inputs: Vec::new(), - output: ast::FunctionRetTy::Default(syntax_pos::DUMMY_SP), + output: ast::FunctionRetTy::Default(rustc_span::DUMMY_SP), }; let generics = ast::Generics::default(); assert_eq!( @@ -53,12 +53,12 @@ fn test_variant_to_string() { let var = ast::Variant { ident, - vis: source_map::respan(syntax_pos::DUMMY_SP, ast::VisibilityKind::Inherited), + vis: source_map::respan(rustc_span::DUMMY_SP, ast::VisibilityKind::Inherited), attrs: Vec::new(), id: ast::DUMMY_NODE_ID, data: ast::VariantData::Unit(ast::DUMMY_NODE_ID), disr_expr: None, - span: syntax_pos::DUMMY_SP, + span: rustc_span::DUMMY_SP, is_placeholder: false, }; diff --git a/src/libsyntax/token.rs b/src/libsyntax/token.rs index 2242fdc9ed70f..9e63f8496049b 100644 --- a/src/libsyntax/token.rs +++ b/src/libsyntax/token.rs @@ -9,8 +9,8 @@ use crate::ptr::P; use crate::symbol::kw; use crate::tokenstream::TokenTree; -use syntax_pos::symbol::Symbol; -use syntax_pos::{self, Span, DUMMY_SP}; +use rustc_span::symbol::Symbol; +use rustc_span::{self, Span, DUMMY_SP}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::Lrc; diff --git a/src/libsyntax/tokenstream.rs b/src/libsyntax/tokenstream.rs index d9ea4a0137f42..03e8fff247b39 100644 --- a/src/libsyntax/tokenstream.rs +++ b/src/libsyntax/tokenstream.rs @@ -18,8 +18,8 @@ use crate::token::{self, DelimToken, Token, TokenKind}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::Lrc; use rustc_macros::HashStable_Generic; +use rustc_span::{Span, DUMMY_SP}; use smallvec::{smallvec, SmallVec}; -use syntax_pos::{Span, DUMMY_SP}; use std::{iter, mem}; diff --git a/src/libsyntax/util/comments.rs b/src/libsyntax/util/comments.rs index 1d2b753b69ac8..7f22355bd1d17 100644 --- a/src/libsyntax/util/comments.rs +++ b/src/libsyntax/util/comments.rs @@ -4,7 +4,7 @@ use crate::ast; use crate::sess::ParseSess; use crate::source_map::SourceMap; -use syntax_pos::{BytePos, CharPos, FileName, Pos}; +use rustc_span::{BytePos, CharPos, FileName, Pos}; use std::usize; diff --git a/src/libsyntax/util/literal.rs b/src/libsyntax/util/literal.rs index 27ce180a4bc7b..3b156e03d3eb6 100644 --- a/src/libsyntax/util/literal.rs +++ b/src/libsyntax/util/literal.rs @@ -10,7 +10,7 @@ use rustc_data_structures::sync::Lrc; use rustc_lexer::unescape::{unescape_byte, unescape_char}; use rustc_lexer::unescape::{unescape_byte_str, unescape_str}; use rustc_lexer::unescape::{unescape_raw_byte_str, unescape_raw_str}; -use syntax_pos::Span; +use rustc_span::Span; use std::ascii; diff --git a/src/libsyntax/util/node_count.rs b/src/libsyntax/util/node_count.rs index e768ab4c64801..39f978ce98c6c 100644 --- a/src/libsyntax/util/node_count.rs +++ b/src/libsyntax/util/node_count.rs @@ -2,7 +2,7 @@ use crate::ast::*; use crate::visit::*; -use syntax_pos::Span; +use rustc_span::Span; pub struct NodeCounter { pub count: usize, diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index fbc5d1332490f..ebb49abebb01e 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -17,7 +17,7 @@ use crate::ast::*; use crate::token::Token; use crate::tokenstream::{TokenStream, TokenTree}; -use syntax_pos::Span; +use rustc_span::Span; #[derive(Copy, Clone)] pub enum FnKind<'a> {