note: NoteNone
}))
}
+
+ def::DefErr => panic!("DefErr in memory categorization")
}
}
(*op)(self, cmt.clone(), pat);
- let opt_def = self.tcx().def_map.borrow().get(&pat.id).map(|d| d.full_def());
+ let opt_def = if let Some(path_res) = self.tcx().def_map.borrow().get(&pat.id) {
+ if path_res.depth != 0 || path_res.base_def == def::DefErr {
+ // Since patterns can be associated constants
+ // which are resolved during typeck, we might have
+ // some unresolved patterns reaching this stage
+ // without aborting
+ return Err(());
+ }
+ Some(path_res.full_def())
+ } else {
+ None
+ };
// Note: This goes up here (rather than within the PatEnum arm
// alone) because struct patterns can refer to struct types or
};
match pat.node {
- hir::PatWild(_) => {
+ hir::PatWild => {
// _
}
_ => {
self.tcx().sess.span_bug(
pat.span,
- "enum pattern didn't resolve to enum or struct");
+ &format!("enum pattern didn't resolve to enum or struct {:?}", opt_def));
}
}
}
NonAliasable
}
- Categorization::StaticItem(..) => {
+ Categorization::StaticItem => {
if self.mutbl.is_mutable() {
FreelyAliasable(AliasableStaticMut)
} else {