Skip to content

Some libsyntax/librustc cleanups #11255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 1, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ pub fn host_triple() -> ~str {
(env!("CFG_COMPILER")).to_owned()
}

pub fn build_session_options(binary: @str,
pub fn build_session_options(binary: ~str,
matches: &getopts::Matches,
demitter: @diagnostic::Emitter)
-> @session::options {
Expand Down Expand Up @@ -883,7 +883,7 @@ pub fn build_session(sopts: @session::options, demitter: @diagnostic::Emitter)
pub fn build_session_(sopts: @session::options,
cm: @codemap::CodeMap,
demitter: @diagnostic::Emitter,
span_diagnostic_handler: @mut diagnostic::span_handler)
span_diagnostic_handler: @mut diagnostic::SpanHandler)
-> Session {
let target_cfg = build_target_config(sopts, demitter);
let p_s = parse::new_parse_sess_special_handler(span_diagnostic_handler,
Expand Down Expand Up @@ -1105,7 +1105,7 @@ pub fn build_output_filenames(input: &input,
}
}

pub fn early_error(emitter: @diagnostic::Emitter, msg: &str) -> ! {
pub fn early_error(emitter: &diagnostic::Emitter, msg: &str) -> ! {
emitter.emit(None, msg, diagnostic::fatal);
fail!();
}
Expand Down Expand Up @@ -1135,7 +1135,7 @@ mod test {
Err(f) => fail!("test_switch_implies_cfg_test: {}", f.to_err_msg())
};
let sessopts = build_session_options(
@"rustc",
~"rustc",
matches,
@diagnostic::DefaultEmitter as @diagnostic::Emitter);
let sess = build_session(sessopts,
Expand All @@ -1158,7 +1158,7 @@ mod test {
}
};
let sessopts = build_session_options(
@"rustc",
~"rustc",
matches,
@diagnostic::DefaultEmitter as @diagnostic::Emitter);
let sess = build_session(sessopts,
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/driver/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ pub struct options {
// will be added to the crate AST node. This should not be used for
// anything except building the full crate config prior to parsing.
cfg: ast::CrateConfig,
binary: @str,
binary: ~str,
test: bool,
parse_only: bool,
no_trans: bool,
Expand Down Expand Up @@ -209,7 +209,7 @@ pub struct Session_ {
// For a library crate, this is always none
entry_fn: RefCell<Option<(NodeId, codemap::Span)>>,
entry_type: Cell<Option<EntryFnType>>,
span_diagnostic: @mut diagnostic::span_handler,
span_diagnostic: @mut diagnostic::SpanHandler,
filesearch: @filesearch::FileSearch,
building_library: Cell<bool>,
working_dir: Path,
Expand Down Expand Up @@ -292,7 +292,7 @@ impl Session_ {

v
}
pub fn diagnostic(&self) -> @mut diagnostic::span_handler {
pub fn diagnostic(&self) -> @mut diagnostic::SpanHandler {
self.span_diagnostic
}
pub fn debugging_opt(&self, opt: uint) -> bool {
Expand Down Expand Up @@ -395,7 +395,7 @@ pub fn basic_options() -> @options {
target_cpu: ~"generic",
target_feature: ~"",
cfg: ~[],
binary: @"rustc",
binary: ~"rustc",
test: false,
parse_only: false,
no_trans: false,
Expand Down
14 changes: 7 additions & 7 deletions src/librustc/front/std_inject.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ pub fn describe_debug_flags() {

pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
let mut args = args.to_owned();
let binary = args.shift().to_managed();
let binary = args.shift();

if args.is_empty() { usage(binary); return; }

Expand Down Expand Up @@ -348,7 +348,7 @@ struct RustcEmitter {

impl diagnostic::Emitter for RustcEmitter {
fn emit(&self,
cmsp: Option<(@codemap::CodeMap, codemap::Span)>,
cmsp: Option<(&codemap::CodeMap, codemap::Span)>,
msg: &str,
lvl: diagnostic::level) {
if lvl == diagnostic::fatal {
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/metadata/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use syntax::ast;
use syntax::abi;
use syntax::attr;
use syntax::attr::AttrMetaMethods;
use syntax::codemap::{Span, dummy_sp};
use syntax::diagnostic::span_handler;
use syntax::codemap::{Span, DUMMY_SP};
use syntax::diagnostic::SpanHandler;
use syntax::parse::token;
use syntax::parse::token::ident_interner;
use syntax::crateid::CrateId;
Expand Down Expand Up @@ -86,7 +86,7 @@ fn dump_crates(crate_cache: &[cache_entry]) {
}

fn warn_if_multiple_versions(e: &mut Env,
diag: @mut span_handler,
diag: @mut SpanHandler,
crate_cache: &[cache_entry]) {
if crate_cache.len() != 0u {
let name = crate_cache[crate_cache.len() - 1].crateid.name.clone();
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
Original file line number Diff line number Diff line change
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
6 changes: 3 additions & 3 deletions src/librustc/metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use syntax::ast_map;
use syntax::ast_util::*;
use syntax::attr;
use syntax::attr::AttrMetaMethods;
use syntax::diagnostic::span_handler;
use syntax::diagnostic::SpanHandler;
use syntax::parse::token::special_idents;
use syntax::ast_util;
use syntax::visit::Visitor;
Expand All @@ -57,7 +57,7 @@ pub type encode_inlined_item<'a> = 'a |ecx: &EncodeContext,
ii: ast::inlined_item|;

pub struct EncodeParams<'a> {
diag: @mut span_handler,
diag: @mut SpanHandler,
tcx: ty::ctxt,
reexports2: middle::resolve::ExportMap2,
item_symbols: &'a RefCell<HashMap<ast::NodeId, ~str>>,
Expand All @@ -83,7 +83,7 @@ struct Stats {
}

pub struct EncodeContext<'a> {
diag: @mut span_handler,
diag: @mut SpanHandler,
tcx: ty::ctxt,
stats: @Stats,
reexports2: middle::resolve::ExportMap2,
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/metadata/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use metadata::encoder;
use metadata::filesearch::{FileMatches, FileDoesntMatch};
use metadata::filesearch;
use syntax::codemap::Span;
use syntax::diagnostic::span_handler;
use syntax::diagnostic::SpanHandler;
use syntax::parse::token::ident_interner;
use syntax::crateid::CrateId;
use syntax::attr;
Expand Down Expand Up @@ -231,8 +231,8 @@ impl Context {
}
}

pub fn note_crateid_attr(diag: @mut span_handler,
crateid: &CrateId) {
pub fn note_crateid_attr(diag: @mut SpanHandler,
crateid: &CrateId) {
diag.handler().note(format!("crate_id: {}", crateid.to_str()));
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/metadata/tyencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ use middle::ty;
use syntax::abi::AbiSet;
use syntax::ast;
use syntax::ast::*;
use syntax::diagnostic::span_handler;
use syntax::diagnostic::SpanHandler;
use syntax::print::pprust::*;

macro_rules! mywrite( ($wr:expr, $($arg:tt)*) => (
format_args!(|a| { mywrite($wr, a) }, $($arg)*)
) )

pub struct ctxt {
diag: @mut span_handler,
diag: @mut SpanHandler,
// Def -> str Callback:
ds: extern "Rust" fn(DefId) -> ~str,
// The type context.
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/astencode.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading