diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2018-11-03 22:57:53 +0200 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2018-11-04 20:33:57 +0200 |
| commit | d00d42d079236893f0a8b2cd726c6957d96ec296 (patch) | |
| tree | 2f239aed2009e385798d2d85117132c058244c71 /src/librustc_codegen_llvm | |
| parent | ca4fa6f567b5d8a01f7db864539a43457119a45c (diff) | |
| download | rust-d00d42d079236893f0a8b2cd726c6957d96ec296.tar.gz rust-d00d42d079236893f0a8b2cd726c6957d96ec296.zip | |
rustc_target: pass contexts by reference, not value.
Diffstat (limited to 'src/librustc_codegen_llvm')
| -rw-r--r-- | src/librustc_codegen_llvm/context.rs | 12 | ||||
| -rw-r--r-- | src/librustc_codegen_llvm/mir/constant.rs | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index 241f7989e16..120449ae2af 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -446,29 +446,29 @@ impl<'b, 'tcx> CodegenCx<'b, 'tcx> { } } -impl ty::layout::HasDataLayout for &'a CodegenCx<'ll, 'tcx> { +impl ty::layout::HasDataLayout for CodegenCx<'ll, 'tcx> { fn data_layout(&self) -> &ty::layout::TargetDataLayout { &self.tcx.data_layout } } -impl HasTargetSpec for &'a CodegenCx<'ll, 'tcx> { +impl HasTargetSpec for CodegenCx<'ll, 'tcx> { fn target_spec(&self) -> &Target { &self.tcx.sess.target.target } } -impl ty::layout::HasTyCtxt<'tcx> for &'a CodegenCx<'ll, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'tcx, 'tcx> { +impl ty::layout::HasTyCtxt<'tcx> for CodegenCx<'ll, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'a, 'tcx, 'tcx> { self.tcx } } -impl LayoutOf for &'a CodegenCx<'ll, 'tcx> { +impl LayoutOf for CodegenCx<'ll, 'tcx> { type Ty = Ty<'tcx>; type TyLayout = TyLayout<'tcx>; - fn layout_of(self, ty: Ty<'tcx>) -> Self::TyLayout { + fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout { self.tcx.layout_of(ty::ParamEnv::reveal_all().and(ty)) .unwrap_or_else(|e| if let LayoutError::SizeOverflow(_) = e { self.sess().fatal(&e.to_string()) diff --git a/src/librustc_codegen_llvm/mir/constant.rs b/src/librustc_codegen_llvm/mir/constant.rs index 1f66ee36170..586a4907740 100644 --- a/src/librustc_codegen_llvm/mir/constant.rs +++ b/src/librustc_codegen_llvm/mir/constant.rs @@ -87,8 +87,8 @@ pub fn scalar_to_llvm( pub fn const_alloc_to_llvm(cx: &CodegenCx<'ll, '_>, alloc: &Allocation) -> &'ll Value { let mut llvals = Vec::with_capacity(alloc.relocations.len() + 1); - let layout = cx.data_layout(); - let pointer_size = layout.pointer_size.bytes() as usize; + let dl = cx.data_layout(); + let pointer_size = dl.pointer_size.bytes() as usize; let mut next_offset = 0; for &(offset, ((), alloc_id)) in alloc.relocations.iter() { @@ -99,7 +99,7 @@ pub fn const_alloc_to_llvm(cx: &CodegenCx<'ll, '_>, alloc: &Allocation) -> &'ll llvals.push(C_bytes(cx, &alloc.bytes[next_offset..offset])); } let ptr_offset = read_target_uint( - layout.endian, + dl.endian, &alloc.bytes[offset..(offset + pointer_size)], ).expect("const_alloc_to_llvm: could not read relocation pointer") as u64; llvals.push(scalar_to_llvm( |
