1
Fork 0

[eddyb/rebase cleanup] move type_{needs_drop,is_sized,is_freeze} to rustc_codegen_utils

This commit is contained in:
Eduard-Mihai Burtescu 2018-11-13 12:53:29 +02:00
parent 35b40f51fb
commit b06836e71a
2 changed files with 20 additions and 4 deletions

View file

@ -27,6 +27,7 @@ use rustc::ty::layout::TyLayout;
use rustc_target::abi::call::{CastTarget, FnType, Reg};
use rustc_data_structures::small_c_str::SmallCStr;
use common;
use rustc_codegen_utils;
use rustc_codegen_utils::common::TypeKind;
use type_of::LayoutLlvmExt;
use abi::{LlvmType, FnTypeExt};
@ -363,15 +364,15 @@ impl DerivedTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> {
}
fn type_needs_drop(&self, ty: Ty<'tcx>) -> bool {
common::type_needs_drop(self.tcx(), ty)
rustc_codegen_utils::common::type_needs_drop(self.tcx(), ty)
}
fn type_is_sized(&self, ty: Ty<'tcx>) -> bool {
common::type_is_sized(self.tcx(), ty)
rustc_codegen_utils::common::type_is_sized(self.tcx(), ty)
}
fn type_is_freeze(&self, ty: Ty<'tcx>) -> bool {
common::type_is_freeze(self.tcx(), ty)
rustc_codegen_utils::common::type_is_freeze(self.tcx(), ty)
}
fn type_has_metadata(&self, ty: Ty<'tcx>) -> bool {

View file

@ -7,9 +7,24 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(non_camel_case_types, non_snake_case)]
use rustc::ty::{self, Ty, TyCtxt};
use syntax_pos::DUMMY_SP;
pub fn type_needs_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
ty.needs_drop(tcx, ty::ParamEnv::reveal_all())
}
pub fn type_is_sized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
ty.is_sized(tcx.at(DUMMY_SP), ty::ParamEnv::reveal_all())
}
pub fn type_is_freeze<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
ty.is_freeze(tcx, ty::ParamEnv::reveal_all(), DUMMY_SP)
}
pub enum IntPredicate {
IntEQ,
IntNE,