use middle::typeck;
use util::ppaux::{ty_to_str, region_ptr_to_str, Repr};
-use std::vec_ng::Vec;
use syntax::ast::{MutImmutable, MutMutable};
use syntax::ast;
use syntax::codemap::Span;
}
// different kinds of pointers:
-#[deriving(Eq, Hash)]
+#[deriving(Eq, TotalEq, Hash)]
pub enum PointerKind {
OwnedPtr,
GcPtr,
// We use the term "interior" to mean "something reachable from the
// base without a pointer dereference", e.g. a field
-#[deriving(Eq, Hash)]
+#[deriving(Eq, TotalEq, Hash)]
pub enum InteriorKind {
InteriorField(FieldName),
InteriorElement(ElementKind),
}
-#[deriving(Eq, Hash)]
+#[deriving(Eq, TotalEq, Hash)]
pub enum FieldName {
NamedField(ast::Name),
PositionalField(uint)
}
-#[deriving(Eq, Hash)]
+#[deriving(Eq, TotalEq, Hash)]
pub enum ElementKind {
VecElement,
StrElement,
OtherElement,
}
-#[deriving(Eq, Hash, Show)]
+#[deriving(Eq, TotalEq, Hash, Show)]
pub enum MutabilityCategory {
McImmutable, // Immutable.
McDeclared, // Directly declared as mutable.
}
ast::ExprPath(_) => {
- let def_map = self.tcx().def_map.borrow();
- let def = def_map.get().get_copy(&expr.id);
+ let def = self.tcx().def_map.borrow().get_copy(&expr.id);
self.cat_def(expr.id, expr.span, expr_ty, def)
}
// variant(..)
}
ast::PatEnum(_, Some(ref subpats)) => {
- let def_map = self.tcx().def_map.borrow();
- match def_map.get().find(&pat.id) {
+ match self.tcx().def_map.borrow().find(&pat.id) {
Some(&ast::DefVariant(enum_did, _, _)) => {
// variant(x, y, z)
}
}
ty::ty_enum(..) => {
- let def_map = tcx.def_map.borrow();
- match def_map.get().get_copy(&node_id) {
+ match tcx.def_map.borrow().get_copy(&node_id) {
ast::DefVariant(_, variant_id, _) => {
let r = ty::lookup_struct_fields(tcx, variant_id);
for fld in r.iter() {