Skip to content

Commit 88ccee7

Browse files
committed
auto merge of #6022 : catamorphism/rust/warning-police, r=catamorphism
2 parents 8cadcc4 + 7169907 commit 88ccee7

29 files changed

+312
-330
lines changed

src/libcore/rt/io/stdio.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ pub fn stdout() -> StdWriter { fail!() }
1717

1818
pub fn stderr() -> StdReader { fail!() }
1919

20-
pub fn print(s: &str) { fail!() }
20+
pub fn print(_s: &str) { fail!() }
2121

22-
pub fn println(s: &str) { fail!() }
22+
pub fn println(_s: &str) { fail!() }
2323

2424
pub enum StdStream {
2525
StdIn,

src/libcore/rt/uvio.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use option::*;
1212
use result::*;
1313

14-
use super::io::net::ip::{IpAddr, Ipv4};
14+
use super::io::net::ip::{IpAddr, Ipv4}; // n.b. Ipv4 is used only in tests
1515
use super::uv::*;
1616
use super::rtio::*;
1717
use ops::Drop;

src/libcore/task/spawn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ pub fn spawn_raw(opts: TaskOpts, f: ~fn()) {
549549
}
550550
}
551551
552-
fn spawn_raw_newsched(opts: TaskOpts, f: ~fn()) {
552+
fn spawn_raw_newsched(_opts: TaskOpts, f: ~fn()) {
553553
use rt::sched::*;
554554
555555
let mut sched = local_sched::take();

src/librustc/metadata/decoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ fn doc_transformed_self_ty(doc: ebml::Doc,
247247
}
248248
}
249249
250-
pub fn item_type(item_id: ast::def_id, item: ebml::Doc,
250+
pub fn item_type(_item_id: ast::def_id, item: ebml::Doc,
251251
tcx: ty::ctxt, cdata: cmd) -> ty::t {
252252
doc_type(item, tcx, cdata)
253253
}

src/librustc/metadata/tydecode.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -279,28 +279,28 @@ fn parse_trait_ref(st: @mut PState, conv: conv_did) -> ty::TraitRef {
279279
280280
fn parse_ty(st: @mut PState, conv: conv_did) -> ty::t {
281281
match next(st) {
282-
'n' => return ty::mk_nil(st.tcx),
283-
'z' => return ty::mk_bot(st.tcx),
284-
'b' => return ty::mk_bool(st.tcx),
285-
'i' => return ty::mk_int(st.tcx),
286-
'u' => return ty::mk_uint(st.tcx),
287-
'l' => return ty::mk_float(st.tcx),
282+
'n' => return ty::mk_nil(),
283+
'z' => return ty::mk_bot(),
284+
'b' => return ty::mk_bool(),
285+
'i' => return ty::mk_int(),
286+
'u' => return ty::mk_uint(),
287+
'l' => return ty::mk_float(),
288288
'M' => {
289289
match next(st) {
290-
'b' => return ty::mk_mach_uint(st.tcx, ast::ty_u8),
291-
'w' => return ty::mk_mach_uint(st.tcx, ast::ty_u16),
292-
'l' => return ty::mk_mach_uint(st.tcx, ast::ty_u32),
293-
'd' => return ty::mk_mach_uint(st.tcx, ast::ty_u64),
294-
'B' => return ty::mk_mach_int(st.tcx, ast::ty_i8),
295-
'W' => return ty::mk_mach_int(st.tcx, ast::ty_i16),
296-
'L' => return ty::mk_mach_int(st.tcx, ast::ty_i32),
297-
'D' => return ty::mk_mach_int(st.tcx, ast::ty_i64),
298-
'f' => return ty::mk_mach_float(st.tcx, ast::ty_f32),
299-
'F' => return ty::mk_mach_float(st.tcx, ast::ty_f64),
290+
'b' => return ty::mk_mach_uint(ast::ty_u8),
291+
'w' => return ty::mk_mach_uint(ast::ty_u16),
292+
'l' => return ty::mk_mach_uint(ast::ty_u32),
293+
'd' => return ty::mk_mach_uint(ast::ty_u64),
294+
'B' => return ty::mk_mach_int(ast::ty_i8),
295+
'W' => return ty::mk_mach_int(ast::ty_i16),
296+
'L' => return ty::mk_mach_int(ast::ty_i32),
297+
'D' => return ty::mk_mach_int(ast::ty_i64),
298+
'f' => return ty::mk_mach_float(ast::ty_f32),
299+
'F' => return ty::mk_mach_float(ast::ty_f64),
300300
_ => fail!(~"parse_ty: bad numeric type")
301301
}
302302
}
303-
'c' => return ty::mk_char(st.tcx),
303+
'c' => return ty::mk_char(),
304304
't' => {
305305
assert!((next(st) == '['));
306306
let def = parse_def(st, NominalType, conv);

src/librustc/middle/check_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ pub fn is_useful(cx: @MatchCheckCtxt, m: &matrix, v: &[@pat]) -> useful {
211211
let real_pat = match m.find(|r| r[0].id != 0) {
212212
Some(r) => r[0], None => v[0]
213213
};
214-
let left_ty = if real_pat.id == 0 { ty::mk_nil(cx.tcx) }
214+
let left_ty = if real_pat.id == 0 { ty::mk_nil() }
215215
else { ty::node_id_to_type(cx.tcx, real_pat.id) };
216216
217217
match pat_ctor_id(cx, v[0]) {

src/librustc/middle/mem_categorization.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ pub impl mem_categorization_ctxt {
749749
fn cat_index<N:ast_node>(&self,
750750
elt: N,
751751
base_cmt: cmt) -> cmt {
752-
let mt = match ty::index(self.tcx, base_cmt.ty) {
752+
let mt = match ty::index(base_cmt.ty) {
753753
Some(mt) => mt,
754754
None => {
755755
self.tcx.sess.span_bug(

src/librustc/middle/trans/_match.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1073,8 +1073,7 @@ pub fn compare_values(cx: block,
10731073
10741074
match ty::get(rhs_t).sty {
10751075
ty::ty_estr(ty::vstore_uniq) => {
1076-
let scratch_result = scratch_datum(cx, ty::mk_bool(cx.tcx()),
1077-
false);
1076+
let scratch_result = scratch_datum(cx, ty::mk_bool(), false);
10781077
let scratch_lhs = alloca(cx, val_ty(lhs));
10791078
Store(cx, lhs, scratch_lhs);
10801079
let scratch_rhs = alloca(cx, val_ty(rhs));
@@ -1092,8 +1091,7 @@ pub fn compare_values(cx: block,
10921091
}
10931092
}
10941093
ty::ty_estr(_) => {
1095-
let scratch_result = scratch_datum(cx, ty::mk_bool(cx.tcx()),
1096-
false);
1094+
let scratch_result = scratch_datum(cx, ty::mk_bool(), false);
10971095
let did = cx.tcx().lang_items.str_eq_fn();
10981096
let bcx = callee::trans_lang_call(cx, did,
10991097
~[lhs, rhs],

src/librustc/middle/trans/adt.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ use core::option::{Option, Some, None};
5050
use core::vec;
5151

5252
use lib::llvm::{ValueRef, TypeRef, True, IntEQ, IntNE};
53-
use lib::llvm::llvm::LLVMDumpValue;
5453
use middle::trans::_match;
5554
use middle::trans::build::*;
5655
use middle::trans::common::*;
@@ -136,7 +135,7 @@ fn represent_type_uncached(cx: @CrateContext, t: ty::t) -> Repr {
136135
let packed = ty::lookup_packed(cx.tcx, def_id);
137136
let dtor = ty::ty_dtor(cx.tcx, def_id).is_present();
138137
let ftys =
139-
if dtor { ftys + [ty::mk_bool(cx.tcx)] } else { ftys };
138+
if dtor { ftys + [ty::mk_bool()] } else { ftys };
140139
return Univariant(mk_struct(cx, ftys, packed), dtor)
141140
}
142141
ty::ty_enum(def_id, ref substs) => {
@@ -204,7 +203,7 @@ fn represent_type_uncached(cx: @CrateContext, t: ty::t) -> Repr {
204203
}
205204

206205
// The general case.
207-
let discr = ~[ty::mk_int(cx.tcx)];
206+
let discr = ~[ty::mk_int()];
208207
return General(cases.map(|c| mk_struct(cx, discr + c.tys, false)))
209208
}
210209
_ => cx.sess.bug(~"adt::represent_type called on non-ADT type")

src/librustc/middle/trans/base.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ pub fn iter_structural_ty(cx: block, av: ValueRef, t: ty::t,
707707
substs.tps, f);
708708
}
709709
(_match::switch, Some(lldiscrim_a)) => {
710-
cx = f(cx, lldiscrim_a, ty::mk_int(cx.tcx()));
710+
cx = f(cx, lldiscrim_a, ty::mk_int());
711711
let unr_cx = sub_block(cx, ~"enum-iter-unr");
712712
Unreachable(unr_cx);
713713
let llswitch = Switch(cx, lldiscrim_a, unr_cx.llbb,
@@ -2361,7 +2361,7 @@ pub fn create_entry_wrapper(ccx: @CrateContext,
23612361
}
23622362
23632363
fn create_main(ccx: @CrateContext, main_llfn: ValueRef) -> ValueRef {
2364-
let nt = ty::mk_nil(ccx.tcx);
2364+
let nt = ty::mk_nil();
23652365
let llfty = type_of_fn(ccx, ~[], nt);
23662366
let llfdecl = decl_fn(ccx.llmod, ~"_rust_main",
23672367
lib::llvm::CCallConv, llfty);
@@ -2407,9 +2407,8 @@ pub fn create_entry_wrapper(ccx: @CrateContext,
24072407
unsafe {
24082408
llvm::LLVMPositionBuilderAtEnd(bld, llbb);
24092409
2410-
let crate_map = ccx.crate_map;
24112410
let start_def_id = ccx.tcx.lang_items.start_fn();
2412-
let start_fn = if start_def_id.crate == ast::local_crate {
2411+
if start_def_id.crate == ast::local_crate {
24132412
ccx.sess.bug(~"start lang item is never in the local crate")
24142413
} else {
24152414
let start_fn_type = csearch::get_type(ccx.tcx,
@@ -2727,7 +2726,7 @@ pub fn trans_constant(ccx: @CrateContext, it: @ast::item) {
27272726
path_name(variant.node.name),
27282727
path_name(special_idents::descrim)
27292728
]);
2730-
let s = @mangle_exported_name(ccx, p, ty::mk_int(ccx.tcx));
2729+
let s = @mangle_exported_name(ccx, p, ty::mk_int());
27312730
let disr_val = vi[i].disr_val;
27322731
note_unique_llvm_symbol(ccx, s);
27332732
let discrim_gvar = str::as_c_str(*s, |buf| {

src/librustc/middle/trans/closure.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,7 @@ pub fn build_closure(bcx0: block,
261261
include_ret_handle: Option<ValueRef>) -> ClosureResult {
262262
let _icx = bcx0.insn_ctxt("closure::build_closure");
263263
// If we need to, package up the iterator body to call
264-
let bcx = bcx0;;
265-
let ccx = bcx.ccx(), tcx = ccx.tcx;
264+
let bcx = bcx0;
266265

267266
// Package up the captured upvars
268267
let mut env_vals = ~[];
@@ -290,7 +289,7 @@ pub fn build_closure(bcx0: block,
290289
// variables:
291290
for include_ret_handle.each |flagptr| {
292291
// Flag indicating we have returned (a by-ref bool):
293-
let flag_datum = Datum {val: *flagptr, ty: ty::mk_bool(tcx),
292+
let flag_datum = Datum {val: *flagptr, ty: ty::mk_bool(),
294293
mode: ByRef, source: ZeroMem};
295294
env_vals.push(EnvValue {action: EnvRef,
296295
datum: flag_datum});
@@ -302,7 +301,7 @@ pub fn build_closure(bcx0: block,
302301
None => bcx.fcx.llretptr.get()
303302
};
304303
let ret_casted = PointerCast(bcx, ret_true, T_ptr(T_nil()));
305-
let ret_datum = Datum {val: ret_casted, ty: ty::mk_nil(tcx),
304+
let ret_datum = Datum {val: ret_casted, ty: ty::mk_nil(),
306305
mode: ByRef, source: ZeroMem};
307306
env_vals.push(EnvValue {action: EnvRef,
308307
datum: ret_datum});
@@ -420,7 +419,7 @@ pub fn trans_expr_fn(bcx: block,
420419
}
421420

422421
let real_return_type = if is_loop_body.is_some() {
423-
ty::mk_bool(bcx.tcx())
422+
ty::mk_bool()
424423
} else {
425424
ty::ty_fn_ret(fty)
426425
};

src/librustc/middle/trans/common.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -999,9 +999,9 @@ pub fn T_opaque_vec(targ_cfg: @session::config) -> TypeRef {
999999
pub fn tuplify_box_ty(tcx: ty::ctxt, t: ty::t) -> ty::t {
10001000
let ptr = ty::mk_ptr(
10011001
tcx,
1002-
ty::mt {ty: ty::mk_nil(tcx), mutbl: ast::m_imm}
1002+
ty::mt {ty: ty::mk_nil(), mutbl: ast::m_imm}
10031003
);
1004-
return ty::mk_tup(tcx, ~[ty::mk_uint(tcx), ty::mk_type(tcx),
1004+
return ty::mk_tup(tcx, ~[ty::mk_uint(), ty::mk_type(tcx),
10051005
ptr, ptr,
10061006
t]);
10071007
}

src/librustc/middle/trans/debuginfo.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ fn create_boxed_type(cx: @CrateContext, contents: ty::t,
560560
let fname = filename_from_span(cx, span);
561561
let file_node = create_file(cx, fname);
562562
//let cu_node = create_compile_unit_metadata(cx, fname);
563-
let int_t = ty::mk_int(cx.tcx);
563+
let int_t = ty::mk_int();
564564
let refcount_type = create_basic_type(cx, int_t, span);
565565
let name = ty_to_str(cx.tcx, contents);
566566
let scx = create_structure(file_node, @fmt!("box<%s>", name), 0);
@@ -643,7 +643,7 @@ fn create_boxed_vec(cx: @CrateContext, vec_t: ty::t, elem_t: ty::t,
643643
let elem_ty_md = create_ty(cx, elem_t, vec_ty_span);
644644
let vec_scx = create_structure(file_node,
645645
@/*bad*/ copy ty_to_str(cx.tcx, vec_t), 0);
646-
let size_t_type = create_basic_type(cx, ty::mk_uint(cx.tcx), vec_ty_span);
646+
let size_t_type = create_basic_type(cx, ty::mk_uint(), vec_ty_span);
647647
add_member(vec_scx, ~"fill", 0, sys::size_of::<libc::size_t>() as int,
648648
sys::min_align_of::<libc::size_t>() as int, size_t_type.node);
649649
add_member(vec_scx, ~"alloc", 0, sys::size_of::<libc::size_t>() as int,
@@ -666,7 +666,7 @@ fn create_boxed_vec(cx: @CrateContext, vec_t: ty::t, elem_t: ty::t,
666666
};
667667

668668
let box_scx = create_structure(file_node, @fmt!("box<%s>", name), 0);
669-
let int_t = ty::mk_int(cx.tcx);
669+
let int_t = ty::mk_int();
670670
let refcount_type = create_basic_type(cx, int_t, vec_ty_span);
671671
add_member(box_scx, ~"refcnt", 0, sys::size_of::<uint>() as int,
672672
sys::min_align_of::<uint>() as int, refcount_type.node);
@@ -692,7 +692,7 @@ fn create_vec_slice(cx: @CrateContext, vec_t: ty::t, elem_t: ty::t, span: span)
692692
let fname = filename_from_span(cx, span);
693693
let file_node = create_file(cx, fname);
694694
let elem_ty_md = create_ty(cx, elem_t, span);
695-
let uint_type = create_basic_type(cx, ty::mk_uint(cx.tcx), span);
695+
let uint_type = create_basic_type(cx, ty::mk_uint(), span);
696696
let elem_ptr = create_pointer_type(cx, elem_t, span, elem_ty_md);
697697
let scx = create_structure(file_node, @ty_to_str(cx.tcx, vec_t), 0);
698698
let (_, ptr_size, ptr_align) = voidptr();
@@ -744,7 +744,7 @@ fn create_ty(cx: @CrateContext, t: ty::t, span: span)
744744
ty::ty_nil | ty::ty_bot | ty::ty_bool | ty::ty_int(_) | ty::ty_uint(_)
745745
| ty::ty_float(_) => create_basic_type(cx, t, span),
746746
ty::ty_estr(ref vstore) => {
747-
let i8_t = ty::mk_i8(cx.tcx);
747+
let i8_t = ty::mk_i8();
748748
match *vstore {
749749
ty::vstore_fixed(len) => {
750750
create_fixed_vec(cx, t, i8_t, len as int + 1, span)

src/librustc/middle/trans/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ fn trans_def_datum_unadjusted(bcx: block,
791791
let rust_ty = ty::mk_ptr(
792792
bcx.tcx(),
793793
ty::mt {
794-
ty: ty::mk_mach_uint(bcx.tcx(), ast::ty_u8),
794+
ty: ty::mk_mach_uint(ast::ty_u8),
795795
mutbl: ast::m_imm
796796
}); // *u8
797797
(rust_ty, PointerCast(bcx, fn_data.llfn, T_ptr(T_i8())))

src/librustc/middle/trans/foreign.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ pub fn trans_intrinsic(ccx: @CrateContext,
768768
let frameaddress_val = Call(bcx, frameaddress, ~[C_i32(0i32)]);
769769
let star_u8 = ty::mk_imm_ptr(
770770
bcx.tcx(),
771-
ty::mk_mach_uint(bcx.tcx(), ast::ty_u8));
771+
ty::mk_mach_uint(ast::ty_u8));
772772
let fty = ty::mk_closure(bcx.tcx(), ty::ClosureTy {
773773
purity: ast::impure_fn,
774774
sigil: ast::BorrowedSigil,
@@ -777,21 +777,21 @@ pub fn trans_intrinsic(ccx: @CrateContext,
777777
sig: FnSig {bound_lifetime_names: opt_vec::Empty,
778778
inputs: ~[arg {mode: ast::expl(ast::by_copy),
779779
ty: star_u8}],
780-
output: ty::mk_nil(bcx.tcx())}
780+
output: ty::mk_nil()}
781781
});
782782
let datum = Datum {val: get_param(decl, first_real_arg),
783783
mode: ByRef, ty: fty, source: ZeroMem};
784784
let arg_vals = ~[frameaddress_val];
785785
bcx = trans_call_inner(
786-
bcx, None, fty, ty::mk_nil(bcx.tcx()),
786+
bcx, None, fty, ty::mk_nil(),
787787
|bcx| Callee {bcx: bcx, data: Closure(datum)},
788788
ArgVals(arg_vals), Ignore, DontAutorefArg);
789789
}
790790
~"morestack_addr" => {
791791
// XXX This is a hack to grab the address of this particular
792792
// native function. There should be a general in-language
793793
// way to do this
794-
let llfty = type_of_fn(bcx.ccx(), ~[], ty::mk_nil(bcx.tcx()));
794+
let llfty = type_of_fn(bcx.ccx(), ~[], ty::mk_nil());
795795
let morestack_addr = decl_cdecl_fn(
796796
bcx.ccx().llmod, ~"__morestack", llfty);
797797
let morestack_addr = PointerCast(bcx, morestack_addr,

src/librustc/middle/trans/glue.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -168,19 +168,19 @@ pub fn simplified_glue_type(tcx: ty::ctxt, field: uint, t: ty::t) -> ty::t {
168168
field == abi::tydesc_field_drop_glue ||
169169
field == abi::tydesc_field_free_glue) &&
170170
! ty::type_needs_drop(tcx, t) {
171-
return ty::mk_u32(tcx);
171+
return ty::mk_u32();
172172
}
173173

174174
if field == abi::tydesc_field_take_glue {
175175
match ty::get(t).sty {
176-
ty::ty_unboxed_vec(*) => { return ty::mk_u32(tcx); }
176+
ty::ty_unboxed_vec(*) => { return ty::mk_u32(); }
177177
_ => ()
178178
}
179179
}
180180

181181
if field == abi::tydesc_field_take_glue &&
182182
ty::type_is_boxed(t) {
183-
return ty::mk_imm_box(tcx, ty::mk_u32(tcx));
183+
return ty::mk_imm_box(tcx, ty::mk_u32());
184184
}
185185

186186
if field == abi::tydesc_field_free_glue {
@@ -193,7 +193,7 @@ pub fn simplified_glue_type(tcx: ty::ctxt, field: uint, t: ty::t) -> ty::t {
193193
ty::ty_evec(_, ty::vstore_uniq) | ty::ty_estr(ty::vstore_uniq) |
194194
ty::ty_evec(_, ty::vstore_box) | ty::ty_estr(ty::vstore_box) |
195195
ty::ty_opaque_closure_ptr(*) => (),
196-
_ => { return ty::mk_u32(tcx); }
196+
_ => { return ty::mk_u32(); }
197197
}
198198
}
199199

@@ -203,12 +203,12 @@ pub fn simplified_glue_type(tcx: ty::ctxt, field: uint, t: ty::t) -> ty::t {
203203
ty::ty_box(mt) |
204204
ty::ty_evec(mt, ty::vstore_box)
205205
if ! ty::type_needs_drop(tcx, mt.ty) =>
206-
return ty::mk_imm_box(tcx, ty::mk_u32(tcx)),
206+
return ty::mk_imm_box(tcx, ty::mk_u32()),
207207

208208
ty::ty_uniq(mt) |
209209
ty::ty_evec(mt, ty::vstore_uniq)
210210
if ! ty::type_needs_drop(tcx, mt.ty) =>
211-
return ty::mk_imm_uniq(tcx, ty::mk_u32(tcx)),
211+
return ty::mk_imm_uniq(tcx, ty::mk_u32()),
212212

213213
_ => ()
214214
}
@@ -736,7 +736,7 @@ pub fn make_generic_glue_inner(ccx: @CrateContext,
736736
helper: glue_helper)
737737
-> ValueRef {
738738
let _icx = ccx.insn_ctxt("make_generic_glue_inner");
739-
let fcx = new_fn_ctxt(ccx, ~[], llfn, ty::mk_nil(ccx.tcx), None);
739+
let fcx = new_fn_ctxt(ccx, ~[], llfn, ty::mk_nil(), None);
740740
lib::llvm::SetLinkage(llfn, lib::llvm::InternalLinkage);
741741
ccx.stats.n_glues_created += 1u;
742742
// All glue functions take values passed *by alias*; this is a

0 commit comments

Comments
 (0)