- pub fn type_needs_drop(&self, ty: Ty<'tcx>) -> bool {
- common::type_needs_drop(self.tcx, ty)
- }
-
- pub fn type_is_sized(&self, ty: Ty<'tcx>) -> bool {
- common::type_is_sized(self.tcx, ty)
- }
-
- pub fn type_is_freeze(&self, ty: Ty<'tcx>) -> bool {
- common::type_is_freeze(self.tcx, ty)
- }
-
- pub fn type_has_metadata(&self, ty: Ty<'tcx>) -> bool {
- use syntax_pos::DUMMY_SP;
- if ty.is_sized(self.tcx.at(DUMMY_SP), ty::ParamEnv::reveal_all()) {
- return false;
- }
-
- let tail = self.tcx.struct_tail(ty);
- match tail.sty {
- ty::Foreign(..) => false,
- ty::Str | ty::Slice(..) | ty::Dynamic(..) => true,
- _ => bug!("unexpected unsized tail: {:?}", tail.sty),
- }
- }