]> git.lizzy.rs Git - rust.git/commitdiff
Fix save-analysis generation panic with invalid tuple access
authorShotaro Yamada <sinkuu@sinkuu.xyz>
Tue, 6 Mar 2018 13:23:06 +0000 (22:23 +0900)
committerShotaro Yamada <sinkuu@sinkuu.xyz>
Tue, 6 Mar 2018 23:22:31 +0000 (08:22 +0900)
src/librustc_save_analysis/dump_visitor.rs
src/test/run-make/save-analysis-fail/foo.rs

index 6e98604101345a6796fd526a08955020ee430ea8..d4d76ff786fa0d47fe07e6b44360a29a830cfb22 100644 (file)
@@ -1675,7 +1675,10 @@ fn visit_expr(&mut self, ex: &'l ast::Expr) {
                         }
                     }
                     ty::TyTuple(..) => {}
-                    _ => span_bug!(ex.span, "Expected struct or tuple type, found {:?}", ty),
+                    _ => {
+                        debug!("Expected struct or tuple type, found {:?}", ty);
+                        return;
+                    }
                 }
             }
             ast::ExprKind::Closure(_, _, ref decl, ref body, _fn_decl_span) => {
index 07322d8bbc3253cb9c03556e479bb50c898c52f1..f123c3a812d3fac63de8ede2b0a84fa179523477 100644 (file)
@@ -459,3 +459,7 @@ struct Rls699 {
 fn new(f: u32) -> Rls699 {
     Rls699 { fs }
 }
+
+fn invalid_tuple_struct_access() {
+    bar.0;
+}