Skip to content

Commit d47ec57

Browse files
wildarchsaleemjaffer
authored andcommitted
Add param_env parameter to pointee_info_at.
An associated type ParamEnv has been added to TyLayoutMethods to facilitate this.
1 parent f1f9343 commit d47ec57

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/librustc/ty/layout.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,6 +1666,8 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
16661666
where C: LayoutOf<Ty = Ty<'tcx>> + HasTyCtxt<'tcx>,
16671667
C::TyLayout: MaybeResult<TyLayout<'tcx>>
16681668
{
1669+
type ParamEnv = ty::ParamEnv<'tcx>;
1670+
16691671
fn for_variant(this: TyLayout<'tcx>, cx: &C, variant_index: VariantIdx) -> TyLayout<'tcx> {
16701672
let details = match this.variants {
16711673
Variants::Single { index } if index == variant_index => this.details,
@@ -1837,6 +1839,7 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
18371839
this: TyLayout<'tcx>,
18381840
cx: &C,
18391841
offset: Size,
1842+
param_env: Self::ParamEnv,
18401843
) -> Option<PointeeInfo> {
18411844
match this.ty.sty {
18421845
ty::RawPtr(mt) if offset.bytes() == 0 => {
@@ -1850,7 +1853,7 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
18501853

18511854
ty::Ref(_, ty, mt) if offset.bytes() == 0 => {
18521855
let tcx = cx.tcx();
1853-
let is_freeze = ty.is_freeze(tcx, ty::ParamEnv::reveal_all(), DUMMY_SP);
1856+
let is_freeze = ty.is_freeze(tcx, param_env, DUMMY_SP);
18541857
let kind = match mt {
18551858
hir::MutImmutable => if is_freeze {
18561859
PointerKind::Frozen
@@ -1929,7 +1932,7 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
19291932
.and_then(|field| {
19301933
if ptr_end <= field_start + field.size {
19311934
// We found the right field, look inside it.
1932-
Self::pointee_info_at(field, cx, offset - field_start)
1935+
Self::pointee_info_at(field, cx, offset - field_start, param_env)
19331936
} else {
19341937
None
19351938
}

src/librustc_codegen_llvm/type_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> {
386386
return pointee;
387387
}
388388

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

391391
cx.pointee_infos.borrow_mut().insert((self.ty, offset), result);
392392
result

src/librustc_target/abi/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,8 @@ pub struct PointeeInfo {
933933
}
934934

935935
pub trait TyLayoutMethods<'a, C: LayoutOf<Ty = Self>>: Sized {
936+
type ParamEnv;
937+
936938
fn for_variant(
937939
this: TyLayout<'a, Self>,
938940
cx: &C,
@@ -942,7 +944,8 @@ pub trait TyLayoutMethods<'a, C: LayoutOf<Ty = Self>>: Sized {
942944
fn pointee_info_at(
943945
this: TyLayout<'a, Self>,
944946
cx: &C,
945-
offset: Size
947+
offset: Size,
948+
param_env: Self::ParamEnv,
946949
) -> Option<PointeeInfo>;
947950
}
948951

0 commit comments

Comments
 (0)