Skip to content

Commit 9cdad68

Browse files
committed
syntax::codemap: Add static DUMMY_SP
It replaces `dummy_sp()`.
1 parent db204b2 commit 9cdad68

File tree

21 files changed

+94
-97
lines changed

21 files changed

+94
-97
lines changed

src/librustc/front/std_inject.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use driver::session::Session;
1414
use std::vec;
1515
use syntax::ast;
1616
use syntax::attr;
17-
use syntax::codemap::dummy_sp;
17+
use syntax::codemap::DUMMY_SP;
1818
use syntax::codemap;
1919
use syntax::fold::ast_fold;
2020
use syntax::fold;
@@ -47,7 +47,7 @@ fn no_prelude(attrs: &[ast::Attribute]) -> bool {
4747
fn spanned<T>(x: T) -> codemap::Spanned<T> {
4848
codemap::Spanned {
4949
node: x,
50-
span: dummy_sp(),
50+
span: DUMMY_SP,
5151
}
5252
}
5353

@@ -66,7 +66,7 @@ impl fold::ast_fold for StandardLibraryInjector {
6666
ast::DUMMY_NODE_ID),
6767
attrs: ~[],
6868
vis: ast::private,
69-
span: dummy_sp()
69+
span: DUMMY_SP
7070
}];
7171

7272
if use_uv(&crate) && !self.sess.building_library.get() {
@@ -77,7 +77,7 @@ impl fold::ast_fold for StandardLibraryInjector {
7777
ast::DUMMY_NODE_ID),
7878
attrs: ~[],
7979
vis: ast::private,
80-
span: dummy_sp()
80+
span: DUMMY_SP
8181
});
8282
vis.push(ast::view_item {
8383
node: ast::view_item_extern_mod(self.sess.ident_of("rustuv"),
@@ -86,7 +86,7 @@ impl fold::ast_fold for StandardLibraryInjector {
8686
ast::DUMMY_NODE_ID),
8787
attrs: ~[],
8888
vis: ast::private,
89-
span: dummy_sp()
89+
span: DUMMY_SP
9090
});
9191
}
9292

