diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index d8168814c6cd..9d9b8780bbfb 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -700,7 +700,7 @@ pub fn get_enum_variants<'tcx>(intr: Rc, cdata: Cmd, id: ast::Nod item, tcx, cdata); let name = item_name(&*intr, item); let (ctor_ty, arg_tys, arg_names) = match ctor_ty.sty { - ty::ty_bare_fn(ref f) => + ty::ty_bare_fn(_, ref f) => (Some(ctor_ty), f.sig.0.inputs.clone(), None), _ => { // Nullary or struct enum variant. let mut arg_names = Vec::new(); diff --git a/src/librustc/middle/effect.rs b/src/librustc/middle/effect.rs index 0c0cba6e53e0..52899aaba412 100644 --- a/src/librustc/middle/effect.rs +++ b/src/librustc/middle/effect.rs @@ -32,7 +32,7 @@ enum UnsafeContext { fn type_is_unsafe_function(ty: Ty) -> bool { match ty.sty { - ty::ty_bare_fn(ref f) => f.unsafety == ast::Unsafety::Unsafe, + ty::ty_bare_fn(_, ref f) => f.unsafety == ast::Unsafety::Unsafe, ty::ty_closure(ref f) => f.unsafety == ast::Unsafety::Unsafe, _ => false, } diff --git a/src/librustc/middle/fast_reject.rs b/src/librustc/middle/fast_reject.rs index 297d6bcb03cb..62cf47da6870 100644 --- a/src/librustc/middle/fast_reject.rs +++ b/src/librustc/middle/fast_reject.rs @@ -83,7 +83,7 @@ pub fn simplify_type(tcx: &ty::ctxt, ty::ty_closure(ref f) => { Some(FunctionSimplifiedType(f.sig.0.inputs.len())) } - ty::ty_bare_fn(ref f) => { + ty::ty_bare_fn(_, ref f) => { Some(FunctionSimplifiedType(f.sig.0.inputs.len())) } ty::ty_param(_) => { diff --git a/src/librustc/middle/intrinsicck.rs b/src/librustc/middle/intrinsicck.rs index ea19111ce3d6..6acbc98b4b27 100644 --- a/src/librustc/middle/intrinsicck.rs +++ b/src/librustc/middle/intrinsicck.rs @@ -74,7 +74,7 @@ struct IntrinsicCheckingVisitor<'a, 'tcx: 'a> { impl<'a, 'tcx> IntrinsicCheckingVisitor<'a, 'tcx> { fn def_id_is_transmute(&self, def_id: DefId) -> bool { let intrinsic = match ty::lookup_item_type(self.tcx, def_id).ty.sty { - ty::ty_bare_fn(ref bfty) => bfty.abi == RustIntrinsic, + ty::ty_bare_fn(_, ref bfty) => bfty.abi == RustIntrinsic, _ => return false }; if def_id.krate == ast::LOCAL_CRATE { @@ -123,7 +123,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for IntrinsicCheckingVisitor<'a, 'tcx> { DefFn(did, _) if self.def_id_is_transmute(did) => { let typ = ty::node_id_to_type(self.tcx, expr.id); match typ.sty { - ty_bare_fn(ref bare_fn_ty) if bare_fn_ty.abi == RustIntrinsic => { + ty_bare_fn(_, ref bare_fn_ty) if bare_fn_ty.abi == RustIntrinsic => { if let ty::FnConverging(to) = bare_fn_ty.sig.0.output { let from = bare_fn_ty.sig.0.inputs[0]; self.check_transmute(expr.span, from, to, expr.id); diff --git a/src/librustc/middle/traits/select.rs b/src/librustc/middle/traits/select.rs index 8ba28b61006b..77d7aac4d09f 100644 --- a/src/librustc/middle/traits/select.rs +++ b/src/librustc/middle/traits/select.rs @@ -795,7 +795,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { } // provide an impl, but only for suitable `fn` pointers - ty::ty_bare_fn(ty::BareFnTy { + ty::ty_bare_fn(_, ty::BareFnTy { unsafety: ast::Unsafety::Normal, abi: abi::Rust, sig: ty::Binder(ty::FnSig { @@ -984,7 +984,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { ty::ty_int(_) | ty::ty_bool | ty::ty_float(_) | - ty::ty_bare_fn(_) | + ty::ty_bare_fn(..) | ty::ty_char => { // safe for everything Ok(If(Vec::new())) @@ -1543,7 +1543,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { let self_ty = self.infcx.shallow_resolve(obligation.self_ty()); let sig = match self_ty.sty { - ty::ty_bare_fn(ty::BareFnTy { + ty::ty_bare_fn(_, ty::BareFnTy { unsafety: ast::Unsafety::Normal, abi: abi::Rust, ref sig diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 4130d07aed01..f05404759c4e 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -2185,7 +2185,7 @@ impl FlagComputation { self.add_tys(ts[]); } - &ty_bare_fn(ref f) => { + &ty_bare_fn(_, ref f) => { self.add_fn_sig(&f.sig); } @@ -2457,7 +2457,7 @@ pub fn maybe_walk_ty<'tcx>(ty: Ty<'tcx>, f: |Ty<'tcx>| -> bool) { } } ty_tup(ref ts) => { for tt in ts.iter() { maybe_walk_ty(*tt, |x| f(x)); } } - ty_bare_fn(ref ft) => { + ty_bare_fn(_, ref ft) => { for a in ft.sig.0.inputs.iter() { maybe_walk_ty(*a, |x| f(x)); } if let ty::FnConverging(output) = ft.sig.0.output { maybe_walk_ty(output, f); @@ -2940,7 +2940,7 @@ pub fn type_contents<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> TypeContents { // Scalar and unique types are sendable, and durable ty_infer(ty::FreshIntTy(_)) | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) | - ty_bare_fn(_) | ty::ty_char => { + ty_bare_fn(..) | ty::ty_char => { TC::None } @@ -3275,7 +3275,7 @@ pub fn is_instantiable<'tcx>(cx: &ctxt<'tcx>, r_ty: Ty<'tcx>) -> bool { ty_uint(_) | ty_float(_) | ty_str | - ty_bare_fn(_) | + ty_bare_fn(..) | ty_closure(_) | ty_infer(_) | ty_err | @@ -3810,7 +3810,7 @@ pub fn node_id_item_substs<'tcx>(cx: &ctxt<'tcx>, id: ast::NodeId) -> ItemSubsts pub fn fn_is_variadic(fty: Ty) -> bool { match fty.sty { - ty_bare_fn(ref f) => f.sig.0.variadic, + ty_bare_fn(_, ref f) => f.sig.0.variadic, ty_closure(ref f) => f.sig.0.variadic, ref s => { panic!("fn_is_variadic() called on non-fn type: {}", s) @@ -3820,7 +3820,7 @@ pub fn fn_is_variadic(fty: Ty) -> bool { pub fn ty_fn_sig<'tcx>(fty: Ty<'tcx>) -> &'tcx PolyFnSig<'tcx> { match fty.sty { - ty_bare_fn(ref f) => &f.sig, + ty_bare_fn(_, ref f) => &f.sig, ty_closure(ref f) => &f.sig, ref s => { panic!("ty_fn_sig() called on non-fn type: {}", s) @@ -3831,7 +3831,7 @@ pub fn ty_fn_sig<'tcx>(fty: Ty<'tcx>) -> &'tcx PolyFnSig<'tcx> { /// Returns the ABI of the given function. pub fn ty_fn_abi(fty: Ty) -> abi::Abi { match fty.sty { - ty_bare_fn(ref f) => f.abi, + ty_bare_fn(_, ref f) => f.abi, ty_closure(ref f) => f.abi, _ => panic!("ty_fn_abi() called on non-fn type"), } @@ -3858,7 +3858,7 @@ pub fn ty_closure_store(fty: Ty) -> TraitStore { pub fn ty_fn_ret<'tcx>(fty: Ty<'tcx>) -> FnOutput<'tcx> { match fty.sty { - ty_bare_fn(ref f) => f.sig.0.output, + ty_bare_fn(_, ref f) => f.sig.0.output, ty_closure(ref f) => f.sig.0.output, ref s => { panic!("ty_fn_ret() called on non-fn type: {}", s) @@ -3868,7 +3868,7 @@ pub fn ty_fn_ret<'tcx>(fty: Ty<'tcx>) -> FnOutput<'tcx> { pub fn is_fn_ty(fty: Ty) -> bool { match fty.sty { - ty_bare_fn(_) => true, + ty_bare_fn(..) => true, ty_closure(_) => true, _ => false } @@ -6234,7 +6234,7 @@ pub fn accumulate_lifetimes_in_type(accumulator: &mut Vec, ty_str | ty_vec(_, _) | ty_ptr(_) | - ty_bare_fn(_) | + ty_bare_fn(..) | ty_tup(_) | ty_param(_) | ty_infer(_) | diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 85a06125e23a..daa7c13e3b31 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -408,7 +408,7 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String { ty_closure(ref f) => { closure_to_string(cx, &**f) } - ty_bare_fn(ref f) => { + ty_bare_fn(_, ref f) => { bare_fn_to_string(cx, f.unsafety, f.abi, None, &f.sig) } ty_infer(infer_ty) => infer_ty_to_string(cx, infer_ty), diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs index 090d6a7a3cae..526bbca8d70d 100644 --- a/src/librustc_driver/test.rs +++ b/src/librustc_driver/test.rs @@ -253,7 +253,18 @@ impl<'a, 'tcx> Env<'a, 'tcx> { output_ty: Ty<'tcx>) -> Ty<'tcx> { - ty::mk_ctor_fn(self.infcx.tcx, input_tys, output_ty) + let input_args = input_tys.iter().map(|ty| *ty).collect(); + ty::mk_bare_fn(self.infcx.tcx, + None, + ty::BareFnTy { + unsafety: ast::Unsafety::Normal, + abi: abi::Rust, + sig: ty::Binder(ty::FnSig { + inputs: input_args, + output: ty::FnConverging(output_ty), + variadic: false + }) + }) } pub fn t_nil(&self) -> Ty<'tcx> { diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs index 8b2c7f3a78a2..3be40aed57ac 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/trans/base.rs @@ -282,7 +282,7 @@ pub fn kind_for_unboxed_closure(ccx: &CrateContext, closure_id: ast::DefId) pub fn decl_rust_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_ty: Ty<'tcx>, name: &str) -> ValueRef { let (inputs, output, abi, env) = match fn_ty.sty { - ty::ty_bare_fn(ref f) => { + ty::ty_bare_fn(_, ref f) => { (f.sig.0.inputs.clone(), f.sig.0.output, f.abi, None) } ty::ty_closure(ref f) => { @@ -956,7 +956,7 @@ pub fn trans_external_path<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, did: ast::DefId, t: Ty<'tcx>) -> ValueRef { let name = csearch::get_symbol(&ccx.sess().cstore, did); match t.sty { - ty::ty_bare_fn(ref fn_ty) => { + ty::ty_bare_fn(_, ref fn_ty) => { match ccx.sess().target.target.adjust_abi(fn_ty.abi) { Rust | RustCall => { get_extern_rust_fn(ccx, t, name.as_slice(), did) @@ -2015,7 +2015,7 @@ pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, let tcx = ccx.tcx(); let result_ty = match ctor_ty.sty { - ty::ty_bare_fn(ref bft) => bft.sig.0.output.unwrap(), + ty::ty_bare_fn(_, ref bft) => bft.sig.0.output.unwrap(), _ => ccx.sess().bug( format!("trans_enum_variant_constructor: \ unexpected ctor return type {}", @@ -2087,7 +2087,7 @@ fn trans_enum_variant_or_tuple_like_struct<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx let ctor_ty = ctor_ty.subst(ccx.tcx(), param_substs); let result_ty = match ctor_ty.sty { - ty::ty_bare_fn(ref bft) => bft.sig.0.output, + ty::ty_bare_fn(_, ref bft) => bft.sig.0.output, _ => ccx.sess().bug( format!("trans_enum_variant_or_tuple_like_struct: \ unexpected ctor return type {}", @@ -2422,7 +2422,7 @@ fn register_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, node_type: Ty<'tcx>) -> ValueRef { match node_type.sty { - ty::ty_bare_fn(ref f) => { + ty::ty_bare_fn(_, ref f) => { assert!(f.abi == Rust || f.abi == RustCall); } _ => panic!("expected bare rust fn") @@ -2439,7 +2439,7 @@ pub fn get_fn_llvm_attributes<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_ty: Ty< let (fn_sig, abi, has_env) = match fn_ty.sty { ty::ty_closure(ref f) => (f.sig.clone(), f.abi, true), - ty::ty_bare_fn(ref f) => (f.sig.clone(), f.abi, false), + ty::ty_bare_fn(_, ref f) => (f.sig.clone(), f.abi, false), ty::ty_unboxed_closure(closure_did, _, ref substs) => { let unboxed_closures = ccx.tcx().unboxed_closures.borrow(); let ref function_type = (*unboxed_closures)[closure_did] @@ -2468,7 +2468,7 @@ pub fn get_fn_llvm_attributes<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_ty: Ty< _ => ccx.sess().bug("expected tuple'd inputs") } }, - ty::ty_bare_fn(_) if abi == RustCall => { + ty::ty_bare_fn(..) if abi == RustCall => { let mut inputs = vec![fn_sig.0.inputs[0]]; match fn_sig.0.inputs[1].sty { diff --git a/src/librustc_trans/trans/callee.rs b/src/librustc_trans/trans/callee.rs index 7e7a6dfc48ad..b60c75d305ca 100644 --- a/src/librustc_trans/trans/callee.rs +++ b/src/librustc_trans/trans/callee.rs @@ -18,9 +18,11 @@ pub use self::AutorefArg::*; pub use self::CalleeData::*; pub use self::CallArgs::*; -use back::abi; +use arena::TypedArena; +use back::{abi,link}; use session; use llvm::{ValueRef}; +use llvm::get_param; use llvm; use metadata::csearch; use middle::def; @@ -157,7 +159,7 @@ fn trans<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, expr: &ast::Expr) } } def::DefFn(did, _) if match expr_ty.sty { - ty::ty_bare_fn(ref f) => f.abi == synabi::RustIntrinsic, + ty::ty_bare_fn(_, ref f) => f.abi == synabi::RustIntrinsic, _ => false } => { let substs = node_id_substs(bcx, ExprId(ref_expr.id)); @@ -274,15 +276,16 @@ pub fn trans_fn_pointer_shim<'a, 'tcx>( // Construct the "tuply" version of `bare_fn_ty`. It takes two arguments: `self`, // which is the fn pointer, and `args`, which is the arguments tuple. - let (input_tys, output_ty) = + let (opt_def_id, input_tys, output_ty) = match bare_fn_ty.sty { - ty::ty_bare_fn(ty::BareFnTy { unsafety: ast::Unsafety::Normal, + ty::ty_bare_fn(opt_def_id, + ty::BareFnTy { unsafety: ast::Unsafety::Normal, abi: synabi::Rust, sig: ty::Binder(ty::FnSig { inputs: ref input_tys, output: output_ty, variadic: false })}) => { - (input_tys, output_ty) + (opt_def_id, input_tys, output_ty) } _ => { @@ -292,6 +295,7 @@ pub fn trans_fn_pointer_shim<'a, 'tcx>( }; let tuple_input_ty = ty::mk_tup(tcx, input_tys.to_vec()); let tuple_fn_ty = ty::mk_bare_fn(tcx, + opt_def_id, ty::BareFnTy { unsafety: ast::Unsafety::Normal, abi: synabi::RustCall, sig: ty::Binder(ty::FnSig { @@ -654,7 +658,7 @@ pub fn trans_call_inner<'a, 'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>, let mut bcx = callee.bcx; let (abi, ret_ty) = match callee_ty.sty { - ty::ty_bare_fn(ref f) => (f.abi, f.sig.0.output), + ty::ty_bare_fn(_, ref f) => (f.abi, f.sig.0.output), ty::ty_closure(ref f) => (f.abi, f.sig.0.output), _ => panic!("expected bare rust fn or closure in trans_call_inner") }; diff --git a/src/librustc_trans/trans/debuginfo.rs b/src/librustc_trans/trans/debuginfo.rs index 51e3a83f81f5..b03934af016b 100644 --- a/src/librustc_trans/trans/debuginfo.rs +++ b/src/librustc_trans/trans/debuginfo.rs @@ -430,7 +430,7 @@ impl<'tcx> TypeMap<'tcx> { trait_data.principal.substs(), &mut unique_type_id); }, - ty::ty_bare_fn(ty::BareFnTy{ unsafety, abi, ref sig } ) => { + ty::ty_bare_fn(_, ty::BareFnTy{ unsafety, abi, ref sig } ) => { if unsafety == ast::Unsafety::Unsafe { unique_type_id.push_str("unsafe "); } @@ -2997,7 +2997,7 @@ fn type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, } } } - ty::ty_bare_fn(ref barefnty) => { + ty::ty_bare_fn(_, ref barefnty) => { subroutine_type_metadata(cx, unique_type_id, &barefnty.sig, usage_site_span) } ty::ty_closure(ref closurety) => { @@ -3814,7 +3814,7 @@ fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, push_item_name(cx, trait_data.principal.def_id(), false, output); push_type_params(cx, trait_data.principal.substs(), output); }, - ty::ty_bare_fn(ty::BareFnTy{ unsafety, abi, ref sig } ) => { + ty::ty_bare_fn(_, ty::BareFnTy{ unsafety, abi, ref sig } ) => { if unsafety == ast::Unsafety::Unsafe { output.push_str("unsafe "); } diff --git a/src/librustc_trans/trans/foreign.rs b/src/librustc_trans/trans/foreign.rs index d07203199305..e50d645afd8d 100644 --- a/src/librustc_trans/trans/foreign.rs +++ b/src/librustc_trans/trans/foreign.rs @@ -228,7 +228,7 @@ pub fn trans_native_call<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, ccx.tn().val_to_string(llretptr)); let (fn_abi, fn_sig) = match callee_ty.sty { - ty::ty_bare_fn(ref fn_ty) => (fn_ty.abi, fn_ty.sig.clone()), + ty::ty_bare_fn(_, ref fn_ty) => (fn_ty.abi, fn_ty.sig.clone()), _ => ccx.sess().bug("trans_native_call called on non-function type") }; let llsig = foreign_signature(ccx, &fn_sig, passed_arg_tys.as_slice()); @@ -479,7 +479,7 @@ pub fn decl_rust_fn_with_foreign_abi<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, let tys = foreign_types_for_fn_ty(ccx, t); let llfn_ty = lltype_for_fn_from_foreign_types(ccx, &tys); let cconv = match t.sty { - ty::ty_bare_fn(ref fn_ty) => { + ty::ty_bare_fn(_, ref fn_ty) => { llvm_calling_convention(ccx, fn_ty.abi) } _ => panic!("expected bare fn in decl_rust_fn_with_foreign_abi") @@ -502,7 +502,7 @@ pub fn register_rust_fn_with_foreign_abi(ccx: &CrateContext, let llfn_ty = lltype_for_fn_from_foreign_types(ccx, &tys); let t = ty::node_id_to_type(ccx.tcx(), node_id); let cconv = match t.sty { - ty::ty_bare_fn(ref fn_ty) => { + ty::ty_bare_fn(_, ref fn_ty) => { llvm_calling_convention(ccx, fn_ty.abi) } _ => panic!("expected bare fn in register_rust_fn_with_foreign_abi") @@ -556,7 +556,7 @@ pub fn trans_rust_fn_with_foreign_abi<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, // Compute the type that the function would have if it were just a // normal Rust function. This will be the type of the wrappee fn. match t.sty { - ty::ty_bare_fn(ref f) => { + ty::ty_bare_fn(_, ref f) => { assert!(f.abi != Rust && f.abi != RustIntrinsic); } _ => { @@ -849,7 +849,7 @@ fn foreign_types_for_id<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn foreign_types_for_fn_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ty: Ty<'tcx>) -> ForeignTypes<'tcx> { let fn_sig = match ty.sty { - ty::ty_bare_fn(ref fn_ty) => fn_ty.sig.clone(), + ty::ty_bare_fn(_, ref fn_ty) => fn_ty.sig.clone(), _ => ccx.sess().bug("foreign_types_for_fn_ty called on non-function type") }; let llsig = foreign_signature(ccx, &fn_sig, fn_sig.0.inputs.as_slice()); diff --git a/src/librustc_trans/trans/glue.rs b/src/librustc_trans/trans/glue.rs index e3c1e4b12bfd..905ce3c61dce 100644 --- a/src/librustc_trans/trans/glue.rs +++ b/src/librustc_trans/trans/glue.rs @@ -226,7 +226,7 @@ fn trans_struct_drop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, let fty = ty::lookup_item_type(bcx.tcx(), dtor_did).ty.subst(bcx.tcx(), substs); let self_ty = match fty.sty { - ty::ty_bare_fn(ref f) => { + ty::ty_bare_fn(_, ref f) => { assert!(f.sig.0.inputs.len() == 1); f.sig.0.inputs[0] } diff --git a/src/librustc_trans/trans/intrinsic.rs b/src/librustc_trans/trans/intrinsic.rs index a6f7c849f4d9..f676608bbcc7 100644 --- a/src/librustc_trans/trans/intrinsic.rs +++ b/src/librustc_trans/trans/intrinsic.rs @@ -150,7 +150,7 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, let tcx = bcx.tcx(); let ret_ty = match callee_ty.sty { - ty::ty_bare_fn(ref f) => f.sig.0.output, + ty::ty_bare_fn(_, ref f) => f.sig.0.output, _ => panic!("expected bare_fn in trans_intrinsic_call") }; let foreign_item = tcx.map.expect_foreign_item(node); diff --git a/src/librustc_trans/trans/meth.rs b/src/librustc_trans/trans/meth.rs index de7adda6bfd7..85f819b915c8 100644 --- a/src/librustc_trans/trans/meth.rs +++ b/src/librustc_trans/trans/meth.rs @@ -477,7 +477,7 @@ pub fn trans_trait_callee_from_llval<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, debug!("(translating trait callee) loading method"); // Replace the self type (&Self or Box) with an opaque pointer. let llcallee_ty = match callee_ty.sty { - ty::ty_bare_fn(ref f) if f.abi == Rust || f.abi == RustCall => { + ty::ty_bare_fn(_, ref f) if f.abi == Rust || f.abi == RustCall => { type_of_rust_fn(ccx, Some(Type::i8p(ccx)), f.sig.0.inputs.slice_from(1), diff --git a/src/librustc_trans/trans/type_of.rs b/src/librustc_trans/trans/type_of.rs index 2801e0ccead6..89b728370ca4 100644 --- a/src/librustc_trans/trans/type_of.rs +++ b/src/librustc_trans/trans/type_of.rs @@ -364,7 +364,7 @@ pub fn type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) -> Type { ty::ty_str => Type::i8(cx), - ty::ty_bare_fn(_) => { + ty::ty_bare_fn(..) => { type_of_fn_from_ty(cx, t).ptr_to() } ty::ty_closure(_) => { diff --git a/src/librustc_typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs index 10801563f61d..d3b518ec2e3a 100644 --- a/src/librustc_typeck/check/method/confirm.rs +++ b/src/librustc_typeck/check/method/confirm.rs @@ -466,7 +466,7 @@ impl<'a,'tcx> ConfirmContext<'a,'tcx> { fn fixup_derefs_on_method_receiver_if_necessary(&self, method_callee: &MethodCallee) { let sig = match method_callee.ty.sty { - ty::ty_bare_fn(ref f) => f.sig.clone(), + ty::ty_bare_fn(_, ref f) => f.sig.clone(), ty::ty_closure(ref f) => f.sig.clone(), _ => return, }; diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 7078f1e58c75..8198e64a973d 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -399,7 +399,7 @@ fn check_bare_fn<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, let fty = fty.subst(ccx.tcx, ¶m_env.free_substs); match fty.sty { - ty::ty_bare_fn(ref fn_ty) => { + ty::ty_bare_fn(_, ref fn_ty) => { let inh = Inherited::new(ccx.tcx, param_env); let fcx = check_fn(ccx, fn_ty.unsafety, id, &fn_ty.sig, decl, id, body, &inh); @@ -2049,7 +2049,7 @@ fn try_overloaded_call<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, // Bail out if the callee is a bare function or a closure. We check those // manually. match structurally_resolved_type(fcx, callee.span, callee_type).sty { - ty::ty_bare_fn(_) | ty::ty_closure(_) => return false, + ty::ty_bare_fn(..) | ty::ty_closure(_) => return false, _ => {} } @@ -2499,7 +2499,7 @@ fn check_method_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, ty::FnConverging(ty::mk_err()) } else { match method_fn_ty.sty { - ty::ty_bare_fn(ref fty) => { + ty::ty_bare_fn(_, ref fty) => { // HACK(eddyb) ignore self in the definition (see above). check_argument_types(fcx, sp, @@ -2927,7 +2927,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>, }); let fn_sig = match fn_ty.sty { - ty::ty_bare_fn(ty::BareFnTy {ref sig, ..}) | + ty::ty_bare_fn(_, ty::BareFnTy {ref sig, ..}) | ty::ty_closure(box ty::ClosureTy {ref sig, ..}) => sig, _ => { fcx.type_error_message(call_expr.span, |actual| { diff --git a/src/librustc_typeck/check/wf.rs b/src/librustc_typeck/check/wf.rs index 24d7bf5031e4..a2fb44fff796 100644 --- a/src/librustc_typeck/check/wf.rs +++ b/src/librustc_typeck/check/wf.rs @@ -355,7 +355,7 @@ impl<'cx,'tcx> TypeFolder<'tcx> for BoundsChecker<'cx,'tcx> { self.fold_substs(substs); } - ty::ty_bare_fn(ty::BareFnTy{sig: ref fn_sig, ..}) | + ty::ty_bare_fn(_, ty::BareFnTy{sig: ref fn_sig, ..}) | ty::ty_closure(box ty::ClosureTy{sig: ref fn_sig, ..}) => { self.binding_count += 1; diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index c30293e4765c..368658cb1c51 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -257,7 +257,7 @@ fn check_start_fn_ty(ccx: &CrateCtxt, let tcx = ccx.tcx; let start_t = ty::node_id_to_type(tcx, start_id); match start_t.sty { - ty::ty_bare_fn(_) => { + ty::ty_bare_fn(..) => { match tcx.map.find(start_id) { Some(ast_map::NodeItem(it)) => { match it.node { diff --git a/src/librustc_typeck/variance.rs b/src/librustc_typeck/variance.rs index ef0d1bc3859f..e241be3e55c9 100644 --- a/src/librustc_typeck/variance.rs +++ b/src/librustc_typeck/variance.rs @@ -814,12 +814,13 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { } } - ty::ty_bare_fn(ty::BareFnTy { ref sig, .. }) | + ty::ty_bare_fn(_, ty::BareFnTy { ref sig, .. }) | ty::ty_closure(box ty::ClosureTy { ref sig, store: ty::UniqTraitStore, .. - }) => { + }) => + { self.add_constraints_from_sig(sig, variance); } diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index d0988af1cb47..2bc93ade7774 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -176,7 +176,7 @@ pub fn build_external_trait(cx: &DocContext, tcx: &ty::ctxt, fn build_external_function(cx: &DocContext, tcx: &ty::ctxt, did: ast::DefId) -> clean::Function { let t = ty::lookup_item_type(tcx, did); let (decl, style) = match t.ty.sty { - ty::ty_bare_fn(ref f) => ((did, &f.sig).clean(cx), f.unsafety), + ty::ty_bare_fn(_, ref f) => ((did, &f.sig).clean(cx), f.unsafety), _ => panic!("bad function"), }; clean::Function { diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index ac688784f926..6e7a750d8b3f 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1360,7 +1360,7 @@ impl<'tcx> Clean for ty::Ty<'tcx> { mutability: mt.mutbl.clean(cx), type_: box mt.ty.clean(cx), }, - ty::ty_bare_fn(ref fty) => BareFunction(box BareFunctionDecl { + ty::ty_bare_fn(_, ref fty) => BareFunction(box BareFunctionDecl { unsafety: fty.unsafety, generics: Generics { lifetimes: Vec::new(),