}
}
+pub trait HasParamEnv<'tcx> {
+ fn param_env(&self) -> ty::ParamEnv<'tcx>;
+}
+
+impl<'tcx, C> HasParamEnv<'tcx> for LayoutCx<'tcx, C> {
+ fn param_env(&self) -> ty::ParamEnv<'tcx> {
+ self.param_env
+ }
+}
+
impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
where C: LayoutOf<Ty = Ty<'tcx>> + HasTyCtxt<'tcx>,
- C::TyLayout: MaybeResult<TyLayout<'tcx>>
+ C::TyLayout: MaybeResult<TyLayout<'tcx>>,
+ C: HasParamEnv<'tcx>
{
type ParamEnv = ty::ParamEnv<'tcx>;
}
}
}
-
- fn is_freeze(
- this: TyLayout<'tcx>,
- cx: &C,
- param_env: Self::ParamEnv,
- )-> bool {
- this.ty.is_freeze(cx.tcx(), param_env, DUMMY_SP)
- }
-
}
struct Niche {
}
}
+impl ty::layout::HasParamEnv<'tcx> for Builder<'_, '_, 'tcx> {
+ fn param_env(&self) -> ty::ParamEnv<'tcx> {
+ self.cx.param_env()
+ }
+}
+
impl ty::layout::LayoutOf for Builder<'_, '_, 'tcx> {
type Ty = Ty<'tcx>;
type TyLayout = TyLayout<'tcx>;
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};
+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")
+ }
+}
use crate::mir::place::PlaceRef;
use crate::MemFlags;
use rustc::ty::Ty;
-use rustc::ty::layout::{Align, Size};
+use rustc::ty::layout::{Align, Size, HasParamEnv};
use std::ops::Range;
use std::iter::TrustedLen;
+ IntrinsicCallMethods<'tcx>
+ AsmBuilderMethods<'tcx>
+ StaticBuilderMethods<'tcx>
+ + HasParamEnv<'tcx>
+
{
fn new_block<'b>(cx: &'a Self::CodegenCx, llfn: Self::Value, name: &'b str) -> Self;
fn with_cx(cx: &'a Self::CodegenCx) -> Self;
ArgTypeMethods, BaseTypeMethods, DerivedTypeMethods, LayoutTypeMethods, TypeMethods,
};
pub use self::write::{ModuleBufferMethods, ThinBufferMethods, WriteBackendMethods};
+use rustc::ty::layout::{HasParamEnv};
+
use std::fmt;
+ DeclareMethods<'tcx>
+ AsmMethods<'tcx>
+ PreDefineMethods<'tcx>
+ + HasParamEnv<'tcx>
{
}
+ DeclareMethods<'tcx>
+ AsmMethods<'tcx>
+ PreDefineMethods<'tcx>
+ + HasParamEnv<'tcx>
{
}
Type = Self::Type,
Funclet = Self::Funclet,
DIScope = Self::DIScope,
- >;
+ >
+ + HasParamEnv<'tcx>;
}
}
}
+impl<'a, 'mir, 'tcx, M> layout::HasParamEnv<'tcx> for InterpretCx<'a, 'mir, 'tcx, M>
+ where M: Machine<'a, 'mir, 'tcx>
+{
+ fn param_env(&self) -> ty::ParamEnv<'tcx> {
+ self.param_env
+ }
+}
+
impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> LayoutOf
for InterpretCx<'a, 'mir, 'tcx, M>
{
use rustc::ty::layout::LayoutOf;
use rustc::ty::layout::TargetDataLayout;
use rustc::ty::layout::TyLayout;
+use rustc::ty::layout::HasParamEnv;
use rustc::ty::ParamEnv;
use rustc::ty::Ty;
use rustc::ty::TyCtxt;
}
}
+impl<'me, 'tcx> HasParamEnv<'tcx> for UnwrapLayoutCx<'me, 'tcx> {
+ fn param_env(&self) -> ParamEnv<'tcx> {
+ self.param_env
+ }
+}
+
impl<'me, 'tcx> HasDataLayout for UnwrapLayoutCx<'me, 'tcx> {
fn data_layout(&self) -> &TargetDataLayout {
self.tcx.data_layout()
offset: Size,
param_env: Self::ParamEnv,
) -> Option<PointeeInfo>;
- fn is_freeze(
- this: TyLayout<'a, Self>,
- cx: &C,
- param_env: Self::ParamEnv,
- )-> bool;
}
impl<'a, Ty> TyLayout<'a, Ty> {
where Ty: TyLayoutMethods<'a, C>, C: LayoutOf<Ty = Ty> {
Ty::pointee_info_at(self, cx, offset, param_env)
}
- pub fn is_freeze<C>(self, cx: &C, param_env: Ty::ParamEnv) -> bool
- where Ty: TyLayoutMethods<'a, C>, C: LayoutOf<Ty = Ty> {
- Ty::is_freeze(self, cx, param_env)
- }
}
impl<'a, Ty> TyLayout<'a, Ty> {