@@ -121,7 +121,7 @@ impl fold::ast_fold for StandardLibraryInjector {
121121

122122
fn fold_mod(&mut self, module: &ast::_mod) -> ast::_mod {
123123
let prelude_path = ast::Path {
124-
span: dummy_sp(),
124+
span: DUMMY_SP,
125125
global: false,
126126
segments: ~[
127127
ast::PathSegment {
@@ -143,7 +143,7 @@ impl fold::ast_fold for StandardLibraryInjector {
143143
node: ast::view_item_use(~[vp]),
144144
attrs: ~[],
145145
vis: ast::private,
146-
span: dummy_sp(),
146+
span: DUMMY_SP,
147147
};
148148

149149
let vis = vec::append(~[vi2], module.view_items);

src/librustc/front/test.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use std::vec;
1919
use syntax::ast_util::*;
2020
use syntax::attr::AttrMetaMethods;
2121
use syntax::attr;
22-
use syntax::codemap::{dummy_sp, Span, ExpnInfo, NameAndSpan, MacroAttribute};
22+
use syntax::codemap::{DUMMY_SP, Span, ExpnInfo, NameAndSpan, MacroAttribute};
2323
use syntax::codemap;
2424
use syntax::ext::base::ExtCtxt;
2525
use syntax::fold::ast_fold;
@@ -164,7 +164,7 @@ fn generate_test_harness(sess: session::Session, crate: ast::Crate)
164164
};
165165

166166
cx.ext_cx.bt_push(ExpnInfo {
167-
call_site: dummy_sp(),
167+
call_site: DUMMY_SP,
168168
callee: NameAndSpan {
169169
name: @"test",
170170
format: MacroAttribute,
@@ -298,7 +298,7 @@ fn mk_std(cx: &TestCtxt) -> ast::view_item {
298298
node: vi,
299299
attrs: ~[],
300300
vis: ast::public,
301-
span: dummy_sp()
301+
span: DUMMY_SP
302302
}
303303
}
304304

@@ -335,7 +335,7 @@ fn mk_test_module(cx: &TestCtxt) -> @ast::item {
335335
id: ast::DUMMY_NODE_ID,
336336
node: item_,
337337
vis: ast::public,
338-
span: dummy_sp(),
338+
span: DUMMY_SP,
339339
};
340340

341341
debug!("Synthetic test module:\n{}\n",
@@ -345,12 +345,12 @@ fn mk_test_module(cx: &TestCtxt) -> @ast::item {
345345
}
346346

347347
fn nospan<T>(t: T) -> codemap::Spanned<T> {
348-
codemap::Spanned { node: t, span: dummy_sp() }
348+
codemap::Spanned { node: t, span: DUMMY_SP }
349349
}
350350

351351
fn path_node(ids: ~[ast::Ident]) -> ast::Path {
352352
ast::Path {
353-
span: dummy_sp(),
353+
span: DUMMY_SP,
354354
global: false,
355355
segments: ids.move_iter().map(|identifier| ast::PathSegment {
356356
identifier: identifier,
@@ -362,7 +362,7 @@ fn path_node(ids: ~[ast::Ident]) -> ast::Path {
362362

363363
fn path_node_global(ids: ~[ast::Ident]) -> ast::Path {
364364
ast::Path {
365-
span: dummy_sp(),
365+
span: DUMMY_SP,
366366
global: true,
367367
segments: ids.move_iter().map(|identifier| ast::PathSegment {
368368
identifier: identifier,
@@ -403,13 +403,13 @@ fn mk_test_descs(cx: &TestCtxt) -> @ast::Expr {
403403
let inner_expr = @ast::Expr {
404404
id: ast::DUMMY_NODE_ID,
405405
node: ast::ExprVec(descs, ast::MutImmutable),
406-
span: dummy_sp(),
406+
span: DUMMY_SP,
407407
};
408408

409409
@ast::Expr {
410410
id: ast::DUMMY_NODE_ID,
411411
node: ast::ExprVstore(inner_expr, ast::ExprVstoreSlice),
412-
span: dummy_sp(),
412+
span: DUMMY_SP,
413413
}
414414
}
415415

src/librustc/metadata/creader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use syntax::ast;
2121
use syntax::abi;
2222
use syntax::attr;
2323
use syntax::attr::AttrMetaMethods;
24-
use syntax::codemap::{Span, dummy_sp};
24+
use syntax::codemap::{Span, DUMMY_SP};
2525
use syntax::diagnostic::SpanHandler;
2626
use syntax::parse::token;
2727
use syntax::parse::token::ident_interner;
@@ -346,7 +346,7 @@ fn resolve_crate_deps(e: &mut Env, cdata: &[u8]) -> cstore::cnum_map {
346346
// This is a new one so we've got to load it
347347
// FIXME (#2404): Need better error reporting than just a bogus
348348
// span.
349-
let fake_span = dummy_sp();
349+
let fake_span = DUMMY_SP;
350350
let local_cnum = resolve_crate(e, cname_str, cname_str, dep.vers,
351351
dep.hash, fake_span);
352352
cnum_map.insert(extrn_cnum, local_cnum);

src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ fn get_attributes(md: ebml::Doc) -> ~[ast::Attribute] {
10991099
value: meta_item,
11001100
is_sugared_doc: false,
11011101
},
1102-
span: codemap::dummy_sp()
1102+
span: codemap::DUMMY_SP
11031103
});
11041104
true
11051105
});

src/librustc/middle/astencode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl ExtendedDecodeContext {
218218
ast::DefId { crate: ast::LOCAL_CRATE, node: self.tr_id(did.node) }
219219
}
220220
pub fn tr_span(&self, _span: Span) -> Span {
221-
codemap::dummy_sp() // FIXME (#1972): handle span properly
221+
codemap::DUMMY_SP // FIXME (#1972): handle span properly
222222
}
223223
}
224224

src/librustc/middle/check_match.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use std::num;
2323
use std::vec;
2424
use syntax::ast::*;
2525
use syntax::ast_util::{unguarded_pat, walk_pat};
26-
use syntax::codemap::{Span, dummy_sp, Spanned};
26+
use syntax::codemap::{Span, DUMMY_SP, Spanned};
2727
use syntax::visit;
2828
use syntax::visit::{Visitor,fn_kind};
2929

@@ -536,11 +536,11 @@ fn ctor_arity(cx: &MatchCheckCtxt, ctor: &ctor, ty: ty::t) -> uint {
536536
}
537537

538538
fn wild() -> @Pat {
539-
@Pat {id: 0, node: PatWild, span: dummy_sp()}
539+
@Pat {id: 0, node: PatWild, span: DUMMY_SP}
540540
}
541541

542542
fn wild_multi() -> @Pat {
543-
@Pat {id: 0, node: PatWildMulti, span: dummy_sp()}
543+
@Pat {id: 0, node: PatWildMulti, span: DUMMY_SP}
544544
}
545545

546546
fn specialize(cx: &MatchCheckCtxt,

src/librustc/middle/resolve.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use syntax::parse::token;
2424
use syntax::parse::token::{ident_interner, interner_get};
2525
use syntax::parse::token::special_idents;
2626
use syntax::print::pprust::path_to_str;
27-
use syntax::codemap::{Span, dummy_sp, Pos};
27+
use syntax::codemap::{Span, DUMMY_SP, Pos};
2828
use syntax::opt_vec::OptVec;
2929
use syntax::visit;
3030
use syntax::visit::Visitor;
@@ -1643,7 +1643,7 @@ impl Resolver {
16431643
NormalModuleKind,
16441644
true,
16451645
is_public,
1646-
dummy_sp());
1646+
DUMMY_SP);
16471647
}
16481648
}
16491649
}
@@ -1661,16 +1661,16 @@ impl Resolver {
16611661
// public.
16621662
let is_public = vis != ast::private;
16631663
if is_struct {
1664-
child_name_bindings.define_type(def, dummy_sp(), is_public);
1664+
child_name_bindings.define_type(def, DUMMY_SP, is_public);
16651665
self.structs.insert(variant_id);
16661666
} else {
1667-
child_name_bindings.define_value(def, dummy_sp(), is_public);
1667+
child_name_bindings.define_value(def, DUMMY_SP, is_public);
16681668
}
16691669
}
16701670
DefFn(..) | DefStaticMethod(..) | DefStatic(..) => {
16711671
debug!("(building reduced graph for external \
16721672
crate) building value (fn/static) {}", final_ident);
1673-
child_name_bindings.define_value(def, dummy_sp(), is_public);
1673+
child_name_bindings.define_value(def, DUMMY_SP, is_public);
16741674
}
16751675
DefTrait(def_id) => {
16761676
debug!("(building reduced graph for external \
@@ -1711,7 +1711,7 @@ impl Resolver {
17111711
}
17121712
}
17131713

1714-
child_name_bindings.define_type(def, dummy_sp(), is_public);
1714+
child_name_bindings.define_type(def, DUMMY_SP, is_public);
17151715

17161716
// Define a module if necessary.
17171717
let parent_link = self.get_parent_link(new_parent, ident);
@@ -1720,21 +1720,21 @@ impl Resolver {
17201720
TraitModuleKind,
17211721
true,
17221722
is_public,
1723-
dummy_sp())
1723+
DUMMY_SP)
17241724
}
17251725
DefTy(_) => {
17261726
debug!("(building reduced graph for external \
17271727
crate) building type {}", final_ident);
17281728

1729-
child_name_bindings.define_type(def, dummy_sp(), is_public);
1729+
child_name_bindings.define_type(def, DUMMY_SP, is_public);
17301730
}
17311731
DefStruct(def_id) => {
17321732
debug!("(building reduced graph for external \
17331733
crate) building type and value for {}",
17341734
final_ident);
1735-
child_name_bindings.define_type(def, dummy_sp(), is_public);
1735+
child_name_bindings.define_type(def, DUMMY_SP, is_public);
17361736
if csearch::get_struct_fields(self.session.cstore, def_id).len() == 0 {
1737-
child_name_bindings.define_value(def, dummy_sp(), is_public);
1737+
child_name_bindings.define_value(def, DUMMY_SP, is_public);
17381738
}
17391739
self.structs.insert(def_id);
17401740
}
@@ -1782,7 +1782,7 @@ impl Resolver {
17821782
self.add_child(ident,
17831783
ModuleReducedGraphParent(root),
17841784
OverwriteDuplicates,
1785-
dummy_sp());
1785+
DUMMY_SP);
17861786

17871787
self.handle_external_def(def,
17881788
visibility,
@@ -1814,7 +1814,7 @@ impl Resolver {
18141814
final_ident,
18151815
ModuleReducedGraphParent(root),
18161816
OverwriteDuplicates,
1817-
dummy_sp());
1817+
DUMMY_SP);
18181818

18191819
// Process the static methods. First,
18201820
// create the module.
@@ -1842,7 +1842,7 @@ impl Resolver {
18421842
ImplModuleKind,
18431843
true,
18441844
true,
1845-
dummy_sp());
1845+
DUMMY_SP);
18461846
type_module =
18471847
child_name_bindings.
18481848
get_module();
@@ -1864,13 +1864,13 @@ impl Resolver {
18641864
self.add_child(ident,
18651865
new_parent,
18661866
OverwriteDuplicates,
1867-
dummy_sp());
1867+
DUMMY_SP);
18681868
let def = DefFn(
18691869
static_method_info.def_id,
18701870
static_method_info.purity);
18711871

18721872
method_name_bindings.define_value(
1873-
def, dummy_sp(),
1873+
def, DUMMY_SP,
18741874
visibility == ast::public);
18751875
}
18761876
}
@@ -5576,7 +5576,7 @@ impl Resolver {
55765576
// because this means that they were generated in some fashion by the
55775577
// compiler and we don't need to consider them.
55785578
if vi.vis == public { return }
5579-
if vi.span == dummy_sp() { return }
5579+
if vi.span == DUMMY_SP { return }
55805580

55815581
match vi.node {
55825582
view_item_extern_mod(..) => {} // ignore

0 commit comments

Comments
 (0)