Skip to content

Commit

Permalink
Rename syntax_pos to rustc_span in source code
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Jan 1, 2020
1 parent 38aa6bd commit 70f1d57
Show file tree
Hide file tree
Showing 383 changed files with 601 additions and 601 deletions.
2 changes: 1 addition & 1 deletion src/libfmt_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
2 changes: 1 addition & 1 deletion src/libfmt_macros/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/libfmt_macros/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/hir/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/intravisit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/map/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/map/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/hir/map/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/pat_util.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
28 changes: 14 additions & 14 deletions src/librustc/hir/print.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand All @@ -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};
Expand Down Expand Up @@ -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("}");
Expand All @@ -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)
}

Expand Down Expand Up @@ -223,7 +223,7 @@ impl<'a> State<'a> {
pub fn commasep_cmnt<T, F, G>(&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();
Expand Down Expand Up @@ -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"));
Expand All @@ -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();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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,
Expand All @@ -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,
);
Expand All @@ -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<BytePos>,
) {
if let Some(cmnts) = self.comments() {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/upvars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ich/hcx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -270,7 +270,7 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> 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
}
Expand Down
20 changes: 10 additions & 10 deletions src/librustc/ich/impls_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -114,22 +114,22 @@ impl<'a> HashStable<StableHashingContext<'a>> 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();
Expand All @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ich/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/canonical/canonicalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
});
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/canonical/query_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 70f1d57

Please sign in to comment.