diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index dc9eaf5592e39..9a5db20229607 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -1677,8 +1677,6 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx> C::TyLayout: MaybeResult>, 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, @@ -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 { match this.ty.sty { ty::RawPtr(mt) if offset.bytes() == 0 => { @@ -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 @@ -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 } diff --git a/src/librustc_codegen_llvm/abi.rs b/src/librustc_codegen_llvm/abi.rs index 1be0736791451..70d184240fccd 100644 --- a/src/librustc_codegen_llvm/abi.rs +++ b/src/librustc_codegen_llvm/abi.rs @@ -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; @@ -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); diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index a225a11e94db0..7bf8f705ea8ad 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -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}; @@ -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() } } diff --git a/src/librustc_codegen_llvm/type_of.rs b/src/librustc_codegen_llvm/type_of.rs index 3f717754e327a..ff25ed9256613 100644 --- a/src/librustc_codegen_llvm/type_of.rs +++ b/src/librustc_codegen_llvm/type_of.rs @@ -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 diff --git a/src/librustc_target/abi/mod.rs b/src/librustc_target/abi/mod.rs index d69b4b6d2bdca..4b61057e5cf6c 100644 --- a/src/librustc_target/abi/mod.rs +++ b/src/librustc_target/abi/mod.rs @@ -933,8 +933,6 @@ pub struct PointeeInfo { } pub trait TyLayoutMethods<'a, C: LayoutOf>: Sized { - type ParamEnv; - fn for_variant( this: TyLayout<'a, Self>, cx: &C, @@ -945,7 +943,6 @@ pub trait TyLayoutMethods<'a, C: LayoutOf>: Sized { this: TyLayout<'a, Self>, cx: &C, offset: Size, - param_env: Self::ParamEnv, ) -> Option; } @@ -958,11 +955,9 @@ impl<'a, Ty> TyLayout<'a, Ty> { where Ty: TyLayoutMethods<'a, C>, C: LayoutOf { Ty::field(self, cx, i) } - pub fn pointee_info_at( - self, cx: &C, offset: Size, param_env: Ty::ParamEnv - ) -> Option + pub fn pointee_info_at(self, cx: &C, offset: Size) -> Option where Ty: TyLayoutMethods<'a, C>, C: LayoutOf { - Ty::pointee_info_at(self, cx, offset, param_env) + Ty::pointee_info_at(self, cx, offset) } }