about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-04-19 18:13:35 -0400
committerAlex Crichton <alex@alexcrichton.com>2013-04-19 23:20:44 -0400
commit93e13e0eee1c14ea8287e448210404f407c84d19 (patch)
treec64cc28d96b32ce06c4889afc94f25b0bccdaf7c
parent8b3c09a1038c6623528fd7ebb1d365e475d63dfc (diff)
downloadrust-93e13e0eee1c14ea8287e448210404f407c84d19.tar.gz
rust-93e13e0eee1c14ea8287e448210404f407c84d19.zip
Fix an ICE when dereferencing types which cannot be dereferenced
-rw-r--r--src/librustc/middle/typeck/check/regionck.rs9
-rw-r--r--src/test/compile-fail/deref-non-pointer.rs3
2 files changed, 4 insertions, 8 deletions
diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs
index dff794c548b..56a8aaecae2 100644
--- a/src/librustc/middle/typeck/check/regionck.rs
+++ b/src/librustc/middle/typeck/check/regionck.rs
@@ -413,12 +413,9 @@ fn constrain_derefs(rcx: @mut Rcx,
 
         match ty::deref(tcx, derefd_ty, true) {
             Some(mt) => derefd_ty = mt.ty,
-            None => {
-                tcx.sess.span_bug(
-                    deref_expr.span,
-                    fmt!("%?'th deref is of a non-deref'able type `%s`",
-                         i, rcx.fcx.infcx().ty_to_str(derefd_ty)));
-            }
+            /* if this type can't be dereferenced, then there's already an error
+               in the session saying so. Just bail out for now */
+            None => break
         }
     }
 }
diff --git a/src/test/compile-fail/deref-non-pointer.rs b/src/test/compile-fail/deref-non-pointer.rs
index 5f93faef5fc..7b1b0f6243a 100644
--- a/src/test/compile-fail/deref-non-pointer.rs
+++ b/src/test/compile-fail/deref-non-pointer.rs
@@ -8,9 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern:cannot be dereferenced
 fn main() {
-  match *1 {
+  match *1 { //~ ERROR: cannot be dereferenced
       _ => { fail!(); }
   }
 }