Skip to content

Commit 8802dc0

Browse files
committed
adding is_freeze to TyLayoutMethods
1 parent 852dd49 commit 8802dc0

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/librustc/ty/layout.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,6 +1961,14 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
19611961
}
19621962
}
19631963

1964+
fn is_freeze(
1965+
this: TyLayout<'tcx>,
1966+
cx: &C,
1967+
param_env: Self::ParamEnv,
1968+
)-> bool {
1969+
this.ty.is_freeze(cx.tcx(), param_env, DUMMY_SP)
1970+
}
1971+
19641972
}
19651973

19661974
struct Niche {

src/librustc_target/abi/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,11 @@ pub trait TyLayoutMethods<'a, C: LayoutOf<Ty = Self>>: Sized {
947947
offset: Size,
948948
param_env: Self::ParamEnv,
949949
) -> Option<PointeeInfo>;
950+
fn is_freeze(
951+
this: TyLayout<'a, Self>,
952+
cx: &C,
953+
param_env: Self::ParamEnv,
954+
)-> bool;
950955
}
951956

952957
impl<'a, Ty> TyLayout<'a, Ty> {
@@ -964,6 +969,10 @@ impl<'a, Ty> TyLayout<'a, Ty> {
964969
where Ty: TyLayoutMethods<'a, C>, C: LayoutOf<Ty = Ty> {
965970
Ty::pointee_info_at(self, cx, offset, param_env)
966971
}
972+
pub fn is_freeze<C>(self, cx: &C, param_env: Ty::ParamEnv) -> bool
973+
where Ty: TyLayoutMethods<'a, C>, C: LayoutOf<Ty = Ty> {
974+
Ty::is_freeze(self, cx, param_env)
975+
}
967976
}
968977

969978
impl<'a, Ty> TyLayout<'a, Ty> {

0 commit comments

Comments
 (0)