diff options
| -rw-r--r-- | src/librustc_trans/adt.rs | 56 | ||||
| -rw-r--r-- | src/librustc_trans/asm.rs | 10 | ||||
| -rw-r--r-- | src/librustc_trans/base.rs | 76 | ||||
| -rw-r--r-- | src/librustc_trans/builder.rs | 2 | ||||
| -rw-r--r-- | src/librustc_trans/callee.rs | 22 | ||||
| -rw-r--r-- | src/librustc_trans/cleanup.rs | 4 | ||||
| -rw-r--r-- | src/librustc_trans/common.rs | 46 | ||||
| -rw-r--r-- | src/librustc_trans/debuginfo/mod.rs | 14 | ||||
| -rw-r--r-- | src/librustc_trans/glue.rs | 69 | ||||
| -rw-r--r-- | src/librustc_trans/intrinsic.rs | 70 | ||||
| -rw-r--r-- | src/librustc_trans/meth.rs | 8 | ||||
| -rw-r--r-- | src/librustc_trans/mir/analyze.rs | 18 | ||||
| -rw-r--r-- | src/librustc_trans/mir/block.rs | 16 | ||||
| -rw-r--r-- | src/librustc_trans/mir/constant.rs | 4 | ||||
| -rw-r--r-- | src/librustc_trans/mir/lvalue.rs | 10 | ||||
| -rw-r--r-- | src/librustc_trans/mir/mod.rs | 22 | ||||
| -rw-r--r-- | src/librustc_trans/mir/operand.rs | 16 | ||||
| -rw-r--r-- | src/librustc_trans/mir/rvalue.rs | 22 | ||||
| -rw-r--r-- | src/librustc_trans/mir/statement.rs | 10 | ||||
| -rw-r--r-- | src/librustc_trans/tvec.rs | 6 |
20 files changed, 256 insertions, 245 deletions
diff --git a/src/librustc_trans/adt.rs b/src/librustc_trans/adt.rs index 5482200f13e..4a06982cd37 100644 --- a/src/librustc_trans/adt.rs +++ b/src/librustc_trans/adt.rs @@ -302,11 +302,12 @@ fn struct_llfields<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, fields: &Vec<Ty<'tcx>> /// Obtain a representation of the discriminant sufficient to translate /// destructuring; this may or may not involve the actual discriminant. -pub fn trans_switch<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - t: Ty<'tcx>, - scrutinee: ValueRef, - range_assert: bool) - -> (BranchKind, Option<ValueRef>) { +pub fn trans_switch<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, + t: Ty<'tcx>, + scrutinee: ValueRef, + range_assert: bool +) -> (BranchKind, Option<ValueRef>) { let l = bcx.ccx().layout_of(t); match *l { layout::CEnum { .. } | layout::General { .. } | @@ -329,10 +330,13 @@ pub fn is_discr_signed<'tcx>(l: &layout::Layout) -> bool { } /// Obtain the actual discriminant of a value. -pub fn trans_get_discr<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, t: Ty<'tcx>, - scrutinee: ValueRef, cast_to: Option<Type>, - range_assert: bool) - -> ValueRef { +pub fn trans_get_discr<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, + t: Ty<'tcx>, + scrutinee: ValueRef, + cast_to: Option<Type>, + range_assert: bool +) -> ValueRef { let (def, substs) = match t.sty { ty::TyAdt(ref def, substs) if def.adt_kind() == AdtKind::Enum => (def, substs), _ => bug!("{} is not an enum", t) @@ -411,8 +415,7 @@ fn load_discr(bcx: &BlockAndBuilder, ity: layout::Integer, ptr: ValueRef, min: u /// discriminant-like value returned by `trans_switch`. /// /// This should ideally be less tightly tied to `_match`. -pub fn trans_case<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, t: Ty<'tcx>, value: Disr) - -> ValueRef { +pub fn trans_case<'a, 'tcx>(bcx: &BlockAndBuilder<'a, 'tcx>, t: Ty<'tcx>, value: Disr) -> ValueRef { let l = bcx.ccx().layout_of(t); match *l { layout::CEnum { discr, .. } @@ -432,8 +435,9 @@ pub fn trans_case<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, t: Ty<'tcx>, va /// Set the discriminant for a new value of the given case of the given /// representation. -pub fn trans_set_discr<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, t: Ty<'tcx>, - val: ValueRef, to: Disr) { +pub fn trans_set_discr<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, t: Ty<'tcx>, val: ValueRef, to: Disr +) { let l = bcx.ccx().layout_of(t); match *l { layout::CEnum{ discr, min, max, .. } => { @@ -480,7 +484,7 @@ pub fn trans_set_discr<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, t: Ty<'tcx } } -fn target_sets_discr_via_memset<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>) -> bool { +fn target_sets_discr_via_memset<'a, 'tcx>(bcx: &BlockAndBuilder<'a, 'tcx>) -> bool { bcx.sess().target.target.arch == "arm" || bcx.sess().target.target.arch == "aarch64" } @@ -493,11 +497,13 @@ fn assert_discr_in_range(min: Disr, max: Disr, discr: Disr) { } /// Access a field, at a point when the value's case is known. -pub fn trans_field_ptr<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - t: Ty<'tcx>, - val: MaybeSizedValue, - discr: Disr, ix: usize) - -> ValueRef { +pub fn trans_field_ptr<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, + t: Ty<'tcx>, + val: MaybeSizedValue, + discr: Disr, + ix: usize +) -> ValueRef { let l = bcx.ccx().layout_of(t); debug!("trans_field_ptr on {} represented as {:#?}", t, l); // Note: if this ever needs to generate conditionals (e.g., if we @@ -553,9 +559,15 @@ pub fn trans_field_ptr<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, } } -fn struct_field_ptr<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - st: &layout::Struct, fields: &Vec<Ty<'tcx>>, val: MaybeSizedValue, - ix: usize, needs_cast: bool) -> ValueRef { +fn struct_field_ptr<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, + st: &layout::Struct, + fields: &Vec<Ty<'tcx>>, + val: MaybeSizedValue, + ix: usize, + needs_cast: bool +) -> ValueRef { + let ccx = bcx.ccx(); let fty = fields[ix]; let ccx = bcx.ccx(); let ll_fty = type_of::in_memory_type_of(ccx, fty); diff --git a/src/librustc_trans/asm.rs b/src/librustc_trans/asm.rs index 4c4f8cf67d2..6ec198aa247 100644 --- a/src/librustc_trans/asm.rs +++ b/src/librustc_trans/asm.rs @@ -24,10 +24,12 @@ use syntax::ast::AsmDialect; use libc::{c_uint, c_char}; // Take an inline assembly expression and splat it out via LLVM -pub fn trans_inline_asm<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - ia: &hir::InlineAsm, - outputs: Vec<(ValueRef, Ty<'tcx>)>, - mut inputs: Vec<ValueRef>) { +pub fn trans_inline_asm<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, + ia: &hir::InlineAsm, + outputs: Vec<(ValueRef, Ty<'tcx>)>, + mut inputs: Vec<ValueRef> +) { let mut ext_constraints = vec![]; let mut output_types = vec![]; diff --git a/src/librustc_trans/base.rs b/src/librustc_trans/base.rs index 21fd3e02047..d7efd2ce0a8 100644 --- a/src/librustc_trans/base.rs +++ b/src/librustc_trans/base.rs @@ -160,13 +160,14 @@ pub fn bin_op_to_fcmp_predicate(op: hir::BinOp_) -> llvm::RealPredicate { } } -pub fn compare_simd_types<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - lhs: ValueRef, - rhs: ValueRef, - t: Ty<'tcx>, - ret_ty: Type, - op: hir::BinOp_) - -> ValueRef { +pub fn compare_simd_types<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, + lhs: ValueRef, + rhs: ValueRef, + t: Ty<'tcx>, + ret_ty: Type, + op: hir::BinOp_ +) -> ValueRef { let signed = match t.sty { ty::TyFloat(_) => { let cmp = bin_op_to_fcmp_predicate(op); @@ -216,11 +217,12 @@ pub fn unsized_info<'ccx, 'tcx>(ccx: &CrateContext<'ccx, 'tcx>, } /// Coerce `src` to `dst_ty`. `src_ty` must be a thin pointer. -pub fn unsize_thin_ptr<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - src: ValueRef, - src_ty: Ty<'tcx>, - dst_ty: Ty<'tcx>) - -> (ValueRef, ValueRef) { +pub fn unsize_thin_ptr<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, + src: ValueRef, + src_ty: Ty<'tcx>, + dst_ty: Ty<'tcx> +) -> (ValueRef, ValueRef) { debug!("unsize_thin_ptr: {:?} => {:?}", src_ty, dst_ty); match (&src_ty.sty, &dst_ty.sty) { (&ty::TyBox(a), &ty::TyBox(b)) | @@ -240,11 +242,11 @@ pub fn unsize_thin_ptr<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, /// Coerce `src`, which is a reference to a value of type `src_ty`, /// to a value of type `dst_ty` and store the result in `dst` -pub fn coerce_unsized_into<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - src: ValueRef, - src_ty: Ty<'tcx>, - dst: ValueRef, - dst_ty: Ty<'tcx>) { +pub fn coerce_unsized_into<'a, 'tcx>(bcx: &BlockAndBuilder<'a, 'tcx>, + src: ValueRef, + src_ty: Ty<'tcx>, + dst: ValueRef, + dst_ty: Ty<'tcx>) { match (&src_ty.sty, &dst_ty.sty) { (&ty::TyBox(..), &ty::TyBox(..)) | (&ty::TyRef(..), &ty::TyRef(..)) | @@ -420,9 +422,7 @@ pub fn load_ty<'a, 'tcx>(b: &Builder<'a, 'tcx>, ptr: ValueRef, t: Ty<'tcx>) -> V /// Helper for storing values in memory. Does the necessary conversion if the in-memory type /// differs from the type used for SSA values. -pub fn store_ty<'blk, 'tcx>( - cx: &BlockAndBuilder<'blk, 'tcx>, v: ValueRef, dst: ValueRef, t: Ty<'tcx> -) { +pub fn store_ty<'a, 'tcx>(cx: &BlockAndBuilder<'a, 'tcx>, v: ValueRef, dst: ValueRef, t: Ty<'tcx>) { debug!("store_ty: {:?} : {:?} <- {:?}", Value(dst), t, Value(v)); if common::type_is_fat_ptr(cx.tcx(), t) { @@ -434,23 +434,19 @@ pub fn store_ty<'blk, 'tcx>( } } -pub fn store_fat_ptr<'blk, 'tcx>(cx: &BlockAndBuilder<'blk, 'tcx>, - data: ValueRef, - extra: ValueRef, - dst: ValueRef, - _ty: Ty<'tcx>) { +pub fn store_fat_ptr<'a, 'tcx>(cx: &BlockAndBuilder<'a, 'tcx>, + data: ValueRef, + extra: ValueRef, + dst: ValueRef, + _ty: Ty<'tcx>) { // FIXME: emit metadata cx.store(data, get_dataptr(cx, dst)); cx.store(extra, get_meta(cx, dst)); } pub fn load_fat_ptr<'a, 'tcx>( - b: &Builder<'a, 'tcx>, - src: ValueRef, - t: Ty<'tcx>) - -> (ValueRef, ValueRef) -{ - + b: &Builder<'a, 'tcx>, src: ValueRef, t: Ty<'tcx> +) -> (ValueRef, ValueRef) { let ptr = get_dataptr(b, src); let ptr = if t.is_region_ptr() || t.is_unique() { b.load_nonnull(ptr) @@ -511,7 +507,7 @@ impl Lifetime { } } -pub fn call_memcpy<'bcx, 'tcx>(b: &Builder<'bcx, 'tcx>, +pub fn call_memcpy<'a, 'tcx>(b: &Builder<'a, 'tcx>, dst: ValueRef, src: ValueRef, n_bytes: ValueRef, @@ -528,8 +524,8 @@ pub fn call_memcpy<'bcx, 'tcx>(b: &Builder<'bcx, 'tcx>, b.call(memcpy, &[dst_ptr, src_ptr, size, align, volatile], None); } -pub fn memcpy_ty<'blk, 'tcx>( - bcx: &BlockAndBuilder<'blk, 'tcx>, dst: ValueRef, src: ValueRef, t: Ty<'tcx> +pub fn memcpy_ty<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, dst: ValueRef, src: ValueRef, t: Ty<'tcx> ) { let ccx = bcx.ccx(); @@ -550,7 +546,7 @@ pub fn memcpy_ty<'blk, 'tcx>( } } -pub fn call_memset<'bcx, 'tcx>(b: &Builder<'bcx, 'tcx>, +pub fn call_memset<'a, 'tcx>(b: &Builder<'a, 'tcx>, ptr: ValueRef, fill_byte: ValueRef, size: ValueRef, @@ -563,22 +559,20 @@ pub fn call_memset<'bcx, 'tcx>(b: &Builder<'bcx, 'tcx>, b.call(llintrinsicfn, &[ptr, fill_byte, size, align, volatile], None) } -pub fn alloc_ty<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - ty: Ty<'tcx>, - name: &str) -> ValueRef { +pub fn alloc_ty<'a, 'tcx>(bcx: &BlockAndBuilder<'a, 'tcx>, ty: Ty<'tcx>, name: &str) -> ValueRef { assert!(!ty.has_param_types()); bcx.fcx().alloca(type_of::type_of(bcx.ccx(), ty), name) } -impl<'blk, 'tcx> FunctionContext<'blk, 'tcx> { +impl<'a, 'tcx> FunctionContext<'a, 'tcx> { /// Ties up the llstaticallocas -> llloadenv -> lltop edges, /// and builds the return block. - pub fn finish(&'blk self, ret_cx: &BlockAndBuilder<'blk, 'tcx>) { + pub fn finish(&'a self, ret_cx: &BlockAndBuilder<'a, 'tcx>) { self.build_return_block(ret_cx); } // Builds the return block for a function. - pub fn build_return_block(&self, ret_cx: &BlockAndBuilder<'blk, 'tcx>) { + pub fn build_return_block(&self, ret_cx: &BlockAndBuilder<'a, 'tcx>) { if self.llretslotptr.is_none() || self.fn_ty.ret.is_indirect() { return ret_cx.ret_void(); } diff --git a/src/librustc_trans/builder.rs b/src/librustc_trans/builder.rs index b023ff6ea24..136d1aad31a 100644 --- a/src/librustc_trans/builder.rs +++ b/src/librustc_trans/builder.rs @@ -30,7 +30,7 @@ pub struct Builder<'a, 'tcx: 'a> { pub ccx: &'a CrateContext<'a, 'tcx>, } -impl<'blk, 'tcx> Drop for Builder<'blk, 'tcx> { +impl<'a, 'tcx> Drop for Builder<'a, 'tcx> { fn drop(&mut self) { unsafe { llvm::LLVMDisposeBuilder(self.llbuilder); diff --git a/src/librustc_trans/callee.rs b/src/librustc_trans/callee.rs index bfb7a833009..23351e01df8 100644 --- a/src/librustc_trans/callee.rs +++ b/src/librustc_trans/callee.rs @@ -189,10 +189,12 @@ impl<'tcx> Callee<'tcx> { /// For non-lang items, `dest` is always Some, and hence the result is written /// into memory somewhere. Nonetheless we return the actual return value of the /// function. - pub fn call<'a, 'blk>(self, bcx: &BlockAndBuilder<'blk, 'tcx>, - args: &[ValueRef], - dest: Option<ValueRef>, - lpad: Option<&'blk llvm::OperandBundleDef>) { + pub fn call<'a>(self, + bcx: &BlockAndBuilder<'a, 'tcx>, + args: &[ValueRef], + dest: Option<ValueRef>, + lpad: Option<&'a llvm::OperandBundleDef> + ) { trans_call_inner(bcx, self, args, dest, lpad) } @@ -647,11 +649,13 @@ fn get_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, // ______________________________________________________________________ // Translating calls -fn trans_call_inner<'a, 'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - callee: Callee<'tcx>, - args: &[ValueRef], - dest: Option<ValueRef>, - lpad: Option<&'blk llvm::OperandBundleDef>) { +fn trans_call_inner<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, + callee: Callee<'tcx>, + args: &[ValueRef], + dest: Option<ValueRef>, + lpad: Option<&'a llvm::OperandBundleDef> +) { // Introduce a temporary cleanup scope that will contain cleanups // for the arguments while they are being evaluated. The purpose // this cleanup is to ensure that, should a panic occur while diff --git a/src/librustc_trans/cleanup.rs b/src/librustc_trans/cleanup.rs index 8a9283442cb..ee02fe1d7f5 100644 --- a/src/librustc_trans/cleanup.rs +++ b/src/librustc_trans/cleanup.rs @@ -43,7 +43,7 @@ pub struct DropValue<'tcx> { } impl<'tcx> DropValue<'tcx> { - fn trans<'blk>(&self, funclet: Option<&'blk Funclet>, bcx: &BlockAndBuilder<'blk, 'tcx>) { + fn trans<'a>(&self, funclet: Option<&'a Funclet>, bcx: &BlockAndBuilder<'a, 'tcx>) { glue::call_drop_glue(bcx, self.val, self.ty, self.skip_dtor, funclet) } } @@ -93,7 +93,7 @@ impl PartialEq for UnwindKind { } } -impl<'blk, 'tcx> FunctionContext<'blk, 'tcx> { +impl<'a, 'tcx> FunctionContext<'a, 'tcx> { /// Schedules a (deep) drop of `val`, which is a pointer to an instance of `ty` pub fn schedule_drop_mem(&self, val: ValueRef, ty: Ty<'tcx>) -> CleanupScope<'tcx> { if !self.type_needs_drop(ty) { return CleanupScope::noop(); } diff --git a/src/librustc_trans/common.rs b/src/librustc_trans/common.rs index 3fe9d64d575..123e0609f06 100644 --- a/src/librustc_trans/common.rs +++ b/src/librustc_trans/common.rs @@ -480,7 +480,7 @@ impl<'a, 'tcx> Drop for FunctionContext<'a, 'tcx> { } #[must_use] -pub struct BlockAndBuilder<'blk, 'tcx: 'blk> { +pub struct BlockAndBuilder<'a, 'tcx: 'a> { // The BasicBlockRef returned from a call to // llvm::LLVMAppendBasicBlock(llfn, name), which adds a basic // block to the function pointed to by llfn. We insert @@ -490,13 +490,13 @@ pub struct BlockAndBuilder<'blk, 'tcx: 'blk> { // The function context for the function to which this block is // attached. - fcx: &'blk FunctionContext<'blk, 'tcx>, + fcx: &'a FunctionContext<'a, 'tcx>, - builder: Builder<'blk, 'tcx>, + builder: Builder<'a, 'tcx>, } -impl<'blk, 'tcx> BlockAndBuilder<'blk, 'tcx> { - pub fn new(llbb: BasicBlockRef, fcx: &'blk FunctionContext<'blk, 'tcx>) -> Self { +impl<'a, 'tcx> BlockAndBuilder<'a, 'tcx> { + pub fn new(llbb: BasicBlockRef, fcx: &'a FunctionContext<'a, 'tcx>) -> Self { let builder = Builder::with_ccx(fcx.ccx); // Set the builder's position to this block's end. builder.position_at_end(llbb); @@ -512,7 +512,7 @@ impl<'blk, 'tcx> BlockAndBuilder<'blk, 'tcx> { } pub fn at_start<F, R>(&self, f: F) -> R - where F: FnOnce(&BlockAndBuilder<'blk, 'tcx>) -> R + where F: FnOnce(&BlockAndBuilder<'a, 'tcx>) -> R { self.position_at_start(self.llbb); let r = f(self); @@ -520,16 +520,16 @@ impl<'blk, 'tcx> BlockAndBuilder<'blk, 'tcx> { r } - pub fn ccx(&self) -> &'blk CrateContext<'blk, 'tcx> { + pub fn ccx(&self) -> &'a CrateContext<'a, 'tcx> { self.fcx.ccx } - pub fn fcx(&self) -> &'blk FunctionContext<'blk, 'tcx> { + pub fn fcx(&self) -> &'a FunctionContext<'a, 'tcx> { self.fcx } - pub fn tcx(&self) -> TyCtxt<'blk, 'tcx, 'tcx> { + pub fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.fcx.ccx.tcx() } - pub fn sess(&self) -> &'blk Session { + pub fn sess(&self) -> &'a Session { self.fcx.ccx.sess() } @@ -538,8 +538,8 @@ impl<'blk, 'tcx> BlockAndBuilder<'blk, 'tcx> { } } -impl<'blk, 'tcx> Deref for BlockAndBuilder<'blk, 'tcx> { - type Target = Builder<'blk, 'tcx>; +impl<'a, 'tcx> Deref for BlockAndBuilder<'a, 'tcx> { + type Target = Builder<'a, 'tcx>; fn deref(&self) -> &Self::Target { &self.builder } @@ -896,19 +896,20 @@ pub fn langcall(tcx: TyCtxt, // all shifts). For 32- and 64-bit types, this matches the semantics // of Java. (See related discussion on #1877 and #10183.) -pub fn build_unchecked_lshift<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - lhs: ValueRef, - rhs: ValueRef) -> ValueRef { +pub fn build_unchecked_lshift<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, + lhs: ValueRef, + rhs: ValueRef +) -> ValueRef { let rhs = base::cast_shift_expr_rhs(bcx, hir::BinOp_::BiShl, lhs, rhs); // #1877, #10183: Ensure that input is always valid let rhs = shift_mask_rhs(bcx, rhs); bcx.shl(lhs, rhs) } -pub fn build_unchecked_rshift<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - lhs_t: Ty<'tcx>, - lhs: ValueRef, - rhs: ValueRef) -> ValueRef { +pub fn build_unchecked_rshift<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, lhs_t: Ty<'tcx>, lhs: ValueRef, rhs: ValueRef +) -> ValueRef { let rhs = base::cast_shift_expr_rhs(bcx, hir::BinOp_::BiShr, lhs, rhs); // #1877, #10183: Ensure that input is always valid let rhs = shift_mask_rhs(bcx, rhs); @@ -920,14 +921,13 @@ pub fn build_unchecked_rshift<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, } } -fn shift_mask_rhs<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - rhs: ValueRef) -> ValueRef { +fn shift_mask_rhs<'a, 'tcx>(bcx: &BlockAndBuilder<'a, 'tcx>, rhs: ValueRef) -> ValueRef { let rhs_llty = val_ty(rhs); bcx.and(rhs, shift_mask_val(bcx, rhs_llty, rhs_llty, false)) } -pub fn shift_mask_val<'blk, 'tcx>( - bcx: &BlockAndBuilder<'blk, 'tcx>, +pub fn shift_mask_val<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, llty: Type, mask_llty: Type, invert: bool diff --git a/src/librustc_trans/debuginfo/mod.rs b/src/librustc_trans/debuginfo/mod.rs index 9cc2c72648f..c130c4bc993 100644 --- a/src/librustc_trans/debuginfo/mod.rs +++ b/src/librustc_trans/debuginfo/mod.rs @@ -431,13 +431,13 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, } } -pub fn declare_local<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - variable_name: ast::Name, - variable_type: Ty<'tcx>, - scope_metadata: DIScope, - variable_access: VariableAccess, - variable_kind: VariableKind, - span: Span) { +pub fn declare_local<'a, 'tcx>(bcx: &BlockAndBuilder<'a, 'tcx>, + variable_name: ast::Name, + variable_type: Ty<'tcx>, + scope_metadata: DIScope, + variable_access: VariableAccess, + variable_kind: VariableKind, + span: Span) { let cx: &CrateContext = bcx.ccx(); let file = span_start(cx, span).file; diff --git a/src/librustc_trans/glue.rs b/src/librustc_trans/glue.rs index dca5907b8af..26445efe06c 100644 --- a/src/librustc_trans/glue.rs +++ b/src/librustc_trans/glue.rs @@ -36,18 +36,20 @@ use cleanup::CleanupScope; use syntax_pos::DUMMY_SP; -pub fn trans_exchange_free_dyn<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - v: ValueRef, - size: ValueRef, - align: ValueRef) { +pub fn trans_exchange_free_dyn<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, + v: ValueRef, + size: ValueRef, + align: ValueRef +) { let def_id = langcall(bcx.tcx(), None, "", ExchangeFreeFnLangItem); let args = [bcx.pointercast(v, Type::i8p(bcx.ccx())), size, align]; Callee::def(bcx.ccx(), def_id, bcx.tcx().intern_substs(&[])).call(&bcx, &args, None, None) } -pub fn trans_exchange_free_ty<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - ptr: ValueRef, - content_ty: Ty<'tcx>) { +pub fn trans_exchange_free_ty<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, ptr: ValueRef, content_ty: Ty<'tcx> +) { assert!(type_is_sized(bcx.ccx().tcx(), content_ty)); let sizing_type = sizing_type_of(bcx.ccx(), content_ty); let content_size = llsize_of_alloc(bcx.ccx(), sizing_type); @@ -104,16 +106,16 @@ pub fn get_drop_glue_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, t: Ty<'tcx>) -> } } -fn drop_ty<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, v: ValueRef, t: Ty<'tcx>) { +fn drop_ty<'a, 'tcx>(bcx: &BlockAndBuilder<'a, 'tcx>, v: ValueRef, t: Ty<'tcx>) { call_drop_glue(bcx, v, t, false, None) } -pub fn call_drop_glue<'blk, 'tcx>( - bcx: &BlockAndBuilder<'blk, 'tcx>, +pub fn call_drop_glue<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, v: ValueRef, t: Ty<'tcx>, skip_dtor: bool, - funclet: Option<&'blk Funclet>, + funclet: Option<&'a Funclet>, ) { // NB: v is an *alias* of type t here, not a direct value. debug!("call_drop_glue(t={:?}, skip_dtor={})", t, skip_dtor); @@ -181,8 +183,7 @@ fn get_drop_glue_core<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, g: DropGlueKind<'t } } -pub fn implement_drop_glue<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, - g: DropGlueKind<'tcx>) { +pub fn implement_drop_glue<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, g: DropGlueKind<'tcx>) { let tcx = ccx.tcx(); assert_eq!(g.ty(), get_drop_glue_type(tcx, g.ty())); let (llfn, fn_ty) = ccx.drop_glues().borrow().get(&g).unwrap().clone(); @@ -203,11 +204,11 @@ pub fn implement_drop_glue<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fcx.finish(&bcx); } -fn trans_custom_dtor<'blk, 'tcx>(mut bcx: BlockAndBuilder<'blk, 'tcx>, - t: Ty<'tcx>, - v0: ValueRef, - shallow_drop: bool) - -> BlockAndBuilder<'blk, 'tcx> +fn trans_custom_dtor<'a, 'tcx>(mut bcx: BlockAndBuilder<'a, 'tcx>, + t: Ty<'tcx>, + v0: ValueRef, + shallow_drop: bool) + -> BlockAndBuilder<'a, 'tcx> { debug!("trans_custom_dtor t: {}", t); let tcx = bcx.tcx(); @@ -265,9 +266,9 @@ fn trans_custom_dtor<'blk, 'tcx>(mut bcx: BlockAndBuilder<'blk, 'tcx>, bcx } -pub fn size_and_align_of_dst<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - t: Ty<'tcx>, info: ValueRef) - -> (ValueRef, ValueRef) { +pub fn size_and_align_of_dst<'a, 'tcx>(bcx: &BlockAndBuilder<'a, 'tcx>, + t: Ty<'tcx>, info: ValueRef) + -> (ValueRef, ValueRef) { debug!("calculate size of DST: {}; with lost info: {:?}", t, Value(info)); if type_is_sized(bcx.tcx(), t) { @@ -372,10 +373,10 @@ pub fn size_and_align_of_dst<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, } } -fn make_drop_glue<'blk, 'tcx>(bcx: BlockAndBuilder<'blk, 'tcx>, - v0: ValueRef, - g: DropGlueKind<'tcx>) - -> BlockAndBuilder<'blk, 'tcx> { +fn make_drop_glue<'a, 'tcx>(bcx: BlockAndBuilder<'a, 'tcx>, + v0: ValueRef, + g: DropGlueKind<'tcx>) + -> BlockAndBuilder<'a, 'tcx> { let t = g.ty(); let skip_dtor = match g { DropGlueKind::Ty(_) => false, DropGlueKind::TyContents(_) => true }; @@ -454,15 +455,15 @@ fn make_drop_glue<'blk, 'tcx>(bcx: BlockAndBuilder<'blk, 'tcx>, } // Iterates through the elements of a structural type, dropping them. -fn drop_structural_ty<'blk, 'tcx>(cx: BlockAndBuilder<'blk, 'tcx>, - av: ValueRef, - t: Ty<'tcx>) - -> BlockAndBuilder<'blk, 'tcx> { - fn iter_variant<'blk, 'tcx>(cx: &BlockAndBuilder<'blk, 'tcx>, - t: Ty<'tcx>, - av: adt::MaybeSizedValue, - variant: &'tcx ty::VariantDef, - substs: &Substs<'tcx>) { +fn drop_structural_ty<'a, 'tcx>(cx: BlockAndBuilder<'a, 'tcx>, + av: ValueRef, + t: Ty<'tcx>) + -> BlockAndBuilder<'a, 'tcx> { + fn iter_variant<'a, 'tcx>(cx: &BlockAndBuilder<'a, 'tcx>, + t: Ty<'tcx>, + av: adt::MaybeSizedValue, + variant: &'tcx ty::VariantDef, + substs: &Substs<'tcx>) { let tcx = cx.tcx(); for (i, field) in variant.fields.iter().enumerate() { let arg = monomorphize::field_ty(tcx, substs, field); diff --git a/src/librustc_trans/intrinsic.rs b/src/librustc_trans/intrinsic.rs index 17a04c14cba..caa4e75f0b0 100644 --- a/src/librustc_trans/intrinsic.rs +++ b/src/librustc_trans/intrinsic.rs @@ -84,12 +84,12 @@ fn get_simple_intrinsic(ccx: &CrateContext, name: &str) -> Option<ValueRef> { /// Remember to add all intrinsics here, in librustc_typeck/check/mod.rs, /// and in libcore/intrinsics.rs; if you need access to any llvm intrinsics, /// add them to librustc_trans/trans/context.rs -pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - callee_ty: Ty<'tcx>, - fn_ty: &FnType, - llargs: &[ValueRef], - llresult: ValueRef, - span: Span) { +pub fn trans_intrinsic_call<'a, 'tcx>(bcx: &BlockAndBuilder<'a, 'tcx>, + callee_ty: Ty<'tcx>, + fn_ty: &FnType, + llargs: &[ValueRef], + llresult: ValueRef, + span: Span) { let fcx = bcx.fcx(); let ccx = fcx.ccx; let tcx = bcx.tcx(); @@ -537,11 +537,11 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, // qux` to be converted into `foo, bar, baz, qux`, integer // arguments to be truncated as needed and pointers to be // cast. - fn modify_as_needed<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - t: &intrinsics::Type, - arg_type: Ty<'tcx>, - llarg: ValueRef) - -> Vec<ValueRef> + fn modify_as_needed<'a, 'tcx>(bcx: &BlockAndBuilder<'a, 'tcx>, + t: &intrinsics::Type, + arg_type: Ty<'tcx>, + llarg: ValueRef) + -> Vec<ValueRef> { match *t { intrinsics::Type::Aggregate(true, ref contents) => { @@ -642,14 +642,14 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, } } -fn copy_intrinsic<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - allow_overlap: bool, - volatile: bool, - tp_ty: Ty<'tcx>, - dst: ValueRef, - src: ValueRef, - count: ValueRef) - -> ValueRef { +fn copy_intrinsic<'a, 'tcx>(bcx: &BlockAndBuilder<'a, 'tcx>, + allow_overlap: bool, + volatile: bool, + tp_ty: Ty<'tcx>, + dst: ValueRef, + src: ValueRef, + count: ValueRef) + -> ValueRef { let ccx = bcx.ccx(); let lltp_ty = type_of::type_of(ccx, tp_ty); let align = C_i32(ccx, type_of::align_of(ccx, tp_ty) as i32); @@ -677,8 +677,8 @@ fn copy_intrinsic<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, None) } -fn memset_intrinsic<'blk, 'tcx>( - bcx: &BlockAndBuilder<'blk, 'tcx>, +fn memset_intrinsic<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, volatile: bool, ty: Ty<'tcx>, dst: ValueRef, @@ -693,8 +693,8 @@ fn memset_intrinsic<'blk, 'tcx>( call_memset(bcx, dst, val, bcx.mul(size, count), align, volatile) } -fn try_intrinsic<'blk, 'tcx>( - bcx: &BlockAndBuilder<'blk, 'tcx>, +fn try_intrinsic<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, func: ValueRef, data: ValueRef, local_ptr: ValueRef, @@ -717,11 +717,11 @@ fn try_intrinsic<'blk, 'tcx>( // instructions are meant to work for all targets, as of the time of this // writing, however, LLVM does not recommend the usage of these new instructions // as the old ones are still more optimized. -fn trans_msvc_try<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - func: ValueRef, - data: ValueRef, - local_ptr: ValueRef, - dest: ValueRef) { +fn trans_msvc_try<'a, 'tcx>(bcx: &BlockAndBuilder<'a, 'tcx>, + func: ValueRef, + data: ValueRef, + local_ptr: ValueRef, + dest: ValueRef) { let llfn = get_rust_try_fn(bcx.fcx(), &mut |bcx| { let ccx = bcx.ccx(); @@ -820,11 +820,11 @@ fn trans_msvc_try<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, // function calling it, and that function may already have other personality // functions in play. By calling a shim we're guaranteed that our shim will have // the right personality function. -fn trans_gnu_try<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - func: ValueRef, - data: ValueRef, - local_ptr: ValueRef, - dest: ValueRef) { +fn trans_gnu_try<'a, 'tcx>(bcx: &BlockAndBuilder<'a, 'tcx>, + func: ValueRef, + data: ValueRef, + local_ptr: ValueRef, + dest: ValueRef) { let llfn = get_rust_try_fn(bcx.fcx(), &mut |bcx| { let ccx = bcx.ccx(); @@ -928,8 +928,8 @@ fn span_invalid_monomorphization_error(a: &Session, b: Span, c: &str) { span_err!(a, b, E0511, "{}", c); } -fn generic_simd_intrinsic<'blk, 'tcx, 'a>( - bcx: &BlockAndBuilder<'blk, 'tcx>, +fn generic_simd_intrinsic<'a, 'tcx>( + bcx: &BlockAndBuilder<'a, 'tcx>, name: &str, callee_ty: Ty<'tcx>, llargs: &[ValueRef], diff --git a/src/librustc_trans/meth.rs b/src/librustc_trans/meth.rs index 88b18ecae4c..b8901231f1c 100644 --- a/src/librustc_trans/meth.rs +++ b/src/librustc_trans/meth.rs @@ -28,10 +28,10 @@ use rustc::ty; const VTABLE_OFFSET: usize = 3; /// Extracts a method from a trait object's vtable, at the specified index. -pub fn get_virtual_method<'blk, 'tcx>(bcx: &BlockAndBuilder<'blk, 'tcx>, - llvtable: ValueRef, - vtable_index: usize) - -> ValueRef { +pub fn get_virtual_method<'a, 'tcx>(bcx: &BlockAndBuilder<'a, 'tcx>, + llvtable: ValueRef, + vtable_index: usize) + -> ValueRef { // Load the data pointer from the object. debug!("get_virtual_method(vtable_index={}, llvtable={:?})", vtable_index, Value(llvtable)); diff --git a/src/librustc_trans/mir/analyze.rs b/src/librustc_trans/mir/analyze.rs index 4b6998d0505..21b021cacc9 100644 --- a/src/librustc_trans/mir/analyze.rs +++ b/src/librustc_trans/mir/analyze.rs @@ -20,8 +20,7 @@ use common::{self, BlockAndBuilder}; use glue; use super::rvalue; -pub fn lvalue_locals<'bcx, 'tcx>(bcx: &BlockAndBuilder<'bcx,'tcx>, - mir: &mir::Mir<'tcx>) -> BitVector { +pub fn lvalue_locals<'a, 'tcx>(bcx: &BlockAndBuilder<'a, 'tcx>, mir: &mir::Mir<'tcx>) -> BitVector { let mut analyzer = LocalAnalyzer::new(mir, &bcx); analyzer.visit_mir(mir); @@ -55,17 +54,16 @@ pub fn lvalue_locals<'bcx, 'tcx>(bcx: &BlockAndBuilder<'bcx,'tcx>, analyzer.lvalue_locals } -struct LocalAnalyzer<'mir, 'bcx: 'mir, 'tcx: 'bcx> { +struct LocalAnalyzer<'mir, 'a: 'mir, 'tcx: 'a> { mir: &'mir mir::Mir<'tcx>, - bcx: &'mir BlockAndBuilder<'bcx, 'tcx>, + bcx: &'mir BlockAndBuilder<'a, 'tcx>, lvalue_locals: BitVector, seen_assigned: BitVector } -impl<'mir, 'bcx, 'tcx> LocalAnalyzer<'mir, 'bcx, 'tcx> { - fn new(mir: &'mir mir::Mir<'tcx>, - bcx: &'mir BlockAndBuilder<'bcx, 'tcx>) - -> LocalAnalyzer<'mir, 'bcx, 'tcx> { +impl<'mir, 'a, 'tcx> LocalAnalyzer<'mir, 'a, 'tcx> { + fn new(mir: &'mir mir::Mir<'tcx>, bcx: &'mir BlockAndBuilder<'a, 'tcx>) + -> LocalAnalyzer<'mir, 'a, 'tcx> { LocalAnalyzer { mir: mir, bcx: bcx, @@ -86,7 +84,7 @@ impl<'mir, 'bcx, 'tcx> LocalAnalyzer<'mir, 'bcx, 'tcx> { } } -impl<'mir, 'bcx, 'tcx> Visitor<'tcx> for LocalAnalyzer<'mir, 'bcx, 'tcx> { +impl<'mir, 'a, 'tcx> Visitor<'tcx> for LocalAnalyzer<'mir, 'a, 'tcx> { fn visit_assign(&mut self, block: mir::BasicBlock, lvalue: &mir::Lvalue<'tcx>, @@ -199,7 +197,7 @@ pub enum CleanupKind { Internal { funclet: mir::BasicBlock } } -pub fn cleanup_kinds<'bcx,'tcx>(mir: &mir::Mir<'tcx>) -> IndexVec<mir::BasicBlock, CleanupKind> { +pub fn cleanup_kinds<'a, 'tcx>(mir: &mir::Mir<'tcx>) -> IndexVec<mir::BasicBlock, CleanupKind> { fn discover_masters<'tcx>(result: &mut IndexVec<mir::BasicBlock, CleanupKind>, mir: &mir::Mir<'tcx>) { for (bb, data) in mir.basic_blocks().iter_enumerated() { diff --git a/src/librustc_trans/mir/block.rs b/src/librustc_trans/mir/block.rs index 4d78170f845..99b598baf84 100644 --- a/src/librustc_trans/mir/block.rs +++ b/src/librustc_trans/mir/block.rs @@ -40,7 +40,7 @@ use super::operand::OperandValue::{Pair, Ref, Immediate}; use std::ptr; -impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { +impl<'a, 'tcx> MirContext<'a, 'tcx> { pub fn trans_block(&mut self, bb: mir::BasicBlock, funclets: &IndexVec<mir::BasicBlock, Option<Funclet>>) { let mut bcx = self.build_block(bb); @@ -669,7 +669,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { } fn trans_argument(&mut self, - bcx: &BlockAndBuilder<'bcx, 'tcx>, + bcx: &BlockAndBuilder<'a, 'tcx>, op: OperandRef<'tcx>, llargs: &mut Vec<ValueRef>, fn_ty: &FnType, @@ -745,7 +745,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { } fn trans_arguments_untupled(&mut self, - bcx: &BlockAndBuilder<'bcx, 'tcx>, + bcx: &BlockAndBuilder<'a, 'tcx>, operand: &mir::Operand<'tcx>, llargs: &mut Vec<ValueRef>, fn_ty: &FnType, @@ -821,7 +821,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { } - fn get_personality_slot(&mut self, bcx: &BlockAndBuilder<'bcx, 'tcx>) -> ValueRef { + fn get_personality_slot(&mut self, bcx: &BlockAndBuilder<'a, 'tcx>) -> ValueRef { let ccx = bcx.ccx(); if let Some(slot) = self.llpersonalityslot { slot @@ -897,11 +897,11 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { }) } - fn build_block(&self, bb: mir::BasicBlock) -> BlockAndBuilder<'bcx, 'tcx> { + fn build_block(&self, bb: mir::BasicBlock) -> BlockAndBuilder<'a, 'tcx> { BlockAndBuilder::new(self.blocks[bb], self.fcx) } - fn make_return_dest(&mut self, bcx: &BlockAndBuilder<'bcx, 'tcx>, + fn make_return_dest(&mut self, bcx: &BlockAndBuilder<'a, 'tcx>, dest: &mir::Lvalue<'tcx>, fn_ret_ty: &ArgType, llargs: &mut Vec<ValueRef>, is_intrinsic: bool) -> ReturnDest { // If the return is ignored, we can just return a do-nothing ReturnDest @@ -946,7 +946,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { } } - fn trans_transmute(&mut self, bcx: &BlockAndBuilder<'bcx, 'tcx>, + fn trans_transmute(&mut self, bcx: &BlockAndBuilder<'a, 'tcx>, src: &mir::Operand<'tcx>, dst: LvalueRef<'tcx>) { let mut val = self.trans_operand(bcx, src); if let ty::TyFnDef(def_id, substs, _) = val.ty.sty { @@ -974,7 +974,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { // Stores the return value of a function call into it's final location. fn store_return(&mut self, - bcx: &BlockAndBuilder<'bcx, 'tcx>, + bcx: &BlockAndBuilder<'a, 'tcx>, dest: ReturnDest, ret_ty: ArgType, op: OperandRef<'tcx>) { diff --git a/src/librustc_trans/mir/constant.rs b/src/librustc_trans/mir/constant.rs index 8143190a58d..03ee6b136a4 100644 --- a/src/librustc_trans/mir/constant.rs +++ b/src/librustc_trans/mir/constant.rs @@ -945,9 +945,9 @@ pub fn const_scalar_checked_binop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { +impl<'a, 'tcx> MirContext<'a, 'tcx> { pub fn trans_constant(&mut self, - bcx: &BlockAndBuilder<'bcx, 'tcx>, + bcx: &BlockAndBuilder<'a, 'tcx>, constant: &mir::Constant<'tcx>) -> Const<'tcx> { diff --git a/src/librustc_trans/mir/lvalue.rs b/src/librustc_trans/mir/lvalue.rs index c6be7eaa775..5bfe614f45e 100644 --- a/src/librustc_trans/mir/lvalue.rs +++ b/src/librustc_trans/mir/lvalue.rs @@ -44,7 +44,7 @@ impl<'tcx> LvalueRef<'tcx> { LvalueRef { llval: llval, llextra: ptr::null_mut(), ty: lvalue_ty } } - pub fn alloca<'bcx>(bcx: &BlockAndBuilder<'bcx, 'tcx>, + pub fn alloca<'a>(bcx: &BlockAndBuilder<'a, 'tcx>, ty: Ty<'tcx>, name: &str) -> LvalueRef<'tcx> @@ -67,9 +67,9 @@ impl<'tcx> LvalueRef<'tcx> { } } -impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { +impl<'a, 'tcx> MirContext<'a, 'tcx> { pub fn trans_lvalue(&mut self, - bcx: &BlockAndBuilder<'bcx, 'tcx>, + bcx: &BlockAndBuilder<'a, 'tcx>, lvalue: &mir::Lvalue<'tcx>) -> LvalueRef<'tcx> { debug!("trans_lvalue(lvalue={:?})", lvalue); @@ -214,7 +214,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { // Perform an action using the given Lvalue. // If the Lvalue is an empty LocalRef::Operand, then a temporary stack slot // is created first, then used as an operand to update the Lvalue. - pub fn with_lvalue_ref<F, U>(&mut self, bcx: &BlockAndBuilder<'bcx, 'tcx>, + pub fn with_lvalue_ref<F, U>(&mut self, bcx: &BlockAndBuilder<'a, 'tcx>, lvalue: &mir::Lvalue<'tcx>, f: F) -> U where F: FnOnce(&mut Self, LvalueRef<'tcx>) -> U { @@ -255,7 +255,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { /// /// nmatsakis: is this still necessary? Not sure. fn prepare_index(&mut self, - bcx: &BlockAndBuilder<'bcx, 'tcx>, + bcx: &BlockAndBuilder<'a, 'tcx>, llindex: ValueRef) -> ValueRef { diff --git a/src/librustc_trans/mir/mod.rs b/src/librustc_trans/mir/mod.rs index 158e14c17aa..8a0e5e107a8 100644 --- a/src/librustc_trans/mir/mod.rs +++ b/src/librustc_trans/mir/mod.rs @@ -39,11 +39,11 @@ use rustc::mir::traversal; use self::operand::{OperandRef, OperandValue}; /// Master context for translating MIR. -pub struct MirContext<'bcx, 'tcx:'bcx> { - mir: &'bcx mir::Mir<'tcx>, +pub struct MirContext<'a, 'tcx:'a> { + mir: &'a mir::Mir<'tcx>, /// Function context - fcx: &'bcx common::FunctionContext<'bcx, 'tcx>, + fcx: &'a common::FunctionContext<'a, 'tcx>, /// When unwinding is initiated, we have to store this personality /// value somewhere so that we can load it and re-use it in the @@ -88,7 +88,7 @@ pub struct MirContext<'bcx, 'tcx:'bcx> { scopes: IndexVec<mir::VisibilityScope, debuginfo::MirDebugScope>, } -impl<'blk, 'tcx> MirContext<'blk, 'tcx> { +impl<'a, 'tcx> MirContext<'a, 'tcx> { pub fn debug_loc(&mut self, source_info: mir::SourceInfo) -> (DIScope, Span) { // Bail out if debug info emission is not enabled. match self.fcx.debug_context { @@ -152,7 +152,7 @@ enum LocalRef<'tcx> { } impl<'tcx> LocalRef<'tcx> { - fn new_operand<'bcx>(ccx: &CrateContext<'bcx, 'tcx>, + fn new_operand<'a>(ccx: &CrateContext<'a, 'tcx>, ty: ty::Ty<'tcx>) -> LocalRef<'tcx> { if common::type_is_zero_size(ccx, ty) { // Zero-size temporaries aren't always initialized, which @@ -178,7 +178,7 @@ impl<'tcx> LocalRef<'tcx> { /////////////////////////////////////////////////////////////////////////// -pub fn trans_mir<'blk, 'tcx: 'blk>(fcx: &'blk FunctionContext<'blk, 'tcx>, mir: &'blk Mir<'tcx>) { +pub fn trans_mir<'a, 'tcx: 'a>(fcx: &'a FunctionContext<'a, 'tcx>, mir: &'a Mir<'tcx>) { let bcx = fcx.get_entry_block(); // Analyze the temps to determine which must be lvalues @@ -309,11 +309,11 @@ pub fn trans_mir<'blk, 'tcx: 'blk>(fcx: &'blk FunctionContext<'blk, 'tcx>, mir: /// Produce, for each argument, a `ValueRef` pointing at the /// argument's value. As arguments are lvalues, these are always /// indirect. -fn arg_local_refs<'bcx, 'tcx>(bcx: &BlockAndBuilder<'bcx, 'tcx>, - mir: &mir::Mir<'tcx>, - scopes: &IndexVec<mir::VisibilityScope, debuginfo::MirDebugScope>, - lvalue_locals: &BitVector) - -> Vec<LocalRef<'tcx>> { +fn arg_local_refs<'a, 'tcx>(bcx: &BlockAndBuilder<'a, 'tcx>, + mir: &mir::Mir<'tcx>, + scopes: &IndexVec<mir::VisibilityScope, debuginfo::MirDebugScope>, + lvalue_locals: &BitVector) + -> Vec<LocalRef<'tcx>> { let fcx = bcx.fcx(); let tcx = bcx.tcx(); let mut idx = 0; diff --git a/src/librustc_trans/mir/operand.rs b/src/librustc_trans/mir/operand.rs index f52c0879462..c89eb9899d1 100644 --- a/src/librustc_trans/mir/operand.rs +++ b/src/librustc_trans/mir/operand.rs @@ -73,7 +73,7 @@ impl<'tcx> fmt::Debug for OperandRef<'tcx> { } } -impl<'bcx, 'tcx> OperandRef<'tcx> { +impl<'a, 'tcx> OperandRef<'tcx> { /// Asserts that this operand refers to a scalar and returns /// a reference to its value. pub fn immediate(self) -> ValueRef { @@ -85,7 +85,7 @@ impl<'bcx, 'tcx> OperandRef<'tcx> { /// If this operand is a Pair, we return an /// Immediate aggregate with the two values. - pub fn pack_if_pair(mut self, bcx: &BlockAndBuilder<'bcx, 'tcx>) + pub fn pack_if_pair(mut self, bcx: &BlockAndBuilder<'a, 'tcx>) -> OperandRef<'tcx> { if let OperandValue::Pair(a, b) = self.val { // Reconstruct the immediate aggregate. @@ -107,7 +107,7 @@ impl<'bcx, 'tcx> OperandRef<'tcx> { /// If this operand is a pair in an Immediate, /// we return a Pair with the two halves. - pub fn unpack_if_pair(mut self, bcx: &BlockAndBuilder<'bcx, 'tcx>) + pub fn unpack_if_pair(mut self, bcx: &BlockAndBuilder<'a, 'tcx>) -> OperandRef<'tcx> { if let OperandValue::Immediate(llval) = self.val { // Deconstruct the immediate aggregate. @@ -134,9 +134,9 @@ impl<'bcx, 'tcx> OperandRef<'tcx> { } } -impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { +impl<'a, 'tcx> MirContext<'a, 'tcx> { pub fn trans_load(&mut self, - bcx: &BlockAndBuilder<'bcx, 'tcx>, + bcx: &BlockAndBuilder<'a, 'tcx>, llval: ValueRef, ty: Ty<'tcx>) -> OperandRef<'tcx> @@ -165,7 +165,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { } pub fn trans_consume(&mut self, - bcx: &BlockAndBuilder<'bcx, 'tcx>, + bcx: &BlockAndBuilder<'a, 'tcx>, lvalue: &mir::Lvalue<'tcx>) -> OperandRef<'tcx> { @@ -217,7 +217,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { } pub fn trans_operand(&mut self, - bcx: &BlockAndBuilder<'bcx, 'tcx>, + bcx: &BlockAndBuilder<'a, 'tcx>, operand: &mir::Operand<'tcx>) -> OperandRef<'tcx> { @@ -242,7 +242,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { } pub fn store_operand(&mut self, - bcx: &BlockAndBuilder<'bcx, 'tcx>, + bcx: &BlockAndBuilder<'a, 'tcx>, lldest: ValueRef, operand: OperandRef<'tcx>) { debug!("store_operand: operand={:?}", operand); diff --git a/src/librustc_trans/mir/rvalue.rs b/src/librustc_trans/mir/rvalue.rs index d15598e76af..4a532924694 100644 --- a/src/librustc_trans/mir/rvalue.rs +++ b/src/librustc_trans/mir/rvalue.rs @@ -33,12 +33,12 @@ use super::constant::const_scalar_checked_binop; use super::operand::{OperandRef, OperandValue}; use super::lvalue::{LvalueRef}; -impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { +impl<'a, 'tcx> MirContext<'a, 'tcx> { pub fn trans_rvalue(&mut self, - bcx: BlockAndBuilder<'bcx, 'tcx>, + bcx: BlockAndBuilder<'a, 'tcx>, dest: LvalueRef<'tcx>, rvalue: &mir::Rvalue<'tcx>) - -> BlockAndBuilder<'bcx, 'tcx> + -> BlockAndBuilder<'a, 'tcx> { debug!("trans_rvalue(dest.llval={:?}, rvalue={:?})", Value(dest.llval), rvalue); @@ -175,9 +175,9 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { } pub fn trans_rvalue_operand(&mut self, - bcx: BlockAndBuilder<'bcx, 'tcx>, + bcx: BlockAndBuilder<'a, 'tcx>, rvalue: &mir::Rvalue<'tcx>) - -> (BlockAndBuilder<'bcx, 'tcx>, OperandRef<'tcx>) + -> (BlockAndBuilder<'a, 'tcx>, OperandRef<'tcx>) { assert!(rvalue_creates_operand(&self.mir, &bcx, rvalue), "cannot trans {:?} to operand", rvalue); @@ -483,7 +483,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { } pub fn trans_scalar_binop(&mut self, - bcx: &BlockAndBuilder<'bcx, 'tcx>, + bcx: &BlockAndBuilder<'a, 'tcx>, op: mir::BinOp, lhs: ValueRef, rhs: ValueRef, @@ -558,7 +558,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { } pub fn trans_fat_ptr_binop(&mut self, - bcx: &BlockAndBuilder<'bcx, 'tcx>, + bcx: &BlockAndBuilder<'a, 'tcx>, op: mir::BinOp, lhs_addr: ValueRef, lhs_extra: ValueRef, @@ -605,7 +605,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { } pub fn trans_scalar_checked_binop(&mut self, - bcx: &BlockAndBuilder<'bcx, 'tcx>, + bcx: &BlockAndBuilder<'a, 'tcx>, op: mir::BinOp, lhs: ValueRef, rhs: ValueRef, @@ -662,9 +662,9 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { } } -pub fn rvalue_creates_operand<'bcx, 'tcx>(_mir: &mir::Mir<'tcx>, - _bcx: &BlockAndBuilder<'bcx, 'tcx>, - rvalue: &mir::Rvalue<'tcx>) -> bool { +pub fn rvalue_creates_operand<'a, 'tcx>(_mir: &mir::Mir<'tcx>, + _bcx: &BlockAndBuilder<'a, 'tcx>, + rvalue: &mir::Rvalue<'tcx>) -> bool { match *rvalue { mir::Rvalue::Ref(..) | mir::Rvalue::Len(..) | diff --git a/src/librustc_trans/mir/statement.rs b/src/librustc_trans/mir/statement.rs index 6cc3f6aad9f..ddbefe43ce4 100644 --- a/src/librustc_trans/mir/statement.rs +++ b/src/librustc_trans/mir/statement.rs @@ -18,11 +18,11 @@ use super::LocalRef; use super::super::adt; use super::super::disr::Disr; -impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { +impl<'a, 'tcx> MirContext<'a, 'tcx> { pub fn trans_statement(&mut self, - bcx: BlockAndBuilder<'bcx, 'tcx>, + bcx: BlockAndBuilder<'a, 'tcx>, statement: &mir::Statement<'tcx>) - -> BlockAndBuilder<'bcx, 'tcx> { + -> BlockAndBuilder<'a, 'tcx> { debug!("trans_statement(statement={:?})", statement); let (scope, span) = self.debug_loc(statement.source_info); @@ -78,10 +78,10 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { } fn trans_storage_liveness(&self, - bcx: BlockAndBuilder<'bcx, 'tcx>, + bcx: BlockAndBuilder<'a, 'tcx>, lvalue: &mir::Lvalue<'tcx>, intrinsic: base::Lifetime) - -> BlockAndBuilder<'bcx, 'tcx> { + -> BlockAndBuilder<'a, 'tcx> { if let mir::Lvalue::Local(index) = *lvalue { if let LocalRef::Lvalue(tr_lval) = self.locals[index] { intrinsic.call(&bcx, tr_lval.llval); diff --git a/src/librustc_trans/tvec.rs b/src/librustc_trans/tvec.rs index 5b4cb74bf4f..c693a5ceabe 100644 --- a/src/librustc_trans/tvec.rs +++ b/src/librustc_trans/tvec.rs @@ -13,13 +13,13 @@ use llvm::ValueRef; use common::*; use rustc::ty::Ty; -pub fn slice_for_each<'blk, 'tcx, F>( - bcx: &BlockAndBuilder<'blk, 'tcx>, +pub fn slice_for_each<'a, 'tcx, F>( + bcx: &BlockAndBuilder<'a, 'tcx>, data_ptr: ValueRef, unit_ty: Ty<'tcx>, len: ValueRef, f: F -) -> BlockAndBuilder<'blk, 'tcx> where F: FnOnce(&BlockAndBuilder<'blk, 'tcx>, ValueRef) { +) -> BlockAndBuilder<'a, 'tcx> where F: FnOnce(&BlockAndBuilder<'a, 'tcx>, ValueRef) { // Special-case vectors with elements of size 0 so they don't go out of bounds (#9890) let zst = type_is_zero_size(bcx.ccx(), unit_ty); let add = |bcx: &BlockAndBuilder, a, b| if zst { |
