X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc%2Fty%2Fsty.rs;h=5cc46b21fca1f1bf27de4e57f469d89b0ee6709b;hb=912d22e36965d3c9f6d7f14ca18657182aa1fe54;hp=4711429502f3fd5c1eb17273523844f193718ff8;hpb=ffb4ceb27f9584211ac76ed4ef37511c70f20457;p=rust.git diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 4711429502f..5cc46b21fca 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -3,7 +3,7 @@ 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; @@ -56,9 +56,6 @@ pub enum BoundRegion { /// 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, @@ -2038,6 +2035,14 @@ pub fn is_fn(&self) -> bool { } } + #[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, @@ -2232,14 +2237,12 @@ pub fn from_bits( 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]