use crate::hir;
use crate::hir::def_id::DefId;
use crate::infer::canonical::Canonical;
-use crate::mir::interpret::{ConstValue, truncate};
+use crate::mir::interpret::ConstValue;
use crate::middle::region;
use polonius_engine::Atom;
use rustc_data_structures::indexed_vec::Idx;
/// the event of shadowing.
BrNamed(DefId, InternedString),
- /// Fresh bound identifiers created during GLB computations.
- BrFresh(u32),
-
/// Anonymous region for the implicit env pointer parameter
/// to a closure
BrEnv,
tcx: TyCtxt<'_, '_, '_>, trait_ref: ty::TraitRef<'tcx>, item_name: Ident
) -> ProjectionTy<'tcx> {
let item_def_id = tcx.associated_items(trait_ref.def_id).find(|item| {
- item.kind == ty::AssociatedKind::Type &&
+ item.kind == ty::AssocKind::Type &&
tcx.hygienic_eq(item_name, item.ident, trait_ref.def_id)
}).unwrap().def_id;
}
}
+ #[inline]
+ pub fn is_fn_ptr(&self) -> bool {
+ match self.sty {
+ FnPtr(_) => true,
+ _ => false,
+ }
+ }
+
pub fn is_impl_trait(&self) -> bool {
match self.sty {
Opaque(..) => true,
let size = tcx.layout_of(ty).unwrap_or_else(|e| {
panic!("could not compute layout for {:?}: {:?}", ty, e)
}).size;
- let truncated = truncate(bits, size);
- assert_eq!(truncated, bits, "from_bits called with untruncated value");
- Self::from_scalar(tcx, Scalar::Bits { bits, size: size.bytes() as u8 }, ty.value)
+ Self::from_scalar(tcx, Scalar::from_uint(bits, size), ty.value)
}
#[inline]
pub fn zero_sized(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) -> &'tcx Self {
- Self::from_scalar(tcx, Scalar::Bits { bits: 0, size: 0 }, ty)
+ Self::from_scalar(tcx, Scalar::zst(), ty)
}
#[inline]