Skip to content
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

Clean up a bunch of build warnings. #6937

Closed
wants to merge 1 commit into from
Closed
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
1 change: 0 additions & 1 deletion src/libextra/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/metadata/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/metadata/csearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
}

Expand Down Expand Up @@ -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,
Expand Down
23 changes: 11 additions & 12 deletions src/librustc/metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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(
Expand All @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand All @@ -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));
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion src/librustc/middle/kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
39 changes: 18 additions & 21 deletions src/librustc/middle/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -725,35 +725,34 @@ 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);
self.primitive_types.insert(ident, primitive_type);
}
}

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;
}
Expand Down Expand Up @@ -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 ],

Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/trans/debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/util/ppaux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/librustpkg/rustpkg.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 0 additions & 2 deletions src/librustpkg/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/ext/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions src/libsyntax/ext/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ 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"),
str_to_ident("rt"),
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,
Expand Down Expand Up @@ -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);
}
Expand All @@ -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),
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/libsyntax/ext/quote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand All @@ -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()), ", ")
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/ext/source_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/libsyntax/ext/tt/transcribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/parse/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Loading