impl pointee_info_at in TyLayout.

This commit is contained in:
Daan de Graaf 2019-03-11 21:26:49 +01:00 committed by Saleem Jaffer
parent 7257fc34de
commit 82410e800f
2 changed files with 6 additions and 2 deletions

View File

@ -18,7 +18,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};
use rustc::ty::{self, Ty, Instance, ParamEnv};
use rustc::ty::layout::{self, PointerKind};
use libc::c_uint;
@ -484,7 +484,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
}
}
if let Some(pointee) = layout.pointee_info_at(cx, offset) {
if let Some(pointee) = layout.pointee_info_at(cx, offset, ParamEnv::reveal_all()) {
if let Some(kind) = pointee.safe {
attrs.pointee_size = pointee.size;
attrs.pointee_align = Some(pointee.align);

View File

@ -958,6 +958,10 @@ 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>
where Ty: TyLayoutMethods<'a, C>, C: LayoutOf<Ty = Ty> {
Ty::pointee_info_at(self, cx, offset, param_env)
}
}
impl<'a, Ty> TyLayout<'a, Ty> {