sess: &'a Session,
def_map: &'a DefMap,
ast_map: &'a ast_map::Map<'ast>,
+ // `discriminant_map` is a cache that associates the `NodeId`s of local
+ // variant definitions with the discriminant expression that applies to
+ // each one. If the variant uses the default values (starting from `0`),
+ // then `None` is stored.
discriminant_map: RefCell<NodeMap<Option<&'ast ast::Expr>>>,
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// Check that an enum with recursion in the discriminant throws
+// the appropriate error (rather than, say, blowing the stack).
enum X {
A = X::A as isize, //~ ERROR E0265
}
+// Since `Y::B` here defaults to `Y::A+1`, this is also a
+// recursive definition.
enum Y {
A = Y::B as isize, //~ ERROR E0265
B,