about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2018-11-13 12:53:29 +0200
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2018-11-16 14:40:16 +0200
commitb06836e71a1358021c24a000be26612b5fcbee79 (patch)
treed8bb7a50887309adfb9c3aa7f244644f6352f971
parent35b40f51fb3fbe177745f251e2f58d928227a89a (diff)
downloadrust-b06836e71a1358021c24a000be26612b5fcbee79.tar.gz
rust-b06836e71a1358021c24a000be26612b5fcbee79.zip
[eddyb/rebase cleanup] move type_{needs_drop,is_sized,is_freeze} to rustc_codegen_utils
-rw-r--r--src/librustc_codegen_llvm/type_.rs7
-rw-r--r--src/librustc_codegen_utils/common.rs17
2 files changed, 20 insertions, 4 deletions
diff --git a/src/librustc_codegen_llvm/type_.rs b/src/librustc_codegen_llvm/type_.rs
index d63b19ae7eb..56dac0175e5 100644
--- a/src/librustc_codegen_llvm/type_.rs
+++ b/src/librustc_codegen_llvm/type_.rs
@@ -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 {
diff --git a/src/librustc_codegen_utils/common.rs b/src/librustc_codegen_utils/common.rs
index 5dc138b31ff..c274fa4345a 100644
--- a/src/librustc_codegen_utils/common.rs
+++ b/src/librustc_codegen_utils/common.rs
@@ -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,