diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2018-11-13 12:53:29 +0200 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2018-11-16 14:40:16 +0200 |
| commit | b06836e71a1358021c24a000be26612b5fcbee79 (patch) | |
| tree | d8bb7a50887309adfb9c3aa7f244644f6352f971 /src/librustc_codegen_utils | |
| parent | 35b40f51fb3fbe177745f251e2f58d928227a89a (diff) | |
| download | rust-b06836e71a1358021c24a000be26612b5fcbee79.tar.gz rust-b06836e71a1358021c24a000be26612b5fcbee79.zip | |
[eddyb/rebase cleanup] move type_{needs_drop,is_sized,is_freeze} to rustc_codegen_utils
Diffstat (limited to 'src/librustc_codegen_utils')
| -rw-r--r-- | src/librustc_codegen_utils/common.rs | 17 |
1 files changed, 16 insertions, 1 deletions
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, |
