Skip to content

Commit b06836e

Browse files
committed
[eddyb/rebase cleanup] move type_{needs_drop,is_sized,is_freeze} to rustc_codegen_utils
1 parent 35b40f5 commit b06836e

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

src/librustc_codegen_llvm/type_.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use rustc::ty::layout::TyLayout;
2727
use rustc_target::abi::call::{CastTarget, FnType, Reg};
2828
use rustc_data_structures::small_c_str::SmallCStr;
2929
use common;
30+
use rustc_codegen_utils;
3031
use rustc_codegen_utils::common::TypeKind;
3132
use type_of::LayoutLlvmExt;
3233
use abi::{LlvmType, FnTypeExt};
@@ -363,15 +364,15 @@ impl DerivedTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> {
363364
}
364365

365366
fn type_needs_drop(&self, ty: Ty<'tcx>) -> bool {
366-
common::type_needs_drop(self.tcx(), ty)
367+
rustc_codegen_utils::common::type_needs_drop(self.tcx(), ty)
367368
}
368369

369370
fn type_is_sized(&self, ty: Ty<'tcx>) -> bool {
370-
common::type_is_sized(self.tcx(), ty)
371+
rustc_codegen_utils::common::type_is_sized(self.tcx(), ty)
371372
}
372373

373374
fn type_is_freeze(&self, ty: Ty<'tcx>) -> bool {
374-
common::type_is_freeze(self.tcx(), ty)
375+
rustc_codegen_utils::common::type_is_freeze(self.tcx(), ty)
375376
}
376377

377378
fn type_has_metadata(&self, ty: Ty<'tcx>) -> bool {

src/librustc_codegen_utils/common.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,24 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
1110
#![allow(non_camel_case_types, non_snake_case)]
1211

12+
use rustc::ty::{self, Ty, TyCtxt};
13+
use syntax_pos::DUMMY_SP;
14+
15+
16+
pub fn type_needs_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
17+
ty.needs_drop(tcx, ty::ParamEnv::reveal_all())
18+
}
19+
20+
pub fn type_is_sized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
21+
ty.is_sized(tcx.at(DUMMY_SP), ty::ParamEnv::reveal_all())
22+
}
23+
24+
pub fn type_is_freeze<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
25+
ty.is_freeze(tcx, ty::ParamEnv::reveal_all(), DUMMY_SP)
26+
}
27+
1328
pub enum IntPredicate {
1429
IntEQ,
1530
IntNE,

0 commit comments

Comments
 (0)