}
}
+impl_stable_hash_for!(struct Mir<'tcx> {
+ basic_blocks,
+ visibility_scopes,
+ promoted,
+ return_ty,
+ local_decls,
+ arg_count,
+ upvar_decls,
+ spread_arg,
+ span,
+ cache
+});
+
impl<'tcx> Index<BasicBlock> for Mir<'tcx> {
type Output = BasicBlockData<'tcx>;
values: Cow<'tcx, [ConstInt]>,
/// Possible branch sites. The last element of this vector is used
- /// for the otherwise branch, so values.len() == targets.len() + 1
+ /// for the otherwise branch, so targets.len() == values.len() + 1
/// should hold.
// This invariant is quite non-obvious and also could be improved.
// One way to make this invariant is to have something like this instead:
pub ty: Ty<'tcx>,
}
+impl_stable_hash_for!(struct Static<'tcx> {
+ def_id,
+ ty
+});
+
/// The `Projection` data structure defines things of the form `B.x`
/// or `*B` or `B[index]`. Note that it is parameterized because it is
/// shared between `Constant` and `Lvalue`. See the aliases
}
impl<'tcx> Operand<'tcx> {
- pub fn item<'a>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
- def_id: DefId,
- substs: &'tcx Substs<'tcx>,
- span: Span)
- -> Self
- {
+ pub fn function_handle<'a>(
+ tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
+ def_id: DefId,
+ substs: &'tcx Substs<'tcx>,
+ span: Span,
+ ) -> Self {
Operand::Constant(Constant {
span: span,
ty: tcx.item_type(def_id).subst(tcx, substs),
- literal: Literal::Item { def_id, substs }
+ literal: Literal::Value { value: ConstVal::Function(def_id, substs) },
})
}