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,
this: TyLayout<'tcx>,
cx: &C,
offset: Size,
- param_env: Self::ParamEnv,
) -> Option<PointeeInfo> {
match this.ty.sty {
ty::RawPtr(mt) if offset.bytes() == 0 => {
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
.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
}
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;
}
}
- 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);
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};
impl<'tcx, 'll> HasParamEnv<'tcx> for CodegenCx<'ll, 'tcx> {
fn param_env(&self) -> ty::ParamEnv<'tcx> {
- panic!("asd")
+ ty::ParamEnv::reveal_all()
}
}
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
}
pub trait TyLayoutMethods<'a, C: LayoutOf<Ty = Self>>: Sized {
- type ParamEnv;
-
fn for_variant(
this: TyLayout<'a, Self>,
cx: &C,
this: TyLayout<'a, Self>,
cx: &C,
offset: Size,
- param_env: Self::ParamEnv,
) -> Option<PointeeInfo>;
}
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)
}
}