1
Fork 0

Auto merge of #68756 - JohnTitor:fix-ice-save-analysis-2, r=davidtwco

Fix ICE with save-analysis

Fixes #68749

It should be fine since it's the same way as `visit_expr`.
This commit is contained in:
bors 2020-02-03 03:28:08 +00:00
commit a2e80300cd
3 changed files with 5 additions and 3 deletions

View file

@ -866,8 +866,8 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> {
// FIXME do something with _path? // FIXME do something with _path?
let hir_id = self.tcx.hir().node_to_hir_id(p.id); let hir_id = self.tcx.hir().node_to_hir_id(p.id);
let adt = match self.save_ctxt.tables.node_type_opt(hir_id) { let adt = match self.save_ctxt.tables.node_type_opt(hir_id) {
Some(ty) => ty.ty_adt_def().unwrap(), Some(ty) if ty.ty_adt_def().is_some() => ty.ty_adt_def().unwrap(),
None => { _ => {
visit::walk_pat(self, p); visit::walk_pat(self, p);
return; return;
} }

View file

@ -1,3 +1,5 @@
// compile-flags: -Zsave-analysis
fn main() { fn main() {
match 'a' { match 'a' {
char{ch} => true char{ch} => true

View file

@ -1,5 +1,5 @@
error[E0574]: expected struct, variant or union type, found builtin type `char` error[E0574]: expected struct, variant or union type, found builtin type `char`
--> $DIR/issue-26459.rs:3:9 --> $DIR/issue-26459.rs:5:9
| |
LL | char{ch} => true LL | char{ch} => true
| ^^^^ not a struct, variant or union type | ^^^^ not a struct, variant or union type