Rollup merge of #39602 - estebank:fix-39544, r=eddyb

Fix ICE when accessing mutably an immutable enum

Fix #39544.
This commit is contained in:
Corey Farwell 2017-02-09 08:47:34 -05:00 committed by GitHub
commit e32e2d47d0
3 changed files with 33 additions and 1 deletions

View file

@ -202,7 +202,9 @@ impl<'tcx> cmt_<'tcx> {
Categorization::Downcast(ref cmt, _) => {
if let Categorization::Local(_) = cmt.cat {
if let ty::TyAdt(def, _) = self.ty.sty {
return def.struct_variant().find_field_named(name).map(|x| x.did);
if def.is_struct() {
return def.struct_variant().find_field_named(name).map(|x| x.did);
}
}
None
} else {