Clean up a handful of build warnings.

This commit is contained in:
Michael Sullivan 2013-06-04 15:14:56 -07:00
parent 8450dc8f5e
commit 8bbf83b62a
20 changed files with 56 additions and 65 deletions

View File

@ -19,7 +19,6 @@ use core::prelude::*;
use core::borrow;
use core::comm;
use core::ptr;
use core::task;
use core::unstable::sync::{Exclusive, exclusive};
use core::util;

View File

@ -303,7 +303,7 @@ fn resolve_crate_deps(e: @mut Env, cdata: @~[u8]) -> cstore::cnum_map {
// The map from crate numbers in the crate we're resolving to local crate
// numbers
let mut cnum_map = HashMap::new();
for decoder::get_crate_deps(e.intr, cdata).each |dep| {
for decoder::get_crate_deps(cdata).each |dep| {
let extrn_cnum = dep.cnum;
let cname = dep.name;
let cname_str = token::ident_to_str(&dep.name);

View File

@ -69,7 +69,7 @@ pub fn each_path(cstore: @mut cstore::CStore,
pub fn get_item_path(tcx: ty::ctxt, def: ast::def_id) -> ast_map::path {
let cstore = tcx.cstore;
let cdata = cstore::get_crate_data(cstore, def.crate);
let path = decoder::get_item_path(cstore.intr, cdata, def.node);
let path = decoder::get_item_path(cdata, def.node);
// FIXME #1920: This path is not always correct if the crate is not linked
// into the root namespace.
@ -91,7 +91,7 @@ pub fn maybe_get_item_ast(tcx: ty::ctxt, def: ast::def_id,
-> found_ast {
let cstore = tcx.cstore;
let cdata = cstore::get_crate_data(cstore, def.crate);
decoder::maybe_get_item_ast(cstore.intr, cdata, tcx, def.node,
decoder::maybe_get_item_ast(cdata, tcx, def.node,
decode_inlined_item)
}
@ -149,7 +149,7 @@ pub fn get_supertraits(tcx: ty::ctxt, def: ast::def_id) -> ~[@ty::TraitRef] {
pub fn get_type_name_if_impl(cstore: @mut cstore::CStore, def: ast::def_id)
-> Option<ast::ident> {
let cdata = cstore::get_crate_data(cstore, def.crate);
decoder::get_type_name_if_impl(cstore.intr, cdata, def.node)
decoder::get_type_name_if_impl(cdata, def.node)
}
pub fn get_static_methods_if_impl(cstore: @mut cstore::CStore,

View File

@ -288,7 +288,7 @@ fn enum_variant_ids(item: ebml::Doc, cdata: cmd) -> ~[ast::def_id] {
return ids;
}
fn item_path(intr: @ident_interner, item_doc: ebml::Doc) -> ast_map::path {
fn item_path(item_doc: ebml::Doc) -> ast_map::path {
let path_doc = reader::get_doc(item_doc, tag_path);
let len_doc = reader::get_doc(path_doc, tag_path_len);
@ -491,7 +491,7 @@ pub fn _each_path(intr: @ident_interner,
for reader::tagged_docs(items_data, tag_items_data_item) |item_doc| {
if !broken {
let path = ast_map::path_to_str_with_sep(
item_path(intr, item_doc), ~"::", intr);
item_path(item_doc), "::", intr);
let path_is_empty = path.is_empty();
if !path_is_empty {
// Extract the def ID.
@ -575,9 +575,9 @@ pub fn each_path(intr: @ident_interner,
_each_path(intr, cdata, get_crate_data, f)
}
pub fn get_item_path(intr: @ident_interner, cdata: cmd, id: ast::node_id)
pub fn get_item_path(cdata: cmd, id: ast::node_id)
-> ast_map::path {
item_path(intr, lookup_item(id, cdata.data))
item_path(lookup_item(id, cdata.data))
}
pub type decode_inlined_item<'self> = &'self fn(
@ -586,14 +586,14 @@ pub type decode_inlined_item<'self> = &'self fn(
path: ast_map::path,
par_doc: ebml::Doc) -> Option<ast::inlined_item>;
pub fn maybe_get_item_ast(intr: @ident_interner, cdata: cmd, tcx: ty::ctxt,
pub fn maybe_get_item_ast(cdata: cmd, tcx: ty::ctxt,
id: ast::node_id,
decode_inlined_item: decode_inlined_item)
-> csearch::found_ast {
debug!("Looking up item: %d", id);
let item_doc = lookup_item(id, cdata.data);
let path = {
let item_path = item_path(intr, item_doc);
let item_path = item_path(item_doc);
vec::to_owned(item_path.init())
};
match decode_inlined_item(cdata, tcx, copy path, item_doc) {
@ -835,8 +835,7 @@ pub fn get_supertraits(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
return results;
}
pub fn get_type_name_if_impl(intr: @ident_interner,
cdata: cmd,
pub fn get_type_name_if_impl(cdata: cmd,
node_id: ast::node_id) -> Option<ast::ident> {
let item = lookup_item(node_id, cdata.data);
if item_family(item) != Impl {
@ -1086,7 +1085,7 @@ pub struct crate_dep {
hash: @~str
}
pub fn get_crate_deps(intr: @ident_interner, data: @~[u8]) -> ~[crate_dep] {
pub fn get_crate_deps(data: @~[u8]) -> ~[crate_dep] {
let mut deps: ~[crate_dep] = ~[];
let cratedoc = reader::Doc(data);
let depsdoc = reader::get_doc(cratedoc, tag_crate_deps);
@ -1104,10 +1103,10 @@ pub fn get_crate_deps(intr: @ident_interner, data: @~[u8]) -> ~[crate_dep] {
return deps;
}
fn list_crate_deps(intr: @ident_interner, data: @~[u8], out: @io::Writer) {
fn list_crate_deps(data: @~[u8], out: @io::Writer) {
out.write_str("=External Dependencies=\n");
for get_crate_deps(intr, data).each |dep| {
for get_crate_deps(data).each |dep| {
out.write_str(
fmt!("%d %s-%s-%s\n",
dep.cnum, *token::ident_to_str(&dep.name), *dep.hash, *dep.vers));
@ -1151,7 +1150,7 @@ pub fn list_crate_metadata(intr: @ident_interner, bytes: @~[u8],
let hash = get_crate_hash(bytes);
let md = reader::Doc(bytes);
list_crate_attributes(intr, md, *hash, out);
list_crate_deps(intr, bytes, out);
list_crate_deps(bytes, out);
}
// Translates a def_id from an external crate to a def_id for the current

View File

@ -132,8 +132,7 @@ struct entry<T> {
pos: uint
}
fn add_to_index(ecx: @EncodeContext,
ebml_w: &mut writer::Encoder,
fn add_to_index(ebml_w: &mut writer::Encoder,
path: &[ident],
index: &mut ~[entry<~str>],
name: ident) {

View File

@ -12,7 +12,6 @@ use core::prelude::*;
use middle::freevars::freevar_entry;
use middle::freevars;
use middle::pat_util;
use middle::ty;
use middle::typeck;
use util::ppaux::{Repr, ty_to_str};

View File

@ -725,7 +725,6 @@ pub struct PrimitiveTypeTable {
impl PrimitiveTypeTable {
pub fn intern(&mut self,
intr: @ident_interner,
string: &str,
primitive_type: prim_ty) {
let ident = token::str_to_ident(string);
@ -733,27 +732,27 @@ impl PrimitiveTypeTable {
}
}
pub fn PrimitiveTypeTable(intr: @ident_interner) -> PrimitiveTypeTable {
pub fn PrimitiveTypeTable() -> PrimitiveTypeTable {
let mut table = PrimitiveTypeTable {
primitive_types: HashMap::new()
};
table.intern(intr, "bool", ty_bool);
table.intern(intr, "char", ty_int(ty_char));
table.intern(intr, "float", ty_float(ty_f));
table.intern(intr, "f32", ty_float(ty_f32));
table.intern(intr, "f64", ty_float(ty_f64));
table.intern(intr, "int", ty_int(ty_i));
table.intern(intr, "i8", ty_int(ty_i8));
table.intern(intr, "i16", ty_int(ty_i16));
table.intern(intr, "i32", ty_int(ty_i32));
table.intern(intr, "i64", ty_int(ty_i64));
table.intern(intr, "str", ty_str);
table.intern(intr, "uint", ty_uint(ty_u));
table.intern(intr, "u8", ty_uint(ty_u8));
table.intern(intr, "u16", ty_uint(ty_u16));
table.intern(intr, "u32", ty_uint(ty_u32));
table.intern(intr, "u64", ty_uint(ty_u64));
table.intern("bool", ty_bool);
table.intern("char", ty_int(ty_char));
table.intern("float", ty_float(ty_f));
table.intern("f32", ty_float(ty_f32));
table.intern("f64", ty_float(ty_f64));
table.intern("int", ty_int(ty_i));
table.intern("i8", ty_int(ty_i8));
table.intern("i16", ty_int(ty_i16));
table.intern("i32", ty_int(ty_i32));
table.intern("i64", ty_int(ty_i64));
table.intern("str", ty_str);
table.intern("uint", ty_uint(ty_u));
table.intern("u8", ty_uint(ty_u8));
table.intern("u16", ty_uint(ty_u16));
table.intern("u32", ty_uint(ty_u32));
table.intern("u64", ty_uint(ty_u64));
return table;
}
@ -806,7 +805,7 @@ pub fn Resolver(session: Session,
self_ident: special_idents::self_,
type_self_ident: special_idents::type_self,
primitive_type_table: @PrimitiveTypeTable(token::get_ident_interner()),
primitive_type_table: @PrimitiveTypeTable(),
namespaces: ~[ TypeNS, ValueNS ],
@ -2942,8 +2941,6 @@ impl Resolver {
module_: @mut Module,
module_path: &[ident])
-> ResolveResult<ModulePrefixResult> {
let interner = token::get_ident_interner();
// Start at the current module if we see `self` or `super`, or at the
// top of the crate otherwise.
let mut containing_module;

View File

@ -3070,7 +3070,7 @@ pub fn trans_crate(sess: session::Session,
lib::llvm::associate_type(tn, @"tydesc", tydesc_type);
let crate_map = decl_crate_map(sess, link_meta, llmod);
let dbg_cx = if sess.opts.debuginfo {
Some(debuginfo::mk_ctxt(copy llmod_id, token::get_ident_interner()))
Some(debuginfo::mk_ctxt(copy llmod_id))
} else {
None
};
@ -3105,7 +3105,7 @@ pub fn trans_crate(sess: session::Session,
lltypes: @mut HashMap::new(),
llsizingtypes: @mut HashMap::new(),
adt_reprs: @mut HashMap::new(),
names: new_namegen(token::get_ident_interner()),
names: new_namegen(),
next_addrspace: new_addrspace_gen(),
symbol_hasher: symbol_hasher,
type_hashcodes: @mut HashMap::new(),

View File

@ -60,7 +60,7 @@ use syntax::abi::{X86, X86_64, Arm, Mips};
// NOTE: this thunk is totally pointless now that we're not passing
// interners around...
pub type namegen = @fn(s: &str) -> ident;
pub fn new_namegen(intr: @ident_interner) -> namegen {
pub fn new_namegen() -> namegen {
let f: @fn(s: &str) -> ident = |prefix| {
token::str_to_ident(fmt!("%s_%u",
prefix,

View File

@ -108,10 +108,10 @@ pub struct DebugContext {
crate_file: ~str
}
pub fn mk_ctxt(crate: ~str, intr: @ident_interner) -> DebugContext {
pub fn mk_ctxt(crate: ~str) -> DebugContext {
DebugContext {
llmetadata: @mut HashMap::new(),
names: new_namegen(intr),
names: new_namegen(),
crate_file: crate
}
}

View File

@ -654,7 +654,7 @@ impl Repr for ty::Method {
}
impl Repr for ast::ident {
fn repr(&self, tcx: ctxt) -> ~str {
fn repr(&self, _tcx: ctxt) -> ~str {
copy *token::ident_to_str(self)
}
}

View File

@ -649,9 +649,9 @@ impl PkgSrc {
if self.libs.is_empty() && self.mains.is_empty()
&& self.tests.is_empty() && self.benchs.is_empty() {
util::note(~"Couldn't infer any crates to build.\n\
Try naming a crate `main.rs`, `lib.rs`, \
`test.rs`, or `bench.rs`.");
util::note("Couldn't infer any crates to build.\n\
Try naming a crate `main.rs`, `lib.rs`, \
`test.rs`, or `bench.rs`.");
cond.raise(copy self.id);
}

View File

@ -14,8 +14,6 @@ use rustc::driver::{driver, session};
use rustc::metadata::filesearch;
use extra::getopts::groups::getopts;
use extra::term;
#[cfg(not(test))]
use extra::getopts;
use syntax::ast_util::*;
use syntax::codemap::{dummy_sp, spanned};
use syntax::codemap::dummy_spanned;

View File

@ -394,7 +394,7 @@ pub fn new_name_finder() -> @Visitor<@mut ~[ast::ident]> {
}
pub fn expand_block(extsbox: @mut SyntaxEnv,
cx: @ExtCtxt,
_cx: @ExtCtxt,
blk: &blk_,
sp: span,
fld: @ast_fold,

View File

@ -53,7 +53,7 @@ pub fn expand_syntax_ext(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
fn pieces_to_expr(cx: @ExtCtxt, sp: span,
pieces: ~[Piece], args: ~[@ast::expr])
-> @ast::expr {
fn make_path_vec(cx: @ExtCtxt, ident: &str) -> ~[ast::ident] {
fn make_path_vec(ident: &str) -> ~[ast::ident] {
return ~[str_to_ident("std"),
str_to_ident("unstable"),
str_to_ident("extfmt"),
@ -61,7 +61,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span,
str_to_ident(ident)];
}
fn make_rt_path_expr(cx: @ExtCtxt, sp: span, nm: &str) -> @ast::expr {
let path = make_path_vec(cx, nm);
let path = make_path_vec(nm);
cx.expr_path(cx.path_global(sp, path))
}
// Produces an AST expression that represents a RT::conv record,
@ -90,7 +90,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span,
}
CountIs(c) => {
let count_lit = cx.expr_uint(sp, c as uint);
let count_is_path = make_path_vec(cx, "CountIs");
let count_is_path = make_path_vec("CountIs");
let count_is_args = ~[count_lit];
return cx.expr_call_global(sp, count_is_path, count_is_args);
}
@ -114,7 +114,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span,
ty_expr: @ast::expr) -> @ast::expr {
cx.expr_struct(
sp,
cx.path_global(sp, make_path_vec(cx, "Conv")),
cx.path_global(sp, make_path_vec("Conv")),
~[
cx.field_imm(sp, str_to_ident("flags"), flags_expr),
cx.field_imm(sp, str_to_ident("width"), width_expr),
@ -133,7 +133,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span,
fn make_conv_call(cx: @ExtCtxt, sp: span, conv_type: &str, cnv: &Conv,
arg: @ast::expr, buf: @ast::expr) -> @ast::expr {
let fname = ~"conv_" + conv_type;
let path = make_path_vec(cx, fname);
let path = make_path_vec(fname);
let cnv_expr = make_rt_conv_expr(cx, sp, cnv);
let args = ~[cnv_expr, arg, buf];
cx.expr_call_global(arg.span, path, args)

View File

@ -92,7 +92,7 @@ pub mod rt {
impl<'self> ToSource for &'self [@ast::item] {
fn to_source(&self) -> ~str {
str::connect(self.map(|i| i.to_source()), ~"\n\n")
str::connect(self.map(|i| i.to_source()), "\n\n")
}
}
@ -104,7 +104,7 @@ pub mod rt {
impl<'self> ToSource for &'self [@ast::Ty] {
fn to_source(&self) -> ~str {
str::connect(self.map(|i| i.to_source()), ~", ")
str::connect(self.map(|i| i.to_source()), ", ")
}
}

View File

@ -12,7 +12,7 @@ use core::prelude::*;
use ast;
use codemap;
use codemap::{FileMap, Loc, Pos, ExpandedFrom, span};
use codemap::{Pos, ExpandedFrom, span};
use codemap::{CallInfo, NameAndSpan};
use ext::base::*;
use ext::base;

View File

@ -132,7 +132,7 @@ enum lis {
}
fn lockstep_iter_size(t: &token_tree, r: &mut TtReader) -> lis {
fn lis_merge(lhs: lis, rhs: lis, r: &mut TtReader) -> lis {
fn lis_merge(lhs: lis, rhs: lis) -> lis {
match lhs {
lis_unconstrained => copy rhs,
lis_contradiction(_) => copy lhs,
@ -154,7 +154,7 @@ fn lockstep_iter_size(t: &token_tree, r: &mut TtReader) -> lis {
tt_delim(ref tts) | tt_seq(_, ref tts, _, _) => {
vec::foldl(lis_unconstrained, *tts, |lis, tt| {
let lis2 = lockstep_iter_size(tt, r);
lis_merge(lis, lis2, r)
lis_merge(lis, lis2)
})
}
tt_tok(*) => lis_unconstrained,

View File

@ -49,7 +49,7 @@ pub fn seq_sep_none() -> SeqSep {
// maps any token back to a string. not necessary if you know it's
// an identifier....
pub fn token_to_str(reader: @reader, token: &token::Token) -> ~str {
pub fn token_to_str(token: &token::Token) -> ~str {
token::to_str(get_ident_interner(), token)
}

View File

@ -2573,7 +2573,7 @@ impl Parser {
fn parse_let(&self) -> @decl {
let is_mutbl = self.eat_keyword(keywords::Mut);
let lo = self.span.lo;
let mut local = self.parse_local(is_mutbl);
let local = self.parse_local(is_mutbl);
while self.eat(&token::COMMA) {
let _ = self.parse_local(is_mutbl);
self.obsolete(*self.span, ObsoleteMultipleLocalDecl);