Skip to content

Commit

Permalink
removing param_env from pointee_info_at
Browse files Browse the repository at this point in the history
  • Loading branch information
saleemjaffer committed May 4, 2019
1 parent 94a4892 commit 80d5478
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
7 changes: 2 additions & 5 deletions src/librustc/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1677,8 +1677,6 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
C::TyLayout: MaybeResult<TyLayout<'tcx>>,
C: HasParamEnv<'tcx>
{
type ParamEnv = ty::ParamEnv<'tcx>;

fn for_variant(this: TyLayout<'tcx>, cx: &C, variant_index: VariantIdx) -> TyLayout<'tcx> {
let details = match this.variants {
Variants::Single { index } if index == variant_index => this.details,
Expand Down Expand Up @@ -1850,7 +1848,6 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
this: TyLayout<'tcx>,
cx: &C,
offset: Size,
param_env: Self::ParamEnv,
) -> Option<PointeeInfo> {
match this.ty.sty {
ty::RawPtr(mt) if offset.bytes() == 0 => {
Expand All @@ -1864,7 +1861,7 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>

ty::Ref(_, ty, mt) if offset.bytes() == 0 => {
let tcx = cx.tcx();
let is_freeze = ty.is_freeze(tcx, param_env, DUMMY_SP);
let is_freeze = ty.is_freeze(tcx, cx.param_env(), DUMMY_SP);
let kind = match mt {
hir::MutImmutable => if is_freeze {
PointerKind::Frozen
Expand Down Expand Up @@ -1945,7 +1942,7 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
.and_then(|field| {
if ptr_end <= field_start + field.size {
// We found the right field, look inside it.
field.pointee_info_at(cx, offset - field_start, param_env)
field.pointee_info_at(cx, offset - field_start)
} else {
None
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_llvm/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use rustc_target::abi::call::ArgType;
use rustc_codegen_ssa::traits::*;

use rustc_target::abi::{HasDataLayout, LayoutOf, Size, TyLayout, Abi as LayoutAbi};
use rustc::ty::{self, Ty, Instance, ParamEnv};
use rustc::ty::{self, Ty, Instance};
use rustc::ty::layout::{self, PointerKind};

use libc::c_uint;
Expand Down Expand Up @@ -478,7 +478,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
}
}

if let Some(pointee) = layout.pointee_info_at(cx, offset, ParamEnv::reveal_all()) {
if let Some(pointee) = layout.pointee_info_at(cx, offset) {
if let Some(kind) = pointee.safe {
attrs.pointee_size = pointee.size;
attrs.pointee_align = Some(pointee.align);
Expand Down
6 changes: 4 additions & 2 deletions src/librustc_codegen_llvm/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ use rustc_data_structures::small_c_str::SmallCStr;
use rustc::mir::mono::Stats;
use rustc::session::config::{self, DebugInfo};
use rustc::session::Session;
use rustc::ty::layout::{LayoutError, LayoutOf, PointeeInfo, Size, TyLayout, VariantIdx, HasParamEnv};
use rustc::ty::layout::{
LayoutError, LayoutOf, PointeeInfo, Size, TyLayout, VariantIdx, HasParamEnv
};
use rustc::ty::{self, Ty, TyCtxt};
use rustc::util::nodemap::FxHashMap;
use rustc_target::spec::{HasTargetSpec, Target};
Expand Down Expand Up @@ -864,6 +866,6 @@ impl LayoutOf for CodegenCx<'ll, 'tcx> {

impl<'tcx, 'll> HasParamEnv<'tcx> for CodegenCx<'ll, 'tcx> {
fn param_env(&self) -> ty::ParamEnv<'tcx> {
panic!("asd")
ty::ParamEnv::reveal_all()
}
}
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/type_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> {
return pointee;
}

let result = Ty::pointee_info_at(*self, cx, offset, ty::ParamEnv::reveal_all());
let result = Ty::pointee_info_at(*self, cx, offset);

cx.pointee_infos.borrow_mut().insert((self.ty, offset), result);
result
Expand Down
9 changes: 2 additions & 7 deletions src/librustc_target/abi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -933,8 +933,6 @@ pub struct PointeeInfo {
}

pub trait TyLayoutMethods<'a, C: LayoutOf<Ty = Self>>: Sized {
type ParamEnv;

fn for_variant(
this: TyLayout<'a, Self>,
cx: &C,
Expand All @@ -945,7 +943,6 @@ pub trait TyLayoutMethods<'a, C: LayoutOf<Ty = Self>>: Sized {
this: TyLayout<'a, Self>,
cx: &C,
offset: Size,
param_env: Self::ParamEnv,
) -> Option<PointeeInfo>;
}

Expand All @@ -958,11 +955,9 @@ impl<'a, Ty> TyLayout<'a, Ty> {
where Ty: TyLayoutMethods<'a, C>, C: LayoutOf<Ty = Ty> {
Ty::field(self, cx, i)
}
pub fn pointee_info_at<C>(
self, cx: &C, offset: Size, param_env: Ty::ParamEnv
) -> Option<PointeeInfo>
pub fn pointee_info_at<C>(self, cx: &C, offset: Size) -> Option<PointeeInfo>
where Ty: TyLayoutMethods<'a, C>, C: LayoutOf<Ty = Ty> {
Ty::pointee_info_at(self, cx, offset, param_env)
Ty::pointee_info_at(self, cx, offset)
}
}

Expand Down

0 comments on commit 80d5478

Please sign in to comment.