From 52d3f5558e663c4fab407a9ab703132b4ef6443d Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Mon, 22 Apr 2013 20:19:05 -0700 Subject: [PATCH] core, rustc: Warning police --- src/libcore/rt/io/stdio.rs | 4 +- src/libcore/rt/uvio.rs | 2 +- src/libcore/task/spawn.rs | 2 +- src/librustc/metadata/decoder.rs | 2 +- src/librustc/metadata/tydecode.rs | 34 +- src/librustc/middle/check_match.rs | 2 +- src/librustc/middle/mem_categorization.rs | 2 +- src/librustc/middle/trans/_match.rs | 6 +- src/librustc/middle/trans/adt.rs | 5 +- src/librustc/middle/trans/base.rs | 9 +- src/librustc/middle/trans/closure.rs | 9 +- src/librustc/middle/trans/common.rs | 4 +- src/librustc/middle/trans/debuginfo.rs | 10 +- src/librustc/middle/trans/expr.rs | 2 +- src/librustc/middle/trans/foreign.rs | 8 +- src/librustc/middle/trans/glue.rs | 14 +- src/librustc/middle/trans/monomorphize.rs | 6 +- src/librustc/middle/trans/reflect.rs | 6 +- src/librustc/middle/ty.rs | 96 ++--- src/librustc/middle/typeck/astconv.rs | 14 +- src/librustc/middle/typeck/check/_match.rs | 10 +- src/librustc/middle/typeck/check/mod.rs | 351 +++++++++--------- src/librustc/middle/typeck/check/regionck.rs | 2 +- src/librustc/middle/typeck/check/writeback.rs | 2 +- src/librustc/middle/typeck/infer/combine.rs | 8 +- src/librustc/middle/typeck/infer/lattice.rs | 2 +- src/librustc/middle/typeck/infer/resolve.rs | 10 +- src/librustc/middle/typeck/mod.rs | 8 +- 28 files changed, 310 insertions(+), 320 deletions(-) diff --git a/src/libcore/rt/io/stdio.rs b/src/libcore/rt/io/stdio.rs index 21989f5e873..26950986f7a 100644 --- a/src/libcore/rt/io/stdio.rs +++ b/src/libcore/rt/io/stdio.rs @@ -17,9 +17,9 @@ pub fn stdout() -> StdWriter { fail!() } pub fn stderr() -> StdReader { fail!() } -pub fn print(s: &str) { fail!() } +pub fn print(_s: &str) { fail!() } -pub fn println(s: &str) { fail!() } +pub fn println(_s: &str) { fail!() } pub enum StdStream { StdIn, diff --git a/src/libcore/rt/uvio.rs b/src/libcore/rt/uvio.rs index d4e547de383..7bf1792baf4 100644 --- a/src/libcore/rt/uvio.rs +++ b/src/libcore/rt/uvio.rs @@ -11,7 +11,7 @@ use option::*; use result::*; -use super::io::net::ip::{IpAddr, Ipv4}; +use super::io::net::ip::{IpAddr, Ipv4}; // n.b. Ipv4 is used only in tests use super::uv::*; use super::rtio::*; use ops::Drop; diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index d872d38a278..43fdee67b7a 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -549,7 +549,7 @@ pub fn spawn_raw(opts: TaskOpts, f: ~fn()) { } } -fn spawn_raw_newsched(opts: TaskOpts, f: ~fn()) { +fn spawn_raw_newsched(_opts: TaskOpts, f: ~fn()) { use rt::sched::*; let mut sched = local_sched::take(); diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index 248d847f89d..460da765004 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -247,7 +247,7 @@ fn doc_transformed_self_ty(doc: ebml::Doc, } } -pub fn item_type(item_id: ast::def_id, item: ebml::Doc, +pub fn item_type(_item_id: ast::def_id, item: ebml::Doc, tcx: ty::ctxt, cdata: cmd) -> ty::t { doc_type(item, tcx, cdata) } diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 709f1d4fc35..5d5169a5181 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -279,28 +279,28 @@ fn parse_trait_ref(st: @mut PState, conv: conv_did) -> ty::TraitRef { fn parse_ty(st: @mut PState, conv: conv_did) -> ty::t { match next(st) { - 'n' => return ty::mk_nil(st.tcx), - 'z' => return ty::mk_bot(st.tcx), - 'b' => return ty::mk_bool(st.tcx), - 'i' => return ty::mk_int(st.tcx), - 'u' => return ty::mk_uint(st.tcx), - 'l' => return ty::mk_float(st.tcx), + 'n' => return ty::mk_nil(), + 'z' => return ty::mk_bot(), + 'b' => return ty::mk_bool(), + 'i' => return ty::mk_int(), + 'u' => return ty::mk_uint(), + 'l' => return ty::mk_float(), 'M' => { match next(st) { - 'b' => return ty::mk_mach_uint(st.tcx, ast::ty_u8), - 'w' => return ty::mk_mach_uint(st.tcx, ast::ty_u16), - 'l' => return ty::mk_mach_uint(st.tcx, ast::ty_u32), - 'd' => return ty::mk_mach_uint(st.tcx, ast::ty_u64), - 'B' => return ty::mk_mach_int(st.tcx, ast::ty_i8), - 'W' => return ty::mk_mach_int(st.tcx, ast::ty_i16), - 'L' => return ty::mk_mach_int(st.tcx, ast::ty_i32), - 'D' => return ty::mk_mach_int(st.tcx, ast::ty_i64), - 'f' => return ty::mk_mach_float(st.tcx, ast::ty_f32), - 'F' => return ty::mk_mach_float(st.tcx, ast::ty_f64), + 'b' => return ty::mk_mach_uint(ast::ty_u8), + 'w' => return ty::mk_mach_uint(ast::ty_u16), + 'l' => return ty::mk_mach_uint(ast::ty_u32), + 'd' => return ty::mk_mach_uint(ast::ty_u64), + 'B' => return ty::mk_mach_int(ast::ty_i8), + 'W' => return ty::mk_mach_int(ast::ty_i16), + 'L' => return ty::mk_mach_int(ast::ty_i32), + 'D' => return ty::mk_mach_int(ast::ty_i64), + 'f' => return ty::mk_mach_float(ast::ty_f32), + 'F' => return ty::mk_mach_float(ast::ty_f64), _ => fail!(~"parse_ty: bad numeric type") } } - 'c' => return ty::mk_char(st.tcx), + 'c' => return ty::mk_char(), 't' => { assert!((next(st) == '[')); let def = parse_def(st, NominalType, conv); diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index 8fc94cf51e2..04d47bf5d06 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -211,7 +211,7 @@ pub fn is_useful(cx: @MatchCheckCtxt, m: &matrix, v: &[@pat]) -> useful { let real_pat = match m.find(|r| r[0].id != 0) { Some(r) => r[0], None => v[0] }; - let left_ty = if real_pat.id == 0 { ty::mk_nil(cx.tcx) } + let left_ty = if real_pat.id == 0 { ty::mk_nil() } else { ty::node_id_to_type(cx.tcx, real_pat.id) }; match pat_ctor_id(cx, v[0]) { diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 51e6860432a..1696e5566e2 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -749,7 +749,7 @@ pub impl mem_categorization_ctxt { fn cat_index(&self, elt: N, base_cmt: cmt) -> cmt { - let mt = match ty::index(self.tcx, base_cmt.ty) { + let mt = match ty::index(base_cmt.ty) { Some(mt) => mt, None => { self.tcx.sess.span_bug( diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index dc59fcecb5a..6e84adae6dc 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -1073,8 +1073,7 @@ pub fn compare_values(cx: block, match ty::get(rhs_t).sty { ty::ty_estr(ty::vstore_uniq) => { - let scratch_result = scratch_datum(cx, ty::mk_bool(cx.tcx()), - false); + let scratch_result = scratch_datum(cx, ty::mk_bool(), false); let scratch_lhs = alloca(cx, val_ty(lhs)); Store(cx, lhs, scratch_lhs); let scratch_rhs = alloca(cx, val_ty(rhs)); @@ -1092,8 +1091,7 @@ pub fn compare_values(cx: block, } } ty::ty_estr(_) => { - let scratch_result = scratch_datum(cx, ty::mk_bool(cx.tcx()), - false); + let scratch_result = scratch_datum(cx, ty::mk_bool(), false); let did = cx.tcx().lang_items.str_eq_fn(); let bcx = callee::trans_lang_call(cx, did, ~[lhs, rhs], diff --git a/src/librustc/middle/trans/adt.rs b/src/librustc/middle/trans/adt.rs index 7db6e44adcf..b3e24fcc939 100644 --- a/src/librustc/middle/trans/adt.rs +++ b/src/librustc/middle/trans/adt.rs @@ -50,7 +50,6 @@ use core::option::{Option, Some, None}; use core::vec; use lib::llvm::{ValueRef, TypeRef, True, IntEQ, IntNE}; -use lib::llvm::llvm::LLVMDumpValue; use middle::trans::_match; use middle::trans::build::*; use middle::trans::common::*; @@ -136,7 +135,7 @@ fn represent_type_uncached(cx: @CrateContext, t: ty::t) -> Repr { let packed = ty::lookup_packed(cx.tcx, def_id); let dtor = ty::ty_dtor(cx.tcx, def_id).is_present(); let ftys = - if dtor { ftys + [ty::mk_bool(cx.tcx)] } else { ftys }; + if dtor { ftys + [ty::mk_bool()] } else { ftys }; return Univariant(mk_struct(cx, ftys, packed), dtor) } ty::ty_enum(def_id, ref substs) => { @@ -204,7 +203,7 @@ fn represent_type_uncached(cx: @CrateContext, t: ty::t) -> Repr { } // The general case. - let discr = ~[ty::mk_int(cx.tcx)]; + let discr = ~[ty::mk_int()]; return General(cases.map(|c| mk_struct(cx, discr + c.tys, false))) } _ => cx.sess.bug(~"adt::represent_type called on non-ADT type") diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 2d9f834040a..b86e9a51293 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -707,7 +707,7 @@ pub fn iter_structural_ty(cx: block, av: ValueRef, t: ty::t, substs.tps, f); } (_match::switch, Some(lldiscrim_a)) => { - cx = f(cx, lldiscrim_a, ty::mk_int(cx.tcx())); + cx = f(cx, lldiscrim_a, ty::mk_int()); let unr_cx = sub_block(cx, ~"enum-iter-unr"); Unreachable(unr_cx); let llswitch = Switch(cx, lldiscrim_a, unr_cx.llbb, @@ -2361,7 +2361,7 @@ pub fn create_entry_wrapper(ccx: @CrateContext, } fn create_main(ccx: @CrateContext, main_llfn: ValueRef) -> ValueRef { - let nt = ty::mk_nil(ccx.tcx); + let nt = ty::mk_nil(); let llfty = type_of_fn(ccx, ~[], nt); let llfdecl = decl_fn(ccx.llmod, ~"_rust_main", lib::llvm::CCallConv, llfty); @@ -2407,9 +2407,8 @@ pub fn create_entry_wrapper(ccx: @CrateContext, unsafe { llvm::LLVMPositionBuilderAtEnd(bld, llbb); - let crate_map = ccx.crate_map; let start_def_id = ccx.tcx.lang_items.start_fn(); - let start_fn = if start_def_id.crate == ast::local_crate { + if start_def_id.crate == ast::local_crate { ccx.sess.bug(~"start lang item is never in the local crate") } else { let start_fn_type = csearch::get_type(ccx.tcx, @@ -2727,7 +2726,7 @@ pub fn trans_constant(ccx: @CrateContext, it: @ast::item) { path_name(variant.node.name), path_name(special_idents::descrim) ]); - let s = @mangle_exported_name(ccx, p, ty::mk_int(ccx.tcx)); + let s = @mangle_exported_name(ccx, p, ty::mk_int()); let disr_val = vi[i].disr_val; note_unique_llvm_symbol(ccx, s); let discrim_gvar = str::as_c_str(*s, |buf| { diff --git a/src/librustc/middle/trans/closure.rs b/src/librustc/middle/trans/closure.rs index 4fc4cae464d..e532e5e1dfd 100644 --- a/src/librustc/middle/trans/closure.rs +++ b/src/librustc/middle/trans/closure.rs @@ -261,8 +261,7 @@ pub fn build_closure(bcx0: block, include_ret_handle: Option) -> ClosureResult { let _icx = bcx0.insn_ctxt("closure::build_closure"); // If we need to, package up the iterator body to call - let bcx = bcx0;; - let ccx = bcx.ccx(), tcx = ccx.tcx; + let bcx = bcx0; // Package up the captured upvars let mut env_vals = ~[]; @@ -290,7 +289,7 @@ pub fn build_closure(bcx0: block, // variables: for include_ret_handle.each |flagptr| { // Flag indicating we have returned (a by-ref bool): - let flag_datum = Datum {val: *flagptr, ty: ty::mk_bool(tcx), + let flag_datum = Datum {val: *flagptr, ty: ty::mk_bool(), mode: ByRef, source: ZeroMem}; env_vals.push(EnvValue {action: EnvRef, datum: flag_datum}); @@ -302,7 +301,7 @@ pub fn build_closure(bcx0: block, None => bcx.fcx.llretptr.get() }; let ret_casted = PointerCast(bcx, ret_true, T_ptr(T_nil())); - let ret_datum = Datum {val: ret_casted, ty: ty::mk_nil(tcx), + let ret_datum = Datum {val: ret_casted, ty: ty::mk_nil(), mode: ByRef, source: ZeroMem}; env_vals.push(EnvValue {action: EnvRef, datum: ret_datum}); @@ -420,7 +419,7 @@ pub fn trans_expr_fn(bcx: block, } let real_return_type = if is_loop_body.is_some() { - ty::mk_bool(bcx.tcx()) + ty::mk_bool() } else { ty::ty_fn_ret(fty) }; diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 83fe135d872..7aade041fbc 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -999,9 +999,9 @@ pub fn T_opaque_vec(targ_cfg: @session::config) -> TypeRef { pub fn tuplify_box_ty(tcx: ty::ctxt, t: ty::t) -> ty::t { let ptr = ty::mk_ptr( tcx, - ty::mt {ty: ty::mk_nil(tcx), mutbl: ast::m_imm} + ty::mt {ty: ty::mk_nil(), mutbl: ast::m_imm} ); - return ty::mk_tup(tcx, ~[ty::mk_uint(tcx), ty::mk_type(tcx), + return ty::mk_tup(tcx, ~[ty::mk_uint(), ty::mk_type(tcx), ptr, ptr, t]); } diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index eb8209bf7a7..6c1fbff664b 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -560,7 +560,7 @@ fn create_boxed_type(cx: @CrateContext, contents: ty::t, let fname = filename_from_span(cx, span); let file_node = create_file(cx, fname); //let cu_node = create_compile_unit_metadata(cx, fname); - let int_t = ty::mk_int(cx.tcx); + let int_t = ty::mk_int(); let refcount_type = create_basic_type(cx, int_t, span); let name = ty_to_str(cx.tcx, contents); 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, let elem_ty_md = create_ty(cx, elem_t, vec_ty_span); let vec_scx = create_structure(file_node, @/*bad*/ copy ty_to_str(cx.tcx, vec_t), 0); - let size_t_type = create_basic_type(cx, ty::mk_uint(cx.tcx), vec_ty_span); + let size_t_type = create_basic_type(cx, ty::mk_uint(), vec_ty_span); add_member(vec_scx, ~"fill", 0, sys::size_of::() as int, sys::min_align_of::() as int, size_t_type.node); add_member(vec_scx, ~"alloc", 0, sys::size_of::() as int, @@ -666,7 +666,7 @@ fn create_boxed_vec(cx: @CrateContext, vec_t: ty::t, elem_t: ty::t, }; let box_scx = create_structure(file_node, @fmt!("box<%s>", name), 0); - let int_t = ty::mk_int(cx.tcx); + let int_t = ty::mk_int(); let refcount_type = create_basic_type(cx, int_t, vec_ty_span); add_member(box_scx, ~"refcnt", 0, sys::size_of::() as int, sys::min_align_of::() 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) let fname = filename_from_span(cx, span); let file_node = create_file(cx, fname); let elem_ty_md = create_ty(cx, elem_t, span); - let uint_type = create_basic_type(cx, ty::mk_uint(cx.tcx), span); + let uint_type = create_basic_type(cx, ty::mk_uint(), span); let elem_ptr = create_pointer_type(cx, elem_t, span, elem_ty_md); let scx = create_structure(file_node, @ty_to_str(cx.tcx, vec_t), 0); let (_, ptr_size, ptr_align) = voidptr(); @@ -744,7 +744,7 @@ fn create_ty(cx: @CrateContext, t: ty::t, span: span) ty::ty_nil | ty::ty_bot | ty::ty_bool | ty::ty_int(_) | ty::ty_uint(_) | ty::ty_float(_) => create_basic_type(cx, t, span), ty::ty_estr(ref vstore) => { - let i8_t = ty::mk_i8(cx.tcx); + let i8_t = ty::mk_i8(); match *vstore { ty::vstore_fixed(len) => { create_fixed_vec(cx, t, i8_t, len as int + 1, span) diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index 8727db27fff..21fb11813e8 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -791,7 +791,7 @@ fn trans_def_datum_unadjusted(bcx: block, let rust_ty = ty::mk_ptr( bcx.tcx(), ty::mt { - ty: ty::mk_mach_uint(bcx.tcx(), ast::ty_u8), + ty: ty::mk_mach_uint(ast::ty_u8), mutbl: ast::m_imm }); // *u8 (rust_ty, PointerCast(bcx, fn_data.llfn, T_ptr(T_i8()))) diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs index cb15a2e8c64..22a60a1ed2e 100644 --- a/src/librustc/middle/trans/foreign.rs +++ b/src/librustc/middle/trans/foreign.rs @@ -768,7 +768,7 @@ pub fn trans_intrinsic(ccx: @CrateContext, let frameaddress_val = Call(bcx, frameaddress, ~[C_i32(0i32)]); let star_u8 = ty::mk_imm_ptr( bcx.tcx(), - ty::mk_mach_uint(bcx.tcx(), ast::ty_u8)); + ty::mk_mach_uint(ast::ty_u8)); let fty = ty::mk_closure(bcx.tcx(), ty::ClosureTy { purity: ast::impure_fn, sigil: ast::BorrowedSigil, @@ -777,13 +777,13 @@ pub fn trans_intrinsic(ccx: @CrateContext, sig: FnSig {bound_lifetime_names: opt_vec::Empty, inputs: ~[arg {mode: ast::expl(ast::by_copy), ty: star_u8}], - output: ty::mk_nil(bcx.tcx())} + output: ty::mk_nil()} }); let datum = Datum {val: get_param(decl, first_real_arg), mode: ByRef, ty: fty, source: ZeroMem}; let arg_vals = ~[frameaddress_val]; bcx = trans_call_inner( - bcx, None, fty, ty::mk_nil(bcx.tcx()), + bcx, None, fty, ty::mk_nil(), |bcx| Callee {bcx: bcx, data: Closure(datum)}, ArgVals(arg_vals), Ignore, DontAutorefArg); } @@ -791,7 +791,7 @@ pub fn trans_intrinsic(ccx: @CrateContext, // XXX This is a hack to grab the address of this particular // native function. There should be a general in-language // way to do this - let llfty = type_of_fn(bcx.ccx(), ~[], ty::mk_nil(bcx.tcx())); + let llfty = type_of_fn(bcx.ccx(), ~[], ty::mk_nil()); let morestack_addr = decl_cdecl_fn( bcx.ccx().llmod, ~"__morestack", llfty); let morestack_addr = PointerCast(bcx, morestack_addr, diff --git a/src/librustc/middle/trans/glue.rs b/src/librustc/middle/trans/glue.rs index 9031871de56..bdf50619e62 100644 --- a/src/librustc/middle/trans/glue.rs +++ b/src/librustc/middle/trans/glue.rs @@ -168,19 +168,19 @@ pub fn simplified_glue_type(tcx: ty::ctxt, field: uint, t: ty::t) -> ty::t { field == abi::tydesc_field_drop_glue || field == abi::tydesc_field_free_glue) && ! ty::type_needs_drop(tcx, t) { - return ty::mk_u32(tcx); + return ty::mk_u32(); } if field == abi::tydesc_field_take_glue { match ty::get(t).sty { - ty::ty_unboxed_vec(*) => { return ty::mk_u32(tcx); } + ty::ty_unboxed_vec(*) => { return ty::mk_u32(); } _ => () } } if field == abi::tydesc_field_take_glue && ty::type_is_boxed(t) { - return ty::mk_imm_box(tcx, ty::mk_u32(tcx)); + return ty::mk_imm_box(tcx, ty::mk_u32()); } 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 { ty::ty_evec(_, ty::vstore_uniq) | ty::ty_estr(ty::vstore_uniq) | ty::ty_evec(_, ty::vstore_box) | ty::ty_estr(ty::vstore_box) | ty::ty_opaque_closure_ptr(*) => (), - _ => { return ty::mk_u32(tcx); } + _ => { return ty::mk_u32(); } } } @@ -203,12 +203,12 @@ pub fn simplified_glue_type(tcx: ty::ctxt, field: uint, t: ty::t) -> ty::t { ty::ty_box(mt) | ty::ty_evec(mt, ty::vstore_box) if ! ty::type_needs_drop(tcx, mt.ty) => - return ty::mk_imm_box(tcx, ty::mk_u32(tcx)), + return ty::mk_imm_box(tcx, ty::mk_u32()), ty::ty_uniq(mt) | ty::ty_evec(mt, ty::vstore_uniq) if ! ty::type_needs_drop(tcx, mt.ty) => - return ty::mk_imm_uniq(tcx, ty::mk_u32(tcx)), + return ty::mk_imm_uniq(tcx, ty::mk_u32()), _ => () } @@ -736,7 +736,7 @@ pub fn make_generic_glue_inner(ccx: @CrateContext, helper: glue_helper) -> ValueRef { let _icx = ccx.insn_ctxt("make_generic_glue_inner"); - let fcx = new_fn_ctxt(ccx, ~[], llfn, ty::mk_nil(ccx.tcx), None); + let fcx = new_fn_ctxt(ccx, ~[], llfn, ty::mk_nil(), None); lib::llvm::SetLinkage(llfn, lib::llvm::InternalLinkage); ccx.stats.n_glues_created += 1u; // All glue functions take values passed *by alias*; this is a diff --git a/src/librustc/middle/trans/monomorphize.rs b/src/librustc/middle/trans/monomorphize.rs index 052bea1b022..a7221297eca 100644 --- a/src/librustc/middle/trans/monomorphize.rs +++ b/src/librustc/middle/trans/monomorphize.rs @@ -307,7 +307,7 @@ pub fn normalize_for_monomorphization(tcx: ty::ctxt, abis: AbiSet::Rust(), sig: FnSig {bound_lifetime_names: opt_vec::Empty, inputs: ~[], - output: ty::mk_nil(tcx)}})) + output: ty::mk_nil()}})) } ty::ty_closure(ref fty) => { Some(normalized_closure_ty(tcx, fty.sigil)) @@ -323,7 +323,7 @@ pub fn normalize_for_monomorphization(tcx: ty::ctxt, Some(normalized_closure_ty(tcx, sigil)) } ty::ty_ptr(_) => { - Some(ty::mk_uint(tcx)) + Some(ty::mk_uint()) } _ => { None @@ -342,7 +342,7 @@ pub fn normalize_for_monomorphization(tcx: ty::ctxt, region: ty::re_static, sig: ty::FnSig {bound_lifetime_names: opt_vec::Empty, inputs: ~[], - output: ty::mk_nil(tcx)}}) + output: ty::mk_nil()}}) } } diff --git a/src/librustc/middle/trans/reflect.rs b/src/librustc/middle/trans/reflect.rs index ffb2cc01ab2..741b111b6a0 100644 --- a/src/librustc/middle/trans/reflect.rs +++ b/src/librustc/middle/trans/reflect.rs @@ -98,7 +98,7 @@ pub impl Reflector { for args.eachi |i, a| { debug!("arg %u: %s", i, val_str(bcx.ccx().tn, *a)); } - let bool_ty = ty::mk_bool(tcx); + let bool_ty = ty::mk_bool(); let scratch = scratch_datum(bcx, bool_ty, false); // XXX: Should not be BoxTraitStore! let bcx = callee::trans_call_inner( @@ -283,7 +283,7 @@ pub impl Reflector { let sym = mangle_internal_name_by_path_and_seq(ccx, sub_path, ~"get_disr"); let args = [ty::arg { mode: ast::expl(ast::by_copy), ty: opaqueptrty }]; - let llfty = type_of_fn(ccx, args, ty::mk_int(ccx.tcx)); + let llfty = type_of_fn(ccx, args, ty::mk_int()); let llfdecl = decl_internal_cdecl_fn(ccx.llmod, sym, llfty); let arg = unsafe { llvm::LLVMGetParam(llfdecl, first_real_arg as c_uint) @@ -291,7 +291,7 @@ pub impl Reflector { let fcx = new_fn_ctxt(ccx, ~[], llfdecl, - ty::mk_uint(ccx.tcx), + ty::mk_uint(), None); let bcx = top_scope_block(fcx, None); let arg = BitCast(bcx, arg, llptrty); diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 7cdd7c8a6f2..f312dbca5c3 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -949,12 +949,12 @@ pub fn mk_ctxt(s: session::Session, fn mk_t(cx: ctxt, st: sty) -> t { // Check for primitive types. match st { - ty_nil => return mk_nil(cx), - ty_err => return mk_err(cx), - ty_bool => return mk_bool(cx), - ty_int(i) => return mk_mach_int(cx, i), - ty_uint(u) => return mk_mach_uint(cx, u), - ty_float(f) => return mk_mach_float(cx, f), + ty_nil => return mk_nil(), + ty_err => return mk_err(), + ty_bool => return mk_bool(), + ty_int(i) => return mk_mach_int(i), + ty_uint(u) => return mk_mach_uint(u), + ty_float(f) => return mk_mach_float(f), _ => {} }; @@ -1052,94 +1052,94 @@ fn mk_t(cx: ctxt, st: sty) -> t { } #[inline(always)] -pub fn mk_prim_t(cx: ctxt, primitive: &'static t_box_) -> t { +pub fn mk_prim_t(primitive: &'static t_box_) -> t { unsafe { cast::transmute::<&'static t_box_, t>(primitive) } } #[inline(always)] -pub fn mk_nil(cx: ctxt) -> t { mk_prim_t(cx, &primitives::TY_NIL) } +pub fn mk_nil() -> t { mk_prim_t(&primitives::TY_NIL) } #[inline(always)] -pub fn mk_err(cx: ctxt) -> t { mk_prim_t(cx, &primitives::TY_ERR) } +pub fn mk_err() -> t { mk_prim_t(&primitives::TY_ERR) } #[inline(always)] -pub fn mk_bot(cx: ctxt) -> t { mk_prim_t(cx, &primitives::TY_BOT) } +pub fn mk_bot() -> t { mk_prim_t(&primitives::TY_BOT) } #[inline(always)] -pub fn mk_bool(cx: ctxt) -> t { mk_prim_t(cx, &primitives::TY_BOOL) } +pub fn mk_bool() -> t { mk_prim_t(&primitives::TY_BOOL) } #[inline(always)] -pub fn mk_int(cx: ctxt) -> t { mk_prim_t(cx, &primitives::TY_INT) } +pub fn mk_int() -> t { mk_prim_t(&primitives::TY_INT) } #[inline(always)] -pub fn mk_i8(cx: ctxt) -> t { mk_prim_t(cx, &primitives::TY_I8) } +pub fn mk_i8() -> t { mk_prim_t(&primitives::TY_I8) } #[inline(always)] -pub fn mk_i16(cx: ctxt) -> t { mk_prim_t(cx, &primitives::TY_I16) } +pub fn mk_i16() -> t { mk_prim_t(&primitives::TY_I16) } #[inline(always)] -pub fn mk_i32(cx: ctxt) -> t { mk_prim_t(cx, &primitives::TY_I32) } +pub fn mk_i32() -> t { mk_prim_t(&primitives::TY_I32) } #[inline(always)] -pub fn mk_i64(cx: ctxt) -> t { mk_prim_t(cx, &primitives::TY_I64) } +pub fn mk_i64() -> t { mk_prim_t(&primitives::TY_I64) } #[inline(always)] -pub fn mk_float(cx: ctxt) -> t { mk_prim_t(cx, &primitives::TY_FLOAT) } +pub fn mk_float() -> t { mk_prim_t(&primitives::TY_FLOAT) } #[inline(always)] -pub fn mk_f32(cx: ctxt) -> t { mk_prim_t(cx, &primitives::TY_F32) } +pub fn mk_f32() -> t { mk_prim_t(&primitives::TY_F32) } #[inline(always)] -pub fn mk_f64(cx: ctxt) -> t { mk_prim_t(cx, &primitives::TY_F64) } +pub fn mk_f64() -> t { mk_prim_t(&primitives::TY_F64) } #[inline(always)] -pub fn mk_uint(cx: ctxt) -> t { mk_prim_t(cx, &primitives::TY_UINT) } +pub fn mk_uint() -> t { mk_prim_t(&primitives::TY_UINT) } #[inline(always)] -pub fn mk_u8(cx: ctxt) -> t { mk_prim_t(cx, &primitives::TY_U8) } +pub fn mk_u8() -> t { mk_prim_t(&primitives::TY_U8) } #[inline(always)] -pub fn mk_u16(cx: ctxt) -> t { mk_prim_t(cx, &primitives::TY_U16) } +pub fn mk_u16() -> t { mk_prim_t(&primitives::TY_U16) } #[inline(always)] -pub fn mk_u32(cx: ctxt) -> t { mk_prim_t(cx, &primitives::TY_U32) } +pub fn mk_u32() -> t { mk_prim_t(&primitives::TY_U32) } #[inline(always)] -pub fn mk_u64(cx: ctxt) -> t { mk_prim_t(cx, &primitives::TY_U64) } +pub fn mk_u64() -> t { mk_prim_t(&primitives::TY_U64) } -pub fn mk_mach_int(cx: ctxt, tm: ast::int_ty) -> t { +pub fn mk_mach_int(tm: ast::int_ty) -> t { match tm { - ast::ty_i => mk_int(cx), - ast::ty_char => mk_char(cx), - ast::ty_i8 => mk_i8(cx), - ast::ty_i16 => mk_i16(cx), - ast::ty_i32 => mk_i32(cx), - ast::ty_i64 => mk_i64(cx), + ast::ty_i => mk_int(), + ast::ty_char => mk_char(), + ast::ty_i8 => mk_i8(), + ast::ty_i16 => mk_i16(), + ast::ty_i32 => mk_i32(), + ast::ty_i64 => mk_i64(), } } -pub fn mk_mach_uint(cx: ctxt, tm: ast::uint_ty) -> t { +pub fn mk_mach_uint(tm: ast::uint_ty) -> t { match tm { - ast::ty_u => mk_uint(cx), - ast::ty_u8 => mk_u8(cx), - ast::ty_u16 => mk_u16(cx), - ast::ty_u32 => mk_u32(cx), - ast::ty_u64 => mk_u64(cx), + ast::ty_u => mk_uint(), + ast::ty_u8 => mk_u8(), + ast::ty_u16 => mk_u16(), + ast::ty_u32 => mk_u32(), + ast::ty_u64 => mk_u64(), } } -pub fn mk_mach_float(cx: ctxt, tm: ast::float_ty) -> t { +pub fn mk_mach_float(tm: ast::float_ty) -> t { match tm { - ast::ty_f => mk_float(cx), - ast::ty_f32 => mk_f32(cx), - ast::ty_f64 => mk_f64(cx), + ast::ty_f => mk_float(), + ast::ty_f32 => mk_f32(), + ast::ty_f64 => mk_f64(), } } #[inline(always)] -pub fn mk_char(cx: ctxt) -> t { mk_prim_t(cx, &primitives::TY_CHAR) } +pub fn mk_char() -> t { mk_prim_t(&primitives::TY_CHAR) } pub fn mk_estr(cx: ctxt, t: vstore) -> t { mk_t(cx, ty_estr(t)) @@ -1182,7 +1182,7 @@ pub fn mk_imm_ptr(cx: ctxt, ty: t) -> t { } pub fn mk_nil_ptr(cx: ctxt) -> t { - mk_ptr(cx, mt {ty: mk_nil(cx), mutbl: ast::m_imm}) + mk_ptr(cx, mt {ty: mk_nil(), mutbl: ast::m_imm}) } pub fn mk_evec(cx: ctxt, tm: mt, t: vstore) -> t { @@ -1610,7 +1610,7 @@ pub fn type_is_str(ty: t) -> bool { pub fn sequence_element_type(cx: ctxt, ty: t) -> t { match get(ty).sty { - ty_estr(_) => return mk_mach_uint(cx, ast::ty_u8), + ty_estr(_) => return mk_mach_uint(ast::ty_u8), ty_evec(mt, _) | ty_unboxed_vec(mt) => return mt.ty, _ => cx.sess.bug( ~"sequence_element_type called on non-sequence value"), @@ -2614,14 +2614,14 @@ pub fn type_autoderef(cx: ctxt, t: t) -> t { } // Returns the type and mutability of t[i] -pub fn index(cx: ctxt, t: t) -> Option { - index_sty(cx, &get(t).sty) +pub fn index(t: t) -> Option { + index_sty(&get(t).sty) } -pub fn index_sty(cx: ctxt, sty: &sty) -> Option { +pub fn index_sty(sty: &sty) -> Option { match *sty { ty_evec(mt, _) => Some(mt), - ty_estr(_) => Some(mt {ty: mk_u8(cx), mutbl: ast::m_imm}), + ty_estr(_) => Some(mt {ty: mk_u8(), mutbl: ast::m_imm}), _ => None } } diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index 10acea1291f..f75ec183473 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -352,8 +352,8 @@ pub fn ast_ty_to_ty( tcx.ast_ty_to_ty_cache.insert(ast_ty.id, ty::atttce_unresolved); let typ = match ast_ty.node { - ast::ty_nil => ty::mk_nil(tcx), - ast::ty_bot => ty::mk_bot(tcx), + ast::ty_nil => ty::mk_nil(), + ast::ty_bot => ty::mk_bot(), ast::ty_box(ref mt) => { mk_pointer(self, rscope, mt, ty::vstore_box, |tmt| ty::mk_box(tcx, tmt)) @@ -413,7 +413,7 @@ pub fn ast_ty_to_ty( fmt!("reference to trait `%s` where a type is expected; \ try `@%s`, `~%s`, or `&%s`", path_str, path_str, path_str, path_str)); - ty::mk_err(tcx) + ty::mk_err() } ast::def_ty(did) | ast::def_struct(did) => { ast_path_to_ty(self, rscope, did, path).ty @@ -422,19 +422,19 @@ pub fn ast_ty_to_ty( match nty { ast::ty_bool => { check_path_args(tcx, path, NO_TPS | NO_REGIONS); - ty::mk_bool(tcx) + ty::mk_bool() } ast::ty_int(it) => { check_path_args(tcx, path, NO_TPS | NO_REGIONS); - ty::mk_mach_int(tcx, it) + ty::mk_mach_int(it) } ast::ty_uint(uit) => { check_path_args(tcx, path, NO_TPS | NO_REGIONS); - ty::mk_mach_uint(tcx, uit) + ty::mk_mach_uint(uit) } ast::ty_float(ft) => { check_path_args(tcx, path, NO_TPS | NO_REGIONS); - ty::mk_mach_float(tcx, ft) + ty::mk_mach_float(ft) } ast::ty_str => { tcx.sess.span_err(ast_ty.span, diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs index c58ad0bfa3b..c52989c5d22 100644 --- a/src/librustc/middle/typeck/check/_match.rs +++ b/src/librustc/middle/typeck/check/_match.rs @@ -56,7 +56,7 @@ pub fn check_match(fcx: @mut FnCtxt, let mut guard_bot = false; match arm.guard { Some(e) => { - check_expr_has_type(fcx, e, ty::mk_bool(tcx)); + check_expr_has_type(fcx, e, ty::mk_bool()); let e_ty = fcx.expr_ty(e); if ty::type_is_error(e_ty) { guard_err = true; @@ -84,10 +84,10 @@ pub fn check_match(fcx: @mut FnCtxt, demand::suptype(fcx, arm.body.span, result_ty, bty); } if saw_err { - result_ty = ty::mk_err(tcx); + result_ty = ty::mk_err(); } else if !arm_non_bot { - result_ty = ty::mk_bot(tcx); + result_ty = ty::mk_bot(); } fcx.write_ty(expr.id, result_ty); } @@ -230,11 +230,9 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: @ast::pat, path: @ast::Path, } if error_happened { - let tcx = pcx.fcx.ccx.tcx; - for subpats.each |pats| { for pats.each |pat| { - check_pat(pcx, *pat, ty::mk_err(tcx)); + check_pat(pcx, *pat, ty::mk_err()); } } } diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index ca9b3602d5d..dd147d9e468 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -753,13 +753,13 @@ pub impl FnCtxt { } fn write_nil(&self, node_id: ast::node_id) { - self.write_ty(node_id, ty::mk_nil(self.tcx())); + self.write_ty(node_id, ty::mk_nil()); } fn write_bot(&self, node_id: ast::node_id) { - self.write_ty(node_id, ty::mk_bot(self.tcx())); + self.write_ty(node_id, ty::mk_bot()); } fn write_error(@mut self, node_id: ast::node_id) { - self.write_ty(node_id, ty::mk_err(self.tcx())); + self.write_ty(node_id, ty::mk_err()); } fn to_ty(&self, ast_t: @ast::Ty) -> ty::t { @@ -1008,21 +1008,21 @@ pub fn check_lit(fcx: @mut FnCtxt, lit: @ast::lit) -> ty::t { match lit.node { ast::lit_str(*) => ty::mk_estr(tcx, ty::vstore_slice(ty::re_static)), - ast::lit_int(_, t) => ty::mk_mach_int(tcx, t), - ast::lit_uint(_, t) => ty::mk_mach_uint(tcx, t), + ast::lit_int(_, t) => ty::mk_mach_int(t), + ast::lit_uint(_, t) => ty::mk_mach_uint(t), ast::lit_int_unsuffixed(_) => { // An unsuffixed integer literal could have any integral type, // so we create an integral type variable for it. ty::mk_int_var(tcx, fcx.infcx().next_int_var_id()) } - ast::lit_float(_, t) => ty::mk_mach_float(tcx, t), + ast::lit_float(_, t) => ty::mk_mach_float(t), ast::lit_float_unsuffixed(_) => { // An unsuffixed floating point literal could have any floating point // type, so we create a floating point type variable for it. ty::mk_float_var(tcx, fcx.infcx().next_float_var_id()) } - ast::lit_nil => ty::mk_nil(tcx), - ast::lit_bool(_) => ty::mk_bool(tcx) + ast::lit_nil => ty::mk_nil(), + ast::lit_bool(_) => ty::mk_bool() } } @@ -1146,7 +1146,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, deref_args: DerefArgs) -> ty::t { if ty::type_is_error(method_fn_ty) { - let err_inputs = err_args(fcx.tcx(), args.len()); + let err_inputs = err_args(args.len()); check_argument_types(fcx, sp, err_inputs, callee_expr, args, sugar, deref_args); method_fn_ty @@ -1209,7 +1209,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, tcx.sess.span_err(sp, msg); - vec::from_elem(supplied_arg_count, ty::mk_err(tcx)) + vec::from_elem(supplied_arg_count, ty::mk_err()) }; debug!("check_argument_types: formal_tys=%?", @@ -1265,9 +1265,9 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } } - fn err_args(tcx: ty::ctxt, len: uint) -> ~[ty::arg] { + fn err_args(len: uint) -> ~[ty::arg] { vec::from_fn(len, |_| ty::arg {mode: ast::expl(ast::by_copy), - ty: ty::mk_err(tcx)}) + ty: ty::mk_err()}) } // A generic function for checking assignment expressions @@ -1278,7 +1278,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, check_expr(fcx, lhs); let lhs_type = fcx.expr_ty(lhs); check_expr_has_type(fcx, rhs, lhs_type); - fcx.write_ty(id, ty::mk_nil(fcx.ccx.tcx)); + fcx.write_ty(id, ty::mk_nil()); // The callee checks for bot / err, we don't need to } @@ -1321,8 +1321,8 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, // check each arg against "error", in order to set up // all the node type bindings FnSig {bound_lifetime_names: opt_vec::Empty, - inputs: err_args(fcx.tcx(), args.len()), - output: ty::mk_err(fcx.tcx())} + inputs: err_args(args.len()), + output: ty::mk_err()} } }; @@ -1417,7 +1417,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } None => { check_block_no_value(fcx, thn); - ty::mk_nil(fcx.ccx.tcx) + ty::mk_nil() } }; @@ -1448,15 +1448,14 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, ast::NoSugar, deref_args) } _ => { - let tcx = fcx.tcx(); unbound_method(); // Check the args anyway // so we get all the error messages - let expected_ty = ty::mk_err(tcx); + let expected_ty = ty::mk_err(); check_method_argument_types(fcx, op_ex.span, expected_ty, op_ex, args, ast::NoSugar, deref_args); - ty::mk_err(tcx) + ty::mk_err() } } } @@ -1494,7 +1493,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, let result_t = match op { ast::eq | ast::ne | ast::lt | ast::le | ast::ge | ast::gt => { - ty::mk_bool(tcx) + ty::mk_bool() } _ => { lhs_t @@ -1565,7 +1564,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } } - ty::mk_err(tcx) + ty::mk_err() } fn check_user_unop(fcx: @mut FnCtxt, @@ -1671,11 +1670,11 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, bound_lifetime_names: opt_vec::Empty, inputs: fn_ty.sig.inputs.map(|an_arg| { arg { mode: an_arg.mode, - ty: ty::mk_err(tcx) + ty: ty::mk_err() }}), - output: ty::mk_err(tcx) + output: ty::mk_err() }; - ty::mk_err(tcx) + ty::mk_err() } else { let fn_ty_copy = copy fn_ty; @@ -1792,7 +1791,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, // Typecheck each field. for ast_fields.each |field| { - let mut expected_field_type = ty::mk_err(tcx); + let mut expected_field_type = ty::mk_err(); let pair = class_field_map.find(&field.node.ident). map_consume(|x| *x); @@ -1934,7 +1933,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, fields, base_expr.is_none()); if ty::type_is_error(fcx.node_ty(id)) { - struct_type = ty::mk_err(tcx); + struct_type = ty::mk_err(); } // Check the base expression if necessary. @@ -1943,7 +1942,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, Some(base_expr) => { check_expr_has_type(fcx, base_expr, struct_type); if ty::type_is_bot(fcx.node_ty(base_expr.id)) { - struct_type = ty::mk_bot(tcx); + struct_type = ty::mk_bot(); } } } @@ -2040,10 +2039,10 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, let inner_ty = match expected_sty { Some(ty::ty_closure(ref fty)) => { match fcx.mk_subty(false, expr.span, - fty.sig.output, ty::mk_bool(tcx)) { + fty.sig.output, ty::mk_bool()) { result::Ok(_) => { ty::mk_closure(tcx, ty::ClosureTy { - sig: FnSig {output: ty::mk_nil(tcx), + sig: FnSig {output: ty::mk_nil(), ..copy fty.sig}, ..copy *fty }) @@ -2070,7 +2069,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, None); err_happened = true; fcx.write_error(expr.id); - ty::mk_err(tcx) + ty::mk_err() } } } @@ -2085,7 +2084,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, actual) }, expected_t, None); - let err_ty = ty::mk_err(tcx); + let err_ty = ty::mk_err(); fcx.write_error(expr.id); err_happened = true; err_ty @@ -2131,7 +2130,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } else { let loop_body_ty = ty::replace_closure_return_type( - tcx, block_ty, ty::mk_bool(tcx)); + tcx, block_ty, ty::mk_bool()); fcx.write_ty(expr.id, loop_body_ty); } } @@ -2168,10 +2167,10 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } } if any_error { - ty::mk_err(tcx) + ty::mk_err() } else if any_bot { - ty::mk_bot(tcx) + ty::mk_bot() } else { ty::mk_evec(tcx, ty::mt {ty: t, mutbl: mutability}, tt) @@ -2179,7 +2178,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } ast::expr_repeat(element, count_expr, mutbl) => { let _ = ty::eval_repeat_count(tcx, count_expr); - check_expr_with_hint(fcx, count_expr, ty::mk_uint(tcx)); + check_expr_with_hint(fcx, count_expr, ty::mk_uint()); let tt = ast_expr_vstore_to_vstore(fcx, ev, vst); let mutability = match vst { ast::expr_vstore_mut_box | ast::expr_vstore_mut_slice => { @@ -2191,9 +2190,9 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, check_expr_has_type(fcx, element, t); let arg_t = fcx.expr_ty(element); if ty::type_is_error(arg_t) { - ty::mk_err(tcx) + ty::mk_err() } else if ty::type_is_bot(arg_t) { - ty::mk_bot(tcx) + ty::mk_bot() } else { ty::mk_evec(tcx, ty::mt {ty: t, mutbl: mutability}, tt) } @@ -2351,9 +2350,9 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, let tm = ty::mt { ty: fcx.expr_ty(oprnd), mutbl: mutbl }; let oprnd_t = if ty::type_is_error(tm.ty) { - ty::mk_err(tcx) + ty::mk_err() } else if ty::type_is_bot(tm.ty) { - ty::mk_bot(tcx) + ty::mk_bot() } else { ty::mk_rptr(tcx, region, tm) @@ -2387,7 +2386,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, }; match expr_opt { None => match fcx.mk_eqty(false, expr.span, - ret_ty, ty::mk_nil(tcx)) { + ret_ty, ty::mk_nil()) { result::Ok(_) => { /* fall through */ } result::Err(_) => { tcx.sess.span_err( @@ -2403,7 +2402,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } ast::expr_log(lv, e) => { check_expr_has_type(fcx, lv, - ty::mk_mach_uint(tcx, ast::ty_u32)); + ty::mk_mach_uint(ast::ty_u32)); // Note: this does not always execute, so do not propagate bot: check_expr(fcx, e); @@ -2451,7 +2450,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } } ast::expr_if(cond, ref thn, elsopt) => { - check_expr_has_type(fcx, cond, ty::mk_bool(tcx)); + check_expr_has_type(fcx, cond, ty::mk_bool()); check_then_else(fcx, thn, elsopt, id, expr.span); let cond_ty = fcx.expr_ty(cond); let then_ty = fcx.node_ty(thn.node.id); @@ -2471,7 +2470,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, // Other cases were handled by check_then_else } ast::expr_while(cond, ref body) => { - check_expr_has_type(fcx, cond, ty::mk_bool(tcx)); + check_expr_has_type(fcx, cond, ty::mk_bool()); check_block_no_value(fcx, body); let cond_ty = fcx.expr_ty(cond); let body_ty = fcx.node_ty(body.node.id); @@ -2539,7 +2538,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, has non-closure type: %s", actual) }, expected_t, None); - let err_ty = ty::mk_err(tcx); + let err_ty = ty::mk_err(); fcx.write_ty(id, err_ty); err_ty } @@ -2706,7 +2705,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } ast::expr_repeat(element, count_expr, mutbl) => { let count = ty::eval_repeat_count(tcx, count_expr); - check_expr_with_hint(fcx, count_expr, ty::mk_uint(tcx)); + check_expr_with_hint(fcx, count_expr, ty::mk_uint()); let t: ty::t = fcx.infcx().next_ty_var(); check_expr_has_type(fcx, element, t); let element_ty = fcx.expr_ty(element); @@ -2782,7 +2781,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, else { let (base_t, derefs) = do_autoderef(fcx, expr.span, raw_base_t); let base_sty = structure_of(fcx, expr.span, base_t); - match ty::index_sty(tcx, &base_sty) { + match ty::index_sty(&base_sty) { Some(mt) => { require_integral(fcx, idx.span, idx_t); fcx.write_ty(id, mt.ty); @@ -2886,7 +2885,7 @@ pub fn check_stmt(fcx: @mut FnCtxt, stmt: @ast::stmt) { ast::stmt_expr(expr, id) => { node_id = id; // Check with expected type of () - check_expr_has_type(fcx, expr, ty::mk_nil(fcx.ccx.tcx)); + check_expr_has_type(fcx, expr, ty::mk_nil()); let expr_ty = fcx.expr_ty(expr); saw_bot = saw_bot || ty::type_is_bot(expr_ty); saw_err = saw_err || ty::type_is_error(expr_ty); @@ -2912,7 +2911,7 @@ pub fn check_stmt(fcx: @mut FnCtxt, stmt: @ast::stmt) { } pub fn check_block_no_value(fcx: @mut FnCtxt, blk: &ast::blk) { - check_block_with_expected(fcx, blk, Some(ty::mk_nil(fcx.ccx.tcx))); + check_block_with_expected(fcx, blk, Some(ty::mk_nil())); let blkty = fcx.node_ty(blk.node.id); if ty::type_is_error(blkty) { fcx.write_error(blk.node.id); @@ -2921,7 +2920,7 @@ pub fn check_block_no_value(fcx: @mut FnCtxt, blk: &ast::blk) { fcx.write_bot(blk.node.id); } else { - let nilty = ty::mk_nil(fcx.ccx.tcx); + let nilty = ty::mk_nil(); demand::suptype(fcx, blk.span, nilty, blkty); } } @@ -3054,7 +3053,7 @@ pub fn check_enum_variants(ccx: @mut CrateCtxt, let e = *e_ref; debug!("disr expr, checking %s", pprust::expr_to_str(e, ccx.tcx.sess.intr())); - let declty = ty::mk_int(ccx.tcx); + let declty = ty::mk_int(); let fcx = blank_fn_ctxt(ccx, rty, e.id); check_const_with_ty(fcx, e.span, e, declty); // check_expr (from check_const pass) doesn't guarantee @@ -3173,7 +3172,7 @@ pub fn ty_param_bounds_and_ty_for_def(fcx: @mut FnCtxt, ty: ty::mk_ptr( fcx.ccx.tcx, ty::mt { - ty: ty::mk_mach_uint(fcx.ccx.tcx, ast::ty_u8), + ty: ty::mk_mach_uint(ast::ty_u8), mutbl: ast::m_imm }) }; @@ -3296,7 +3295,7 @@ pub fn structurally_resolved_type(fcx: @mut FnCtxt, sp: span, tp: ty::t) fcx.type_error_message(sp, |_actual| { ~"the type of this value must be known in this context" }, tp, None); - demand::suptype(fcx, sp, ty::mk_err(fcx.tcx()), tp); + demand::suptype(fcx, sp, ty::mk_err(), tp); tp } } @@ -3413,10 +3412,10 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) { let tcx = ccx.tcx; let (n_tps, inputs, output) = match *ccx.tcx.sess.str_of(it.ident) { ~"size_of" | - ~"pref_align_of" | ~"min_align_of" => (1u, ~[], ty::mk_uint(ccx.tcx)), + ~"pref_align_of" | ~"min_align_of" => (1u, ~[], ty::mk_uint()), ~"init" => (1u, ~[], param(ccx, 0u)), ~"forget" => (1u, ~[arg(ast::by_copy, param(ccx, 0u))], - ty::mk_nil(tcx)), + ty::mk_nil()), ~"reinterpret_cast" => (2u, ~[arg(ast::by_ref, param(ccx, 0u))], param(ccx, 1u)), ~"addr_of" => (1u, ~[arg(ast::by_ref, param(ccx, 0u))], @@ -3426,41 +3425,41 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) { ty::mk_mut_rptr(tcx, ty::re_bound(ty::br_anon(0)), param(ccx, 0u))), arg(ast::by_copy, param(ccx, 0u))], - ty::mk_nil(tcx)) + ty::mk_nil()) } - ~"needs_drop" => (1u, ~[], ty::mk_bool(tcx)), + ~"needs_drop" => (1u, ~[], ty::mk_bool()), ~"atomic_cxchg" | ~"atomic_cxchg_acq"| ~"atomic_cxchg_rel" => { (0u, ~[arg(ast::by_copy, ty::mk_mut_rptr(tcx, ty::re_bound(ty::br_anon(0)), - ty::mk_int(tcx))), - arg(ast::by_copy, ty::mk_int(tcx)), - arg(ast::by_copy, ty::mk_int(tcx))], - ty::mk_int(tcx)) + ty::mk_int())), + arg(ast::by_copy, ty::mk_int()), + arg(ast::by_copy, ty::mk_int())], + ty::mk_int()) } ~"atomic_xchg" | ~"atomic_xadd" | ~"atomic_xsub" | ~"atomic_xchg_acq" | ~"atomic_xadd_acq" | ~"atomic_xsub_acq" | ~"atomic_xchg_rel" | ~"atomic_xadd_rel" | ~"atomic_xsub_rel" => { (0u, ~[arg(ast::by_copy, ty::mk_mut_rptr(tcx, ty::re_bound(ty::br_anon(0)), - ty::mk_int(tcx))), - arg(ast::by_copy, ty::mk_int(tcx))], - ty::mk_int(tcx)) + ty::mk_int())), + arg(ast::by_copy, ty::mk_int())], + ty::mk_int()) } ~"get_tydesc" => { // FIXME (#3730): return *intrinsic::tydesc, not *() - (1u, ~[], ty::mk_nil_ptr(tcx)) + (1u, ~[], ty::mk_nil_ptr(ccx.tcx)) } ~"visit_tydesc" => { let tydesc_name = special_idents::tydesc; assert!(tcx.intrinsic_defs.contains_key(&tydesc_name)); let (_, tydesc_ty) = *tcx.intrinsic_defs.get(&tydesc_name); - let (_, visitor_object_ty) = ty::visitor_object_ty(tcx); + let (_, visitor_object_ty) = ty::visitor_object_ty(ccx.tcx); let td_ptr = ty::mk_ptr(ccx.tcx, ty::mt {ty: tydesc_ty, mutbl: ast::m_imm}); (0u, ~[arg(ast::by_copy, td_ptr), - arg(ast::by_ref, visitor_object_ty)], ty::mk_nil(tcx)) + arg(ast::by_ref, visitor_object_ty)], ty::mk_nil()) } ~"frame_address" => { let fty = ty::mk_closure(ccx.tcx, ty::ClosureTy { @@ -3473,224 +3472,224 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) { inputs: ~[arg {mode: ast::expl(ast::by_copy), ty: ty::mk_imm_ptr( ccx.tcx, - ty::mk_mach_uint(ccx.tcx, ast::ty_u8))}], - output: ty::mk_nil(ccx.tcx) + ty::mk_mach_uint(ast::ty_u8))}], + output: ty::mk_nil() } }); - (0u, ~[arg(ast::by_ref, fty)], ty::mk_nil(tcx)) + (0u, ~[arg(ast::by_ref, fty)], ty::mk_nil()) } ~"morestack_addr" => { - (0u, ~[], ty::mk_nil_ptr(tcx)) + (0u, ~[], ty::mk_nil_ptr(ccx.tcx)) } ~"memmove32" => { (0, ~[arg(ast::by_copy, ty::mk_ptr(tcx, - ty::mt { ty: ty::mk_u8(tcx), mutbl: ast::m_mutbl })), + ty::mt { ty: ty::mk_u8(), mutbl: ast::m_mutbl })), arg(ast::by_copy, ty::mk_ptr(tcx, - ty::mt { ty: ty::mk_u8(tcx), mutbl: ast::m_imm })), + ty::mt { ty: ty::mk_u8(), mutbl: ast::m_imm })), arg(ast::by_copy, - ty::mk_u32(tcx))], - ty::mk_nil(tcx)) + ty::mk_u32())], + ty::mk_nil()) } ~"memmove64" => { (0, ~[arg(ast::by_copy, ty::mk_ptr(tcx, - ty::mt { ty: ty::mk_u8(tcx), mutbl: ast::m_mutbl })), + ty::mt { ty: ty::mk_u8(), mutbl: ast::m_mutbl })), arg(ast::by_copy, ty::mk_ptr(tcx, - ty::mt { ty: ty::mk_u8(tcx), mutbl: ast::m_imm })), + ty::mt { ty: ty::mk_u8(), mutbl: ast::m_imm })), arg(ast::by_copy, - ty::mk_u64(tcx))], - ty::mk_nil(tcx)) + ty::mk_u64())], + ty::mk_nil()) } ~"sqrtf32" => { - (0u, ~[arg(ast::by_copy, ty::mk_f32(tcx))], - ty::mk_f32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f32())], + ty::mk_f32()) } ~"sqrtf64" => { - (0u, ~[arg(ast::by_copy, ty::mk_f64(tcx))], - ty::mk_f64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f64())], + ty::mk_f64()) } ~"powif32" => { - (0u, ~[arg(ast::by_copy, ty::mk_f32(tcx)), - arg(ast::by_copy, ty::mk_i32(tcx))], - ty::mk_f32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f32()), + arg(ast::by_copy, ty::mk_i32())], + ty::mk_f32()) } ~"powif64" => { - (0u, ~[arg(ast::by_copy, ty::mk_f64(tcx)), - arg(ast::by_copy, ty::mk_i32(tcx))], - ty::mk_f64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f64()), + arg(ast::by_copy, ty::mk_i32())], + ty::mk_f64()) } ~"sinf32" => { - (0u, ~[arg(ast::by_copy, ty::mk_f32(tcx))], - ty::mk_f32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f32())], + ty::mk_f32()) } ~"sinf64" => { - (0u, ~[arg(ast::by_copy, ty::mk_f64(tcx))], - ty::mk_f64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f64())], + ty::mk_f64()) } ~"cosf32" => { - (0u, ~[arg(ast::by_copy, ty::mk_f32(tcx))], - ty::mk_f32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f32())], + ty::mk_f32()) } ~"cosf64" => { - (0u, ~[arg(ast::by_copy, ty::mk_f64(tcx))], - ty::mk_f64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f64())], + ty::mk_f64()) } ~"powf32" => { - (0u, ~[arg(ast::by_copy, ty::mk_f32(tcx)), - arg(ast::by_copy, ty::mk_f32(tcx))], - ty::mk_f32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f32()), + arg(ast::by_copy, ty::mk_f32())], + ty::mk_f32()) } ~"powf64" => { - (0u, ~[arg(ast::by_copy, ty::mk_f64(tcx)), - arg(ast::by_copy, ty::mk_f64(tcx))], - ty::mk_f64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f64()), + arg(ast::by_copy, ty::mk_f64())], + ty::mk_f64()) } ~"expf32" => { - (0u, ~[arg(ast::by_copy, ty::mk_f32(tcx))], - ty::mk_f32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f32())], + ty::mk_f32()) } ~"expf64" => { - (0u, ~[arg(ast::by_copy, ty::mk_f64(tcx))], - ty::mk_f64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f64())], + ty::mk_f64()) } ~"exp2f32" => { - (0u, ~[arg(ast::by_copy, ty::mk_f32(tcx))], - ty::mk_f32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f32())], + ty::mk_f32()) } ~"exp2f64" => { - (0u, ~[arg(ast::by_copy, ty::mk_f64(tcx))], - ty::mk_f64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f64())], + ty::mk_f64()) } ~"logf32" => { - (0u, ~[arg(ast::by_copy, ty::mk_f32(tcx))], - ty::mk_f32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f32())], + ty::mk_f32()) } ~"logf64" => { - (0u, ~[arg(ast::by_copy, ty::mk_f64(tcx))], - ty::mk_f64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f64())], + ty::mk_f64()) } ~"log10f32" => { - (0u, ~[arg(ast::by_copy, ty::mk_f32(tcx))], - ty::mk_f32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f32())], + ty::mk_f32()) } ~"log10f64" => { - (0u, ~[arg(ast::by_copy, ty::mk_f64(tcx))], - ty::mk_f64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f64())], + ty::mk_f64()) } ~"log2f32" => { - (0u, ~[arg(ast::by_copy, ty::mk_f32(tcx))], - ty::mk_f32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f32())], + ty::mk_f32()) } ~"log2f64" => { - (0u, ~[arg(ast::by_copy, ty::mk_f64(tcx))], - ty::mk_f64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f64())], + ty::mk_f64()) } ~"fmaf32" => { - (0u, ~[arg(ast::by_copy, ty::mk_f32(tcx)), - arg(ast::by_copy, ty::mk_f32(tcx)), - arg(ast::by_copy, ty::mk_f32(tcx))], - ty::mk_f32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f32()), + arg(ast::by_copy, ty::mk_f32()), + arg(ast::by_copy, ty::mk_f32())], + ty::mk_f32()) } ~"fmaf64" => { - (0u, ~[arg(ast::by_copy, ty::mk_f64(tcx)), - arg(ast::by_copy, ty::mk_f64(tcx)), - arg(ast::by_copy, ty::mk_f64(tcx))], - ty::mk_f64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f64()), + arg(ast::by_copy, ty::mk_f64()), + arg(ast::by_copy, ty::mk_f64())], + ty::mk_f64()) } ~"fabsf32" => { - (0u, ~[arg(ast::by_copy, ty::mk_f32(tcx))], - ty::mk_f32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f32())], + ty::mk_f32()) } ~"fabsf64" => { - (0u, ~[arg(ast::by_copy, ty::mk_f64(tcx))], - ty::mk_f64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f64())], + ty::mk_f64()) } ~"floorf32" => { - (0u, ~[arg(ast::by_copy, ty::mk_f32(tcx))], - ty::mk_f32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f32())], + ty::mk_f32()) } ~"floorf64" => { - (0u, ~[arg(ast::by_copy, ty::mk_f64(tcx))], - ty::mk_f64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f64())], + ty::mk_f64()) } ~"ceilf32" => { - (0u, ~[arg(ast::by_copy, ty::mk_f32(tcx))], - ty::mk_f32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f32())], + ty::mk_f32()) } ~"ceilf64" => { - (0u, ~[arg(ast::by_copy, ty::mk_f64(tcx))], - ty::mk_f64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f64())], + ty::mk_f64()) } ~"truncf32" => { - (0u, ~[arg(ast::by_copy, ty::mk_f32(tcx))], - ty::mk_f32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f32())], + ty::mk_f32()) } ~"truncf64" => { - (0u, ~[arg(ast::by_copy, ty::mk_f64(tcx))], - ty::mk_f64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_f64())], + ty::mk_f64()) } ~"ctpop8" => { - (0u, ~[arg(ast::by_copy, ty::mk_i8(tcx))], - ty::mk_i8(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_i8())], + ty::mk_i8()) } ~"ctpop16" => { - (0u, ~[arg(ast::by_copy, ty::mk_i16(tcx))], - ty::mk_i16(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_i16())], + ty::mk_i16()) } ~"ctpop32" => { - (0u, ~[arg(ast::by_copy, ty::mk_i32(tcx))], - ty::mk_i32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_i32())], + ty::mk_i32()) } ~"ctpop64" => { - (0u, ~[arg(ast::by_copy, ty::mk_i64(tcx))], - ty::mk_i64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_i64())], + ty::mk_i64()) } ~"ctlz8" => { - (0u, ~[arg(ast::by_copy, ty::mk_i8(tcx))], - ty::mk_i8(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_i8())], + ty::mk_i8()) } ~"ctlz16" => { - (0u, ~[arg(ast::by_copy, ty::mk_i16(tcx))], - ty::mk_i16(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_i16())], + ty::mk_i16()) } ~"ctlz32" => { - (0u, ~[arg(ast::by_copy, ty::mk_i32(tcx))], - ty::mk_i32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_i32())], + ty::mk_i32()) } ~"ctlz64" => { - (0u, ~[arg(ast::by_copy, ty::mk_i64(tcx))], - ty::mk_i64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_i64())], + ty::mk_i64()) } ~"cttz8" => { - (0u, ~[arg(ast::by_copy, ty::mk_i8(tcx))], - ty::mk_i8(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_i8())], + ty::mk_i8()) } ~"cttz16" => { - (0u, ~[arg(ast::by_copy, ty::mk_i16(tcx))], - ty::mk_i16(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_i16())], + ty::mk_i16()) } ~"cttz32" => { - (0u, ~[arg(ast::by_copy, ty::mk_i32(tcx))], - ty::mk_i32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_i32())], + ty::mk_i32()) } ~"cttz64" => { - (0u, ~[arg(ast::by_copy, ty::mk_i64(tcx))], - ty::mk_i64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_i64())], + ty::mk_i64()) } ~"bswap16" => { - (0u, ~[arg(ast::by_copy, ty::mk_i16(tcx))], - ty::mk_i16(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_i16())], + ty::mk_i16()) } ~"bswap32" => { - (0u, ~[arg(ast::by_copy, ty::mk_i32(tcx))], - ty::mk_i32(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_i32())], + ty::mk_i32()) } ~"bswap64" => { - (0u, ~[arg(ast::by_copy, ty::mk_i64(tcx))], - ty::mk_i64(tcx)) + (0u, ~[arg(ast::by_copy, ty::mk_i64())], + ty::mk_i64()) } ref other => { tcx.sess.span_err(it.span, ~"unrecognized intrinsic function: `" + diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs index aec7399d5eb..cd10e1f9787 100644 --- a/src/librustc/middle/typeck/check/regionck.rs +++ b/src/librustc/middle/typeck/check/regionck.rs @@ -108,7 +108,7 @@ pub impl Rcx { match resolve_type(self.fcx.infcx(), unresolved_ty, resolve_and_force_all_but_regions) { Ok(t) => t, - Err(_) => ty::mk_err(self.fcx.tcx()) + Err(_) => ty::mk_err() } } diff --git a/src/librustc/middle/typeck/check/writeback.rs b/src/librustc/middle/typeck/check/writeback.rs index 0dba55b4e72..894b508b309 100644 --- a/src/librustc/middle/typeck/check/writeback.rs +++ b/src/librustc/middle/typeck/check/writeback.rs @@ -57,7 +57,7 @@ fn resolve_type_vars_in_types(fcx: @mut FnCtxt, sp: span, tys: &[ty::t]) tys.map(|t| { match resolve_type_vars_in_type(fcx, sp, *t) { Some(t1) => t1, - None => ty::mk_err(fcx.ccx.tcx) + None => ty::mk_err() } }) } diff --git a/src/librustc/middle/typeck/infer/combine.rs b/src/librustc/middle/typeck/infer/combine.rs index fdc96a21b8b..3f58a322472 100644 --- a/src/librustc/middle/typeck/infer/combine.rs +++ b/src/librustc/middle/typeck/infer/combine.rs @@ -613,14 +613,13 @@ pub fn super_tys( vid: ty::IntVid, val: ty::IntVarValue) -> cres { - let tcx = self.infcx().tcx; if val == IntType(ast::ty_char) { Err(ty::terr_integer_as_char) } else { if_ok!(self.infcx().simple_var_t(vid_is_expected, vid, val)); match val { - IntType(v) => Ok(ty::mk_mach_int(tcx, v)), - UintType(v) => Ok(ty::mk_mach_uint(tcx, v)) + IntType(v) => Ok(ty::mk_mach_int(v)), + UintType(v) => Ok(ty::mk_mach_uint(v)) } } } @@ -631,9 +630,8 @@ pub fn super_tys( vid: ty::FloatVid, val: ast::float_ty) -> cres { - let tcx = self.infcx().tcx; if_ok!(self.infcx().simple_var_t(vid_is_expected, vid, val)); - Ok(ty::mk_mach_float(tcx, val)) + Ok(ty::mk_mach_float(val)) } } diff --git a/src/librustc/middle/typeck/infer/lattice.rs b/src/librustc/middle/typeck/infer/lattice.rs index db229a407b3..52a938a34d3 100644 --- a/src/librustc/middle/typeck/infer/lattice.rs +++ b/src/librustc/middle/typeck/infer/lattice.rs @@ -327,7 +327,7 @@ impl LatticeDir for Glb { impl TyLatticeDir for Glb { fn ty_bot(&self, _t: ty::t) -> cres { - Ok(ty::mk_bot(self.infcx.tcx)) + Ok(ty::mk_bot()) } } diff --git a/src/librustc/middle/typeck/infer/resolve.rs b/src/librustc/middle/typeck/infer/resolve.rs index c208d1d24fc..53b7b4f1958 100644 --- a/src/librustc/middle/typeck/infer/resolve.rs +++ b/src/librustc/middle/typeck/infer/resolve.rs @@ -245,12 +245,12 @@ pub impl ResolveState { let node = self.infcx.get(vid); match node.possible_types { - Some(IntType(t)) => ty::mk_mach_int(self.infcx.tcx, t), - Some(UintType(t)) => ty::mk_mach_uint(self.infcx.tcx, t), + Some(IntType(t)) => ty::mk_mach_int(t), + Some(UintType(t)) => ty::mk_mach_uint(t), None => { if self.should(force_ivar) { // As a last resort, default to int. - let ty = ty::mk_int(self.infcx.tcx); + let ty = ty::mk_int(); self.infcx.set(vid, Root(Some(IntType(ast::ty_i)), node.rank)); ty @@ -268,11 +268,11 @@ pub impl ResolveState { let node = self.infcx.get(vid); match node.possible_types { - Some(t) => ty::mk_mach_float(self.infcx.tcx, t), + Some(t) => ty::mk_mach_float(t), None => { if self.should(force_fvar) { // As a last resort, default to float. - let ty = ty::mk_float(self.infcx.tcx); + let ty = ty::mk_float(); self.infcx.set(vid, Root(Some(ast::ty_f), node.rank)); ty } else { diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs index f87c0dad5a9..ad4938c9869 100644 --- a/src/librustc/middle/typeck/mod.rs +++ b/src/librustc/middle/typeck/mod.rs @@ -363,11 +363,11 @@ fn check_start_fn_ty(ccx: @mut CrateCtxt, purity: ast::impure_fn, abis: abi::AbiSet::Rust(), sig: ty::FnSig {bound_lifetime_names: opt_vec::Empty, - inputs: ~[arg(ast::by_copy, ty::mk_int(tcx)), + inputs: ~[arg(ast::by_copy, ty::mk_int()), arg(ast::by_copy, ty::mk_imm_ptr(tcx, - ty::mk_imm_ptr(tcx, ty::mk_u8(tcx)))), - arg(ast::by_copy, ty::mk_imm_ptr(tcx, ty::mk_u8(tcx)))], - output: ty::mk_int(tcx)} + ty::mk_imm_ptr(tcx, ty::mk_u8()))), + arg(ast::by_copy, ty::mk_imm_ptr(tcx, ty::mk_u8()))], + output: ty::mk_int()} }); require_same_types(tcx, None, false, start_span, start_t, se_ty,