Navigation Menu

Skip to content

Commit

Permalink
syntax::codemap: Add static DUMMY_SP
Browse files Browse the repository at this point in the history
It replaces `dummy_sp()`.
  • Loading branch information
klutzy committed Jan 1, 2014
1 parent db204b2 commit 9cdad68
Show file tree
Hide file tree
Showing 21 changed files with 94 additions and 97 deletions.
14 changes: 7 additions & 7 deletions src/librustc/front/std_inject.rs
Expand Up @@ -14,7 +14,7 @@ use driver::session::Session;
use std::vec;
use syntax::ast;
use syntax::attr;
use syntax::codemap::dummy_sp;
use syntax::codemap::DUMMY_SP;
use syntax::codemap;
use syntax::fold::ast_fold;
use syntax::fold;
Expand Down Expand Up @@ -47,7 +47,7 @@ fn no_prelude(attrs: &[ast::Attribute]) -> bool {
fn spanned<T>(x: T) -> codemap::Spanned<T> {
codemap::Spanned {
node: x,
span: dummy_sp(),
span: DUMMY_SP,
}
}

Expand All @@ -66,7 +66,7 @@ impl fold::ast_fold for StandardLibraryInjector {
ast::DUMMY_NODE_ID),
attrs: ~[],
vis: ast::private,
span: dummy_sp()
span: DUMMY_SP
}];

if use_uv(&crate) && !self.sess.building_library.get() {
Expand All @@ -77,7 +77,7 @@ impl fold::ast_fold for StandardLibraryInjector {
ast::DUMMY_NODE_ID),
attrs: ~[],
vis: ast::private,
span: dummy_sp()
span: DUMMY_SP
});
vis.push(ast::view_item {
node: ast::view_item_extern_mod(self.sess.ident_of("rustuv"),
Expand All @@ -86,7 +86,7 @@ impl fold::ast_fold for StandardLibraryInjector {
ast::DUMMY_NODE_ID),
attrs: ~[],
vis: ast::private,
span: dummy_sp()
span: DUMMY_SP
});
}

