#![feature(untagged_unions)]
#![feature(unwind_attributes)]
#![feature(doc_spotlight)]
+ #![feature(rustc_const_unstable)]
#[prelude_import]
#[allow(unused)]
pub mod str;
pub mod hash;
pub mod fmt;
+pub mod time;
// note: does not need to be public
mod char_private;
use rustc::hir::def::{Def, CtorKind};
use rustc::hir::def_id::DefId;
use rustc::ty::{self, Ty, TyCtxt};
-use rustc::ty::layout::LayoutOf;
use rustc::ty::util::IntTypeExt;
use rustc::ty::subst::{Substs, Subst};
use rustc::util::common::ErrorReported;
if tcx.fn_sig(def_id).abi() == Abi::RustIntrinsic {
let layout_of = |ty: Ty<'tcx>| {
let ty = tcx.erase_regions(&ty);
- (tcx.at(e.span), cx.param_env).layout_of(ty).map_err(|err| {
+ tcx.at(e.span).layout_of(cx.param_env.and(ty)).map_err(|err| {
ConstEvalErr { span: e.span, kind: LayoutError(err) }
})
};
return Ok(mk_const(Integral(Usize(ConstUsize::new(align,
tcx.sess.target.usize_ty).unwrap()))));
}
+ "type_id" => {
+ let type_id = tcx.type_id_hash(substs.type_at(0));
+ return Ok(mk_const(Integral(U64(type_id))));
+ }
_ => signal!(e, TypeckError)
}
}