]> git.lizzy.rs Git - rust.git/commitdiff
removing param_env from pointee_info_at
authorSaleem Jaffer <ssaleem1992@gmail.com>
Sat, 4 May 2019 12:36:40 +0000 (18:06 +0530)
committerSaleem Jaffer <ssaleem1992@gmail.com>
Sat, 4 May 2019 12:36:40 +0000 (18:06 +0530)
src/librustc/ty/layout.rs
src/librustc_codegen_llvm/abi.rs
src/librustc_codegen_llvm/context.rs
src/librustc_codegen_llvm/type_of.rs
src/librustc_target/abi/mod.rs

index dc9eaf5592e39ebce08becf62825f7c084749654..9a5db202296070682b88fb104100b7ac79e9b2f9 100644 (file)
@@ -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,
@@ -1850,7 +1848,6 @@ fn pointee_info_at(
         this: TyLayout<'tcx>,
         cx: &C,
         offset: Size,
-        param_env: Self::ParamEnv,
     ) -> Option<PointeeInfo> {
         match this.ty.sty {
             ty::RawPtr(mt) if offset.bytes() == 0 => {
@@ -1864,7 +1861,7 @@ fn pointee_info_at(
 
             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 @@ fn pointee_info_at(
                                 .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
                                     }
index 1be0736791451fd9a9c8e32acd69c4e828007517..70d184240fccd1a6bd85d94813809eaa7ab14860 100644 (file)
@@ -12,7 +12,7 @@
 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 @@ fn new_internal(
                 }
             }
 
-            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);
index a225a11e94db049ea6469ce93e67ebdf2a9d7e72..7bf8f705ea8ad84d2427bb70c3a6b557463ae385 100644 (file)
@@ -15,7 +15,9 @@
 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 @@ fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout {
 
 impl<'tcx, 'll> HasParamEnv<'tcx> for CodegenCx<'ll, 'tcx> {
     fn param_env(&self) -> ty::ParamEnv<'tcx> {
-        panic!("asd")
+        ty::ParamEnv::reveal_all()
     }
 }
index 3f717754e327a65c05d3d0bcff6651b04e899efe..ff25ed9256613c867cae9a3b9315a5549b34b67d 100644 (file)
@@ -383,7 +383,7 @@ fn pointee_info_at<'a>(&self, cx: &CodegenCx<'a, 'tcx>, offset: Size)
             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
index d69b4b6d2bdcaad0ae372ca9402ca3d2a59bce67..4b61057e5cf6cec4b5c5d13dc807880517297261 100644 (file)
@@ -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,
@@ -945,7 +943,6 @@ fn pointee_info_at(
         this: TyLayout<'a, Self>,
         cx: &C,
         offset: Size,
-        param_env: Self::ParamEnv,
     ) -> Option<PointeeInfo>;
 }
 
@@ -958,11 +955,9 @@ pub fn field<C>(self, cx: &C, i: usize) -> C::TyLayout
     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)
     }
 }