Expand Down Expand Up @@ -121,7 +121,7 @@ impl fold::ast_fold for StandardLibraryInjector {

fn fold_mod(&mut self, module: &ast::_mod) -> ast::_mod {
let prelude_path = ast::Path {
span: dummy_sp(),
span: DUMMY_SP,
global: false,
segments: ~[
ast::PathSegment {
Expand All @@ -143,7 +143,7 @@ impl fold::ast_fold for StandardLibraryInjector {
node: ast::view_item_use(~[vp]),
attrs: ~[],
vis: ast::private,
span: dummy_sp(),
span: DUMMY_SP,
};

let vis = vec::append(~[vi2], module.view_items);
Expand Down
18 changes: 9 additions & 9 deletions src/librustc/front/test.rs
Expand Up @@ -19,7 +19,7 @@ use std::vec;
use syntax::ast_util::*;
use syntax::attr::AttrMetaMethods;
use syntax::attr;
use syntax::codemap::{dummy_sp, Span, ExpnInfo, NameAndSpan, MacroAttribute};
use syntax::codemap::{DUMMY_SP, Span, ExpnInfo, NameAndSpan, MacroAttribute};
use syntax::codemap;
use syntax::ext::base::ExtCtxt;
use syntax::fold::ast_fold;
Expand Down Expand Up @@ -164,7 +164,7 @@ fn generate_test_harness(sess: session::Session, crate: ast::Crate)
};

cx.ext_cx.bt_push(ExpnInfo {
call_site: dummy_sp(),
call_site: DUMMY_SP,
callee: NameAndSpan {
name: @"test",
format: MacroAttribute,
Expand Down Expand Up @@ -298,7 +298,7 @@ fn mk_std(cx: &TestCtxt) -> ast::view_item {
node: vi,
attrs: ~[],
vis: ast::public,
span: dummy_sp()
span: DUMMY_SP
}
}

Expand Down Expand Up @@ -335,7 +335,7 @@ fn mk_test_module(cx: &TestCtxt) -> @ast::item {
id: ast::DUMMY_NODE_ID,
node: item_,
vis: ast::public,
span: dummy_sp(),
span: DUMMY_SP,
};

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

fn nospan<T>(t: T) -> codemap::Spanned<T> {
codemap::Spanned { node: t, span: dummy_sp() }
codemap::Spanned { node: t, span: DUMMY_SP }
}

fn path_node(ids: ~[ast::Ident]) -> ast::Path {
ast::Path {
span: dummy_sp(),
span: DUMMY_SP,
global: false,
segments: ids.move_iter().map(|identifier| ast::PathSegment {
identifier: identifier,
Expand All @@ -362,7 +362,7 @@ fn path_node(ids: ~[ast::Ident]) -> ast::Path {

fn path_node_global(ids: ~[ast::Ident]) -> ast::Path {
ast::Path {
span: dummy_sp(),
span: DUMMY_SP,
global: true,
segments: ids.move_iter().map(|identifier| ast::PathSegment {
identifier: identifier,
Expand Down Expand Up @@ -403,13 +403,13 @@ fn mk_test_descs(cx: &TestCtxt) -> @ast::Expr {
let inner_expr = @ast::Expr {
id: ast::DUMMY_NODE_ID,
node: ast::ExprVec(descs, ast::MutImmutable),
span: dummy_sp(),
span: DUMMY_SP,
};

@ast::Expr {
id: ast::DUMMY_NODE_ID,
node: ast::ExprVstore(inner_expr, ast::ExprVstoreSlice),
span: dummy_sp(),
span: DUMMY_SP,
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/metadata/creader.rs
Expand Up @@ -21,7 +21,7 @@ use syntax::ast;
use syntax::abi;
use syntax::attr;
use syntax::attr::AttrMetaMethods;
use syntax::codemap::{Span, dummy_sp};
use syntax::codemap::{Span, DUMMY_SP};
use syntax::diagnostic::SpanHandler;
use syntax::parse::token;
use syntax::parse::token::ident_interner;
Expand Down Expand Up @@ -346,7 +346,7 @@ fn resolve_crate_deps(e: &mut Env, cdata: &[u8]) -> cstore::cnum_map {
// This is a new one so we've got to load it
// FIXME (#2404): Need better error reporting than just a bogus
// span.
let fake_span = dummy_sp();
let fake_span = DUMMY_SP;
let local_cnum = resolve_crate(e, cname_str, cname_str, dep.vers,
dep.hash, fake_span);
cnum_map.insert(extrn_cnum, local_cnum);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/metadata/decoder.rs
Expand Up @@ -1099,7 +1099,7 @@ fn get_attributes(md: ebml::Doc) -> ~[ast::Attribute] {
value: meta_item,
is_sugared_doc: false,
},
span: codemap::dummy_sp()
span: codemap::DUMMY_SP
});
true
});
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/astencode.rs
Expand Up @@ -218,7 +218,7 @@ impl ExtendedDecodeContext {
ast::DefId { crate: ast::LOCAL_CRATE, node: self.tr_id(did.node) }
}
pub fn tr_span(&self, _span: Span) -> Span {
codemap::dummy_sp() // FIXME (#1972): handle span properly
codemap::DUMMY_SP // FIXME (#1972): handle span properly
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/check_match.rs
Expand Up @@ -23,7 +23,7 @@ use std::num;
use std::vec;
use syntax::ast::*;
use syntax::ast_util::{unguarded_pat, walk_pat};
use syntax::codemap::{Span, dummy_sp, Spanned};
use syntax::codemap::{Span, DUMMY_SP, Spanned};
use syntax::visit;
use syntax::visit::{Visitor,fn_kind};

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

fn wild() -> @Pat {
@Pat {id: 0, node: PatWild, span: dummy_sp()}
@Pat {id: 0, node: PatWild, span: DUMMY_SP}
}

fn wild_multi() -> @Pat {
@Pat {id: 0, node: PatWildMulti, span: dummy_sp()}
@Pat {id: 0, node: PatWildMulti, span: DUMMY_SP}
}

fn specialize(cx: &MatchCheckCtxt,
Expand Down
32 changes: 16 additions & 16 deletions src/librustc/middle/resolve.rs
Expand Up @@ -24,7 +24,7 @@ use syntax::parse::token;
use syntax::parse::token::{ident_interner, interner_get};
use syntax::parse::token::special_idents;
use syntax::print::pprust::path_to_str;
use syntax::codemap::{Span, dummy_sp, Pos};
use syntax::codemap::{Span, DUMMY_SP, Pos};
use syntax::opt_vec::OptVec;
use syntax::visit;
use syntax::visit::Visitor;
Expand Down Expand Up @@ -1643,7 +1643,7 @@ impl Resolver {
NormalModuleKind,
true,
is_public,
dummy_sp());
DUMMY_SP);
}
}
}
Expand All @@ -1661,16 +1661,16 @@ impl Resolver {
// public.
let is_public = vis != ast::private;
if is_struct {
child_name_bindings.define_type(def, dummy_sp(), is_public);
child_name_bindings.define_type(def, DUMMY_SP, is_public);
self.structs.insert(variant_id);
} else {
child_name_bindings.define_value(def, dummy_sp(), is_public);
child_name_bindings.define_value(def, DUMMY_SP, is_public);
}
}
DefFn(..) | DefStaticMethod(..) | DefStatic(..) => {
debug!("(building reduced graph for external \
crate) building value (fn/static) {}", final_ident);
child_name_bindings.define_value(def, dummy_sp(), is_public);
child_name_bindings.define_value(def, DUMMY_SP, is_public);
}
DefTrait(def_id) => {
debug!("(building reduced graph for external \
Expand Down Expand Up @@ -1711,7 +1711,7 @@ impl Resolver {
}
}

child_name_bindings.define_type(def, dummy_sp(), is_public);
child_name_bindings.define_type(def, DUMMY_SP, is_public);

// Define a module if necessary.
let parent_link = self.get_parent_link(new_parent, ident);
Expand All @@ -1720,21 +1720,21 @@ impl Resolver {
TraitModuleKind,
true,
is_public,
dummy_sp())
DUMMY_SP)
}
DefTy(_) => {
debug!("(building reduced graph for external \
crate) building type {}", final_ident);

child_name_bindings.define_type(def, dummy_sp(), is_public);
child_name_bindings.define_type(def, DUMMY_SP, is_public);
}
DefStruct(def_id) => {
debug!("(building reduced graph for external \
crate) building type and value for {}",
final_ident);
child_name_bindings.define_type(def, dummy_sp(), is_public);
child_name_bindings.define_type(def, DUMMY_SP, is_public);
if csearch::get_struct_fields(self.session.cstore, def_id).len() == 0 {
child_name_bindings.define_value(def, dummy_sp(), is_public);
child_name_bindings.define_value(def, DUMMY_SP, is_public);
}
self.structs.insert(def_id);
}
Expand Down Expand Up @@ -1782,7 +1782,7 @@ impl Resolver {
self.add_child(ident,
ModuleReducedGraphParent(root),
OverwriteDuplicates,
dummy_sp());
DUMMY_SP);

self.handle_external_def(def,
visibility,
Expand Down Expand Up @@ -1814,7 +1814,7 @@ impl Resolver {
final_ident,
ModuleReducedGraphParent(root),
OverwriteDuplicates,
dummy_sp());
DUMMY_SP);

// Process the static methods. First,
// create the module.
Expand Down Expand Up @@ -1842,7 +1842,7 @@ impl Resolver {
ImplModuleKind,
true,
true,
dummy_sp());
DUMMY_SP);
type_module =
child_name_bindings.
get_module();
Expand All @@ -1864,13 +1864,13 @@ impl Resolver {
self.add_child(ident,
new_parent,
OverwriteDuplicates,
dummy_sp());
DUMMY_SP);
let def = DefFn(
static_method_info.def_id,
static_method_info.purity);

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

match vi.node {
view_item_extern_mod(..) => {} // ignore
Expand Down

5 comments on commit 9cdad68

@bors
Copy link
Contributor

@bors bors commented on 9cdad68 Jan 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from pcwalton
at klutzy@9cdad68

@bors
Copy link
Contributor

@bors bors commented on 9cdad68 Jan 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging klutzy/rust/small-cleanup = 9cdad68 into auto

@bors
Copy link
Contributor

@bors bors commented on 9cdad68 Jan 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

klutzy/rust/small-cleanup = 9cdad68 merged ok, testing candidate = c34ef5d

@bors
Copy link
Contributor

@bors bors commented on 9cdad68 Jan 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 9cdad68 Jan 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = c34ef5d

Please sign in to comment.