Move has_metadata back to context.rs
This commit is contained in:
parent
6e94a7a91e
commit
282b231af2
@ -2040,20 +2040,6 @@ impl<'tcx> TyS<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn has_metadata<'a>(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> bool {
|
|
||||||
use syntax_pos::DUMMY_SP;
|
|
||||||
if self.is_sized(tcx, ty::ParamEnv::empty(traits::Reveal::All), DUMMY_SP) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
let tail = tcx.struct_tail(self);
|
|
||||||
match tail.sty {
|
|
||||||
ty::TyForeign(..) => false,
|
|
||||||
ty::TyStr | ty::TySlice(..) | ty::TyDynamic(..) => true,
|
|
||||||
_ => bug!("unexpected unsized tail: {:?}", tail.sty),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||||
|
@ -324,7 +324,17 @@ impl<'b, 'tcx> SharedCrateContext<'b, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn type_has_metadata(&self, ty: Ty<'tcx>) -> bool {
|
pub fn type_has_metadata(&self, ty: Ty<'tcx>) -> bool {
|
||||||
ty.has_metadata(self.tcx)
|
use syntax_pos::DUMMY_SP;
|
||||||
|
if ty.is_sized(self.tcx, ty::ParamEnv::empty(traits::Reveal::All), DUMMY_SP) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let tail = self.tcx.struct_tail(ty);
|
||||||
|
match tail.sty {
|
||||||
|
ty::TyForeign(..) => false,
|
||||||
|
ty::TyStr | ty::TySlice(..) | ty::TyDynamic(..) => true,
|
||||||
|
_ => bug!("unexpected unsized tail: {:?}", tail.sty),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tcx(&self) -> TyCtxt<'b, 'tcx, 'tcx> {
|
pub fn tcx(&self) -> TyCtxt<'b, 'tcx, 'tcx> {
|
||||||
|
Loading…
Reference in New Issue
Block a user