]> git.proxmox.com Git - rustc.git/blob - compiler/rustc_middle/src/mir/abstract_const.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / compiler / rustc_middle / src / mir / abstract_const.rs
1 //! A subset of a mir body used for const evaluatability checking.
2 use crate::mir;
3 use crate::ty;
4
5 rustc_index::newtype_index! {
6 /// An index into an `AbstractConst`.
7 pub struct NodeId {
8 derive [HashStable]
9 DEBUG_FORMAT = "n{}",
10 }
11 }
12
13 /// A node of an `AbstractConst`.
14 #[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)]
15 pub enum Node<'tcx> {
16 Leaf(&'tcx ty::Const<'tcx>),
17 Binop(mir::BinOp, NodeId, NodeId),
18 UnaryOp(mir::UnOp, NodeId),
19 FunctionCall(NodeId, &'tcx [NodeId]),
20 }