/// needn't) be tracked across crates.
pub source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>>,
- /// Rvalues promoted from this function, such as borrows of constants.
- /// Each of them is the Body of a constant with the fn's type parameters
- /// in scope, but a separate set of locals.
- pub promoted: IndexVec<Promoted, Body<'tcx>>,
-
/// Yields type of the function, if it is a generator.
pub yield_ty: Option<Ty<'tcx>>,
basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
source_scopes: IndexVec<SourceScope, SourceScopeData>,
source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>>,
- promoted: IndexVec<Promoted, Body<'tcx>>,
yield_ty: Option<Ty<'tcx>>,
local_decls: LocalDecls<'tcx>,
user_type_annotations: CanonicalUserTypeAnnotations<'tcx>,
basic_blocks,
source_scopes,
source_scope_local_data,
- promoted,
yield_ty,
generator_drop: None,
generator_layout: None,
basic_blocks,
source_scopes,
source_scope_local_data,
- promoted,
yield_ty,
generator_drop,
generator_layout,
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
pub struct Static<'tcx> {
pub ty: Ty<'tcx>,
- pub kind: StaticKind,
+ pub kind: StaticKind<'tcx>,
+ pub def_id: DefId,
}
#[derive(
Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable, RustcEncodable, RustcDecodable,
)]
-pub enum StaticKind {
- Promoted(Promoted),
- Static(DefId),
+pub enum StaticKind<'tcx> {
+ Promoted(Promoted, SubstsRef<'tcx>),
+ Static,
}
impl_stable_hash_for!(struct Static<'tcx> {
ty,
- kind
+ kind,
+ def_id
});
/// The `Projection` data structure defines things of the form `base.x`, `*b` or `b[index]`.
fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
match *self {
PlaceBase::Local(id) => write!(fmt, "{:?}", id),
- PlaceBase::Static(box self::Static { ty, kind: StaticKind::Static(def_id) }) => {
+ PlaceBase::Static(box self::Static { ty, kind: StaticKind::Static, def_id }) => {
write!(fmt, "({}: {:?})", ty::tls::with(|tcx| tcx.def_path_str(def_id)), ty)
}
- PlaceBase::Static(box self::Static { ty, kind: StaticKind::Promoted(promoted) }) => {
+ PlaceBase::Static(box self::Static {
+ ty, kind: StaticKind::Promoted(promoted, _), def_id: _
+ }) => {
write!(fmt, "({:?}: {:?})", promoted, ty)
}
}
let ty = tcx.type_of(def_id).subst(tcx, substs);
Operand::Constant(box Constant {
span,
- ty,
user_ty: None,
literal: ty::Const::zero_sized(tcx, ty),
})
#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, HashStable)]
pub struct Constant<'tcx> {
pub span: Span,
- pub ty: Ty<'tcx>,
/// Optional user-given type: for something like
/// `collect::<Vec<_>>`, this would be present and would
basic_blocks,
source_scopes,
source_scope_local_data,
- promoted,
yield_ty,
generator_drop,
generator_layout,
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
Constant {
span: self.span.clone(),
- ty: self.ty.fold_with(folder),
user_ty: self.user_ty.fold_with(folder),
literal: self.literal.fold_with(folder),
}
}
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
- self.ty.visit_with(visitor) || self.literal.visit_with(visitor)
+ self.literal.visit_with(visitor)
}
}