Skip to content

Commit 9e6fb53

Browse files
committed
Auto merge of #67763 - petrochenkov:crateren2, r=Centril
Rename `syntax_pos` to `rustc_span` in source code Follow-up to #67707. r? @Centril
2 parents 38aa6bd + 70f1d57 commit 9e6fb53

File tree

383 files changed

+601
-601
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

383 files changed

+601
-601
lines changed

src/libfmt_macros/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ name = "fmt_macros"
99
path = "lib.rs"
1010

1111
[dependencies]
12-
syntax_pos = { path = "../librustc_span", package = "rustc_span" }
12+
rustc_span = { path = "../librustc_span" }
1313
rustc_lexer = { path = "../librustc_lexer" }

src/libfmt_macros/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use std::iter;
2424
use std::str;
2525
use std::string;
2626

27-
use syntax_pos::{InnerSpan, Symbol};
27+
use rustc_span::{InnerSpan, Symbol};
2828

2929
#[derive(Copy, Clone)]
3030
struct InnerOffset(usize);

src/libfmt_macros/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ fn format_align_fill() {
144144
}
145145
#[test]
146146
fn format_counts() {
147-
use syntax_pos::{edition, Globals, GLOBALS};
147+
use rustc_span::{edition, Globals, GLOBALS};
148148
GLOBALS.set(&Globals::new(edition::DEFAULT_EDITION), || {
149149
same(
150150
"{:10x}",

src/librustc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ rustc_index = { path = "../librustc_index" }
3030
errors = { path = "../librustc_errors", package = "rustc_errors" }
3131
rustc_serialize = { path = "../libserialize", package = "serialize" }
3232
syntax = { path = "../libsyntax" }
33-
syntax_pos = { path = "../librustc_span", package = "rustc_span" }
33+
rustc_span = { path = "../librustc_span" }
3434
backtrace = "0.3.40"
3535
parking_lot = "0.9"
3636
byteorder = { version = "1.3" }

src/librustc/dep_graph/dep_node.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ use crate::traits::query::{
6565
use crate::ty::subst::SubstsRef;
6666
use crate::ty::{self, ParamEnvAnd, Ty, TyCtxt};
6767
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
68+
use rustc_span::symbol::Symbol;
6869
use std::fmt;
6970
use std::hash::Hash;
70-
use syntax_pos::symbol::Symbol;
7171

7272
// erase!() just makes tokens go away. It's used to specify which macro argument
7373
// is repeated (i.e., which sub-expression of the macro we are in) but don't need

src/librustc/hir/check_attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ use crate::lint::builtin::UNUSED_ATTRIBUTES;
1212
use crate::ty::query::Providers;
1313
use crate::ty::TyCtxt;
1414

15+
use rustc_span::Span;
1516
use std::fmt::{self, Display};
1617
use syntax::{attr, symbol::sym};
17-
use syntax_pos::Span;
1818

1919
use rustc_error_codes::*;
2020

src/librustc/hir/def.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ use crate::ty;
66
use crate::util::nodemap::DefIdMap;
77

88
use rustc_macros::HashStable;
9+
use rustc_span::hygiene::MacroKind;
10+
use rustc_span::Span;
911
use syntax::ast;
1012
use syntax::ast::NodeId;
11-
use syntax_pos::hygiene::MacroKind;
12-
use syntax_pos::Span;
1313

1414
use std::fmt::Debug;
1515

src/librustc/hir/intravisit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ use super::itemlikevisit::DeepVisitor;
3636
use crate::hir::map::Map;
3737
use crate::hir::*;
3838

39+
use rustc_span::Span;
3940
use syntax::ast::{Attribute, Ident, Name};
40-
use syntax_pos::Span;
4141

4242
#[derive(Copy, Clone)]
4343
pub enum FnKind<'a> {

src/librustc/hir/map/blocks.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use crate::hir as ast;
1515
use crate::hir::intravisit::FnKind;
1616
use crate::hir::map;
1717
use crate::hir::{Expr, FnDecl, Node};
18+
use rustc_span::Span;
1819
use syntax::ast::{Attribute, Ident};
19-
use syntax_pos::Span;
2020

2121
/// An FnLikeNode is a Node that is like a fn, in that it has a decl
2222
/// and a body (as well as a NodeId, a span, etc).

src/librustc/hir/map/collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ use crate::session::Session;
1111
use crate::util::nodemap::FxHashMap;
1212
use rustc_data_structures::svh::Svh;
1313
use rustc_index::vec::IndexVec;
14+
use rustc_span::Span;
1415
use std::iter::repeat;
1516
use syntax::ast::NodeId;
1617
use syntax::source_map::SourceMap;
17-
use syntax_pos::Span;
1818

1919
use crate::ich::StableHashingContext;
2020
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};

src/librustc/hir/map/definitions.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ use crate::util::nodemap::NodeMap;
1313
use rustc_data_structures::fx::FxHashMap;
1414
use rustc_data_structures::stable_hasher::StableHasher;
1515
use rustc_index::vec::IndexVec;
16+
use rustc_span::hygiene::ExpnId;
17+
use rustc_span::symbol::{sym, Symbol};
18+
use rustc_span::Span;
1619
use std::borrow::Borrow;
1720
use std::fmt::Write;
1821
use std::hash::Hash;
1922
use syntax::ast;
20-
use syntax_pos::hygiene::ExpnId;
21-
use syntax_pos::symbol::{sym, Symbol};
22-
use syntax_pos::Span;
2323

2424
/// The `DefPathTable` maps `DefIndex`es to `DefKey`s and vice versa.
2525
/// Internally the `DefPathTable` holds a tree of `DefKey`s, where each `DefKey`

src/librustc/hir/map/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ use crate::util::nodemap::FxHashMap;
1616

1717
use rustc_data_structures::svh::Svh;
1818
use rustc_index::vec::IndexVec;
19+
use rustc_span::hygiene::MacroKind;
20+
use rustc_span::{Span, DUMMY_SP};
1921
use rustc_target::spec::abi::Abi;
2022
use syntax::ast::{self, Name, NodeId};
2123
use syntax::source_map::Spanned;
22-
use syntax_pos::hygiene::MacroKind;
23-
use syntax_pos::{Span, DUMMY_SP};
2424

2525
pub mod blocks;
2626
mod collector;

src/librustc/hir/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ use errors::FatalError;
1919
use rustc_data_structures::sync::{par_for_each_in, Send, Sync};
2020
use rustc_macros::HashStable;
2121
use rustc_serialize::{self, Decodable, Decoder, Encodable, Encoder};
22+
use rustc_span::source_map::{SourceMap, Spanned};
23+
use rustc_span::symbol::{kw, sym, Symbol};
24+
use rustc_span::{MultiSpan, Span, DUMMY_SP};
2225
use rustc_target::spec::abi::Abi;
2326
use smallvec::SmallVec;
2427
use std::collections::{BTreeMap, BTreeSet};
@@ -30,9 +33,6 @@ pub use syntax::ast::{CaptureBy, Constness, Movability, Mutability, Unsafety};
3033
use syntax::attr::{InlineAttr, OptimizeAttr};
3134
use syntax::tokenstream::TokenStream;
3235
use syntax::util::parser::ExprPrecedence;
33-
use syntax_pos::source_map::{SourceMap, Spanned};
34-
use syntax_pos::symbol::{kw, sym, Symbol};
35-
use syntax_pos::{MultiSpan, Span, DUMMY_SP};
3636

3737
pub mod check_attr;
3838
pub mod def;

src/librustc/hir/pat_util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::hir::def::{CtorOf, DefKind, Res};
22
use crate::hir::def_id::DefId;
33
use crate::hir::{self, HirId, PatKind};
4+
use rustc_span::Span;
45
use syntax::ast;
5-
use syntax_pos::Span;
66

77
use std::iter::{Enumerate, ExactSizeIterator};
88

src/librustc/hir/print.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use rustc_span::{self, BytePos, FileName};
12
use rustc_target::spec::abi::Abi;
23
use syntax::ast;
34
use syntax::print::pp::Breaks::{Consistent, Inconsistent};
@@ -7,7 +8,6 @@ use syntax::sess::ParseSess;
78
use syntax::source_map::{SourceMap, Spanned};
89
use syntax::symbol::kw;
910
use syntax::util::parser::{self, AssocOp, Fixity};
10-
use syntax_pos::{self, BytePos, FileName};
1111

1212
use crate::hir;
1313
use crate::hir::{GenericArg, GenericParam, GenericParamKind};
@@ -178,7 +178,7 @@ impl<'a> State<'a> {
178178
self.end(); // close the head-box
179179
}
180180

181-
pub fn bclose_maybe_open(&mut self, span: syntax_pos::Span, close_box: bool) {
181+
pub fn bclose_maybe_open(&mut self, span: rustc_span::Span, close_box: bool) {
182182
self.maybe_print_comment(span.hi());
183183
self.break_offset_if_not_bol(1, -(INDENT_UNIT as isize));
184184
self.s.word("}");
@@ -187,7 +187,7 @@ impl<'a> State<'a> {
187187
}
188188
}
189189

190-
pub fn bclose(&mut self, span: syntax_pos::Span) {
190+
pub fn bclose(&mut self, span: rustc_span::Span) {
191191
self.bclose_maybe_open(span, true)
192192
}
193193

@@ -223,7 +223,7 @@ impl<'a> State<'a> {
223223
pub fn commasep_cmnt<T, F, G>(&mut self, b: Breaks, elts: &[T], mut op: F, mut get_span: G)
224224
where
225225
F: FnMut(&mut State<'_>, &T),
226-
G: FnMut(&T) -> syntax_pos::Span,
226+
G: FnMut(&T) -> rustc_span::Span,
227227
{
228228
self.rbox(0, b);
229229
let len = elts.len();
@@ -704,7 +704,7 @@ impl<'a> State<'a> {
704704
enum_definition: &hir::EnumDef<'_>,
705705
generics: &hir::Generics<'_>,
706706
name: ast::Name,
707-
span: syntax_pos::Span,
707+
span: rustc_span::Span,
708708
visibility: &hir::Visibility<'_>,
709709
) {
710710
self.head(visibility_qualified(visibility, "enum"));
@@ -715,7 +715,7 @@ impl<'a> State<'a> {
715715
self.print_variants(&enum_definition.variants, span)
716716
}
717717

718-
pub fn print_variants(&mut self, variants: &[hir::Variant<'_>], span: syntax_pos::Span) {
718+
pub fn print_variants(&mut self, variants: &[hir::Variant<'_>], span: rustc_span::Span) {
719719
self.bopen();
720720
for v in variants {
721721
self.space_if_not_bol();
@@ -763,7 +763,7 @@ impl<'a> State<'a> {
763763
struct_def: &hir::VariantData<'_>,
764764
generics: &hir::Generics<'_>,
765765
name: ast::Name,
766-
span: syntax_pos::Span,
766+
span: rustc_span::Span,
767767
print_finalizer: bool,
768768
) {
769769
self.print_name(name);
@@ -839,18 +839,18 @@ impl<'a> State<'a> {
839839
match ti.kind {
840840
hir::TraitItemKind::Const(ref ty, default) => {
841841
let vis =
842-
Spanned { span: syntax_pos::DUMMY_SP, node: hir::VisibilityKind::Inherited };
842+
Spanned { span: rustc_span::DUMMY_SP, node: hir::VisibilityKind::Inherited };
843843
self.print_associated_const(ti.ident, &ty, default, &vis);
844844
}
845845
hir::TraitItemKind::Method(ref sig, hir::TraitMethod::Required(ref arg_names)) => {
846846
let vis =
847-
Spanned { span: syntax_pos::DUMMY_SP, node: hir::VisibilityKind::Inherited };
847+
Spanned { span: rustc_span::DUMMY_SP, node: hir::VisibilityKind::Inherited };
848848
self.print_method_sig(ti.ident, sig, &ti.generics, &vis, arg_names, None);
849849
self.s.word(";");
850850
}
851851
hir::TraitItemKind::Method(ref sig, hir::TraitMethod::Provided(body)) => {
852852
let vis =
853-
Spanned { span: syntax_pos::DUMMY_SP, node: hir::VisibilityKind::Inherited };
853+
Spanned { span: rustc_span::DUMMY_SP, node: hir::VisibilityKind::Inherited };
854854
self.head("");
855855
self.print_method_sig(ti.ident, sig, &ti.generics, &vis, &[], Some(body));
856856
self.nbsp();
@@ -2097,8 +2097,8 @@ impl<'a> State<'a> {
20972097
}
20982098
let generics = hir::Generics {
20992099
params: &[],
2100-
where_clause: hir::WhereClause { predicates: &[], span: syntax_pos::DUMMY_SP },
2101-
span: syntax_pos::DUMMY_SP,
2100+
where_clause: hir::WhereClause { predicates: &[], span: rustc_span::DUMMY_SP },
2101+
span: rustc_span::DUMMY_SP,
21022102
};
21032103
self.print_fn(
21042104
decl,
@@ -2110,7 +2110,7 @@ impl<'a> State<'a> {
21102110
},
21112111
name,
21122112
&generics,
2113-
&Spanned { span: syntax_pos::DUMMY_SP, node: hir::VisibilityKind::Inherited },
2113+
&Spanned { span: rustc_span::DUMMY_SP, node: hir::VisibilityKind::Inherited },
21142114
arg_names,
21152115
None,
21162116
);
@@ -2119,7 +2119,7 @@ impl<'a> State<'a> {
21192119

21202120
pub fn maybe_print_trailing_comment(
21212121
&mut self,
2122-
span: syntax_pos::Span,
2122+
span: rustc_span::Span,
21232123
next_pos: Option<BytePos>,
21242124
) {
21252125
if let Some(cmnts) = self.comments() {

src/librustc/hir/upvars.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::hir::{self, HirId};
66
use crate::ty::query::Providers;
77
use crate::ty::TyCtxt;
88
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
9-
use syntax_pos::Span;
9+
use rustc_span::Span;
1010

1111
pub fn provide(providers: &mut Providers<'_>) {
1212
providers.upvars = |tcx, def_id| {

src/librustc/ich/hcx.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ use crate::ty::{fast_reject, TyCtxt};
99

1010
use std::cmp::Ord;
1111

12+
use rustc_span::{BytePos, SourceFile};
1213
use syntax::ast;
1314
use syntax::source_map::SourceMap;
1415
use syntax::symbol::Symbol;
15-
use syntax_pos::{BytePos, SourceFile};
1616

1717
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1818
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
@@ -270,7 +270,7 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for ast::NodeId {
270270
}
271271
}
272272

273-
impl<'a> syntax_pos::HashStableContext for StableHashingContext<'a> {
273+
impl<'a> rustc_span::HashStableContext for StableHashingContext<'a> {
274274
fn hash_spans(&self) -> bool {
275275
self.hash_spans
276276
}

src/librustc/ich/impls_syntax.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
44
use crate::ich::StableHashingContext;
55

6+
use rustc_span::SourceFile;
67
use syntax::ast;
7-
use syntax_pos::SourceFile;
88

99
use crate::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX};
1010

@@ -114,22 +114,22 @@ impl<'a> HashStable<StableHashingContext<'a>> for SourceFile {
114114
}
115115
}
116116

117-
fn stable_byte_pos(pos: ::syntax_pos::BytePos, source_file_start: ::syntax_pos::BytePos) -> u32 {
117+
fn stable_byte_pos(pos: ::rustc_span::BytePos, source_file_start: ::rustc_span::BytePos) -> u32 {
118118
pos.0 - source_file_start.0
119119
}
120120

121121
fn stable_multibyte_char(
122-
mbc: ::syntax_pos::MultiByteChar,
123-
source_file_start: ::syntax_pos::BytePos,
122+
mbc: ::rustc_span::MultiByteChar,
123+
source_file_start: ::rustc_span::BytePos,
124124
) -> (u32, u32) {
125-
let ::syntax_pos::MultiByteChar { pos, bytes } = mbc;
125+
let ::rustc_span::MultiByteChar { pos, bytes } = mbc;
126126

127127
(pos.0 - source_file_start.0, bytes as u32)
128128
}
129129

130130
fn stable_non_narrow_char(
131-
swc: ::syntax_pos::NonNarrowChar,
132-
source_file_start: ::syntax_pos::BytePos,
131+
swc: ::rustc_span::NonNarrowChar,
132+
source_file_start: ::rustc_span::BytePos,
133133
) -> (u32, u32) {
134134
let pos = swc.pos();
135135
let width = swc.width();
@@ -138,10 +138,10 @@ fn stable_non_narrow_char(
138138
}
139139

140140
fn stable_normalized_pos(
141-
np: ::syntax_pos::NormalizedPos,
142-
source_file_start: ::syntax_pos::BytePos,
141+
np: ::rustc_span::NormalizedPos,
142+
source_file_start: ::rustc_span::BytePos,
143143
) -> (u32, u32) {
144-
let ::syntax_pos::NormalizedPos { pos, diff } = np;
144+
let ::rustc_span::NormalizedPos { pos, diff } = np;
145145

146146
(pos.0 - source_file_start.0, diff)
147147
}

src/librustc/ich/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ pub use self::hcx::{
44
hash_stable_trait_impls, NodeIdHashingMode, StableHashingContext, StableHashingContextProvider,
55
};
66
crate use rustc_data_structures::fingerprint::Fingerprint;
7+
pub use rustc_span::CachingSourceMapView;
78
use syntax::symbol::{sym, Symbol};
8-
pub use syntax_pos::CachingSourceMapView;
99

1010
mod hcx;
1111

src/librustc/infer/canonical/canonicalizer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl CanonicalizeRegionMode for CanonicalizeQueryResponse {
190190
// `delay_span_bug` to allow type error over an ICE.
191191
ty::tls::with_context(|c| {
192192
c.tcx.sess.delay_span_bug(
193-
syntax_pos::DUMMY_SP,
193+
rustc_span::DUMMY_SP,
194194
&format!("unexpected region in query response: `{:?}`", r),
195195
);
196196
});

src/librustc/infer/canonical/query_response.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ use crate::ty::{self, BoundVar, Ty, TyCtxt};
2525
use crate::util::captures::Captures;
2626
use rustc_index::vec::Idx;
2727
use rustc_index::vec::IndexVec;
28+
use rustc_span::DUMMY_SP;
2829
use std::fmt::Debug;
29-
use syntax_pos::DUMMY_SP;
3030

3131
impl<'tcx> InferCtxtBuilder<'tcx> {
3232
/// The "main method" for a canonicalized trait query. Given the

0 commit comments

Comments
 (0)