about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Herr <ben@0x539.de>2016-03-25 18:46:11 +0100
committerBenjamin Herr <ben@0x539.de>2016-03-31 22:04:23 +0200
commitdfd0e937acb4d07fbdc6d95d5d8d6e852f7ef734 (patch)
tree6c802ace3b3d832b2e5174cbad69751811cb66ac /src
parentbcdaccfbbec562e8fb927359deada166d15dcf58 (diff)
downloadrust-dfd0e937acb4d07fbdc6d95d5d8d6e852f7ef734.tar.gz
rust-dfd0e937acb4d07fbdc6d95d5d8d6e852f7ef734.zip
librustc: replace unreachable! with bug!()
Diffstat (limited to 'src')
-rw-r--r--src/librustc/infer/type_variable.rs2
-rw-r--r--src/librustc/middle/mem_categorization.rs10
-rw-r--r--src/librustc/middle/region.rs8
-rw-r--r--src/librustc/mir/repr.rs2
-rw-r--r--src/librustc/session/config.rs2
-rw-r--r--src/librustc/traits/error_reporting.rs4
-rw-r--r--src/librustc/traits/select.rs4
-rw-r--r--src/librustc/ty/sty.rs4
-rw-r--r--src/librustc/ty/util.rs6
9 files changed, 21 insertions, 21 deletions
diff --git a/src/librustc/infer/type_variable.rs b/src/librustc/infer/type_variable.rs
index c8da346085d..141556c102d 100644
--- a/src/librustc/infer/type_variable.rs
+++ b/src/librustc/infer/type_variable.rs
@@ -259,7 +259,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
                         // quick check to see if this variable was
                         // created since the snapshot started or not.
                         let escaping_type = match self.values.get(vid.index as usize).value {
-                            Bounded { .. } => unreachable!(),
+                            Bounded { .. } => bug!(),
                             Known(ty) => ty,
                         };
                         escaping_types.push(escaping_type);
diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs
index aede30d23ab..1eb0a9956d0 100644
--- a/src/librustc/middle/mem_categorization.rs
+++ b/src/librustc/middle/mem_categorization.rs
@@ -724,12 +724,12 @@ impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> {
         let fn_body_id = {
             let fn_expr = match self.tcx().map.find(upvar_id.closure_expr_id) {
                 Some(ast_map::NodeExpr(e)) => e,
-                _ => unreachable!()
+                _ => bug!()
             };
 
             match fn_expr.node {
                 hir::ExprClosure(_, _, ref body) => body.id,
-                _ => unreachable!()
+                _ => bug!()
             }
         };
 
@@ -1453,10 +1453,10 @@ impl<'tcx> cmt_<'tcx> {
                         match inner.cat {
                             Categorization::Deref(ref inner, _, _) => inner.clone(),
                             Categorization::Upvar(..) => inner.clone(),
-                            _ => unreachable!()
+                            _ => bug!()
                         }
                     }
-                    _ => unreachable!()
+                    _ => bug!()
                 })
             }
             NoteNone => None
@@ -1485,7 +1485,7 @@ impl<'tcx> cmt_<'tcx> {
                     Some(&Categorization::Upvar(ref var)) => {
                         var.to_string()
                     }
-                    Some(_) => unreachable!(),
+                    Some(_) => bug!(),
                     None => {
                         match pk {
                             Implicit(..) => {
diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs
index 1d1d05ea79f..7a607e2419d 100644
--- a/src/librustc/middle/region.rs
+++ b/src/librustc/middle/region.rs
@@ -385,8 +385,8 @@ impl RegionMaps {
             }
             Entry::Vacant(v) => {
                 if self.code_extents.borrow().len() > 0xffffffffusize {
-                    unreachable!() // should pass a sess,
-                                   // but this isn't the only place
+                    bug!() // should pass a sess,
+                           // but this isn't the only place
                 }
                 let idx = CodeExtent(self.code_extents.borrow().len() as u32);
                 info!("CodeExtent({}) = {:?} [parent={}]", idx.0, e, parent.0);
@@ -601,12 +601,12 @@ impl RegionMaps {
                         scope_a
                     } else {
                         // neither fn encloses the other
-                        unreachable!()
+                        bug!()
                     }
                 }
                 _ => {
                     // root ids are always Misc right now
-                    unreachable!()
+                    bug!()
                 }
             };
         }
diff --git a/src/librustc/mir/repr.rs b/src/librustc/mir/repr.rs
index bc10d0c90ef..a33ee6bd204 100644
--- a/src/librustc/mir/repr.rs
+++ b/src/librustc/mir/repr.rs
@@ -1016,7 +1016,7 @@ fn fmt_const_val<W: Write>(fmt: &mut W, const_val: &ConstVal) -> fmt::Result {
         Struct(node_id) | Tuple(node_id) | Array(node_id, _) | Repeat(node_id, _) =>
             write!(fmt, "{}", node_to_string(node_id)),
         Char(c) => write!(fmt, "{:?}", c),
-        Dummy => unreachable!(),
+        Dummy => bug!(),
     }
 }
 
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index eba3332c8f7..4d4ba50bd4a 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -362,7 +362,7 @@ macro_rules! options {
                                                              value, $outputname,
                                                              key, type_desc))
                         }
-                        (None, None) => unreachable!()
+                        (None, None) => bug!()
                     }
                 }
                 found = true;
diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs
index edbeb393024..f15b9ee44ce 100644
--- a/src/librustc/traits/error_reporting.rs
+++ b/src/librustc/traits/error_reporting.rs
@@ -201,7 +201,7 @@ pub fn report_overflow_error<'a, 'tcx, T>(infcx: &InferCtxt<'a, 'tcx>,
 
     err.emit();
     infcx.tcx.sess.abort_if_errors();
-    unreachable!();
+    bug!();
 }
 
 /// Reports that a cycle was detected which led to overflow and halts
@@ -323,7 +323,7 @@ pub fn try_report_overflow_error_type_of_infinite_size<'a, 'tcx>(
     }
     err.emit();
     infcx.tcx.sess.abort_if_errors();
-    unreachable!();
+    bug!();
 }
 
 pub fn recursive_type_with_infinite_size_error<'tcx>(tcx: &TyCtxt<'tcx>,
diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs
index 9c7ddabc8fa..7635ff1eb4c 100644
--- a/src/librustc/traits/select.rs
+++ b/src/librustc/traits/select.rs
@@ -1870,7 +1870,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                 ty::BoundSized => ok_if(types),
 
                 // Shouldn't be coming through here.
-                ty::BoundSend | ty::BoundSync => unreachable!(),
+                ty::BoundSend | ty::BoundSync => bug!(),
             }
         }
     }
@@ -2660,7 +2660,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                     vec![inner_target]));
             }
 
-            _ => unreachable!()
+            _ => bug!()
         };
 
         Ok(VtableBuiltinData { nested: nested })
diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs
index 47d57d14baa..191c261b7e3 100644
--- a/src/librustc/ty/sty.rs
+++ b/src/librustc/ty/sty.rs
@@ -259,7 +259,7 @@ impl<'tcx> Decodable for &'tcx ClosureSubsts<'tcx> {
                                                               Box::new(closure_substs));
             match ty.sty {
                 TyClosure(_, ref closure_substs) => Ok(&**closure_substs),
-                _ => unreachable!()
+                _ => bug!()
             }
         })
     }
@@ -467,7 +467,7 @@ impl<'tcx> FnOutput<'tcx> {
     pub fn unwrap(self) -> Ty<'tcx> {
         match self {
             ty::FnConverging(t) => t,
-            ty::FnDiverging => unreachable!()
+            ty::FnDiverging => bug!()
         }
     }
 
diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs
index dc45795c0c3..e5f2e5fc70a 100644
--- a/src/librustc/ty/util.rs
+++ b/src/librustc/ty/util.rs
@@ -62,7 +62,7 @@ impl IntTypeExt for attr::IntType {
             SignedInt(ast::IntTy::Is) => match tcx.sess.target.int_type {
                 ast::IntTy::I32 => ConstInt::Isize(ConstIsize::Is32(0)),
                 ast::IntTy::I64 => ConstInt::Isize(ConstIsize::Is64(0)),
-                _ => unreachable!(),
+                _ => bug!(),
             },
             UnsignedInt(ast::UintTy::U8)  => ConstInt::U8(0),
             UnsignedInt(ast::UintTy::U16) => ConstInt::U16(0),
@@ -71,7 +71,7 @@ impl IntTypeExt for attr::IntType {
             UnsignedInt(ast::UintTy::Us) => match tcx.sess.target.uint_type {
                 ast::UintTy::U32 => ConstInt::Usize(ConstUsize::Us32(0)),
                 ast::UintTy::U64 => ConstInt::Usize(ConstUsize::Us64(0)),
-                _ => unreachable!(),
+                _ => bug!(),
             },
         }
     }
@@ -453,7 +453,7 @@ impl<'tcx> TyCtxt<'tcx> {
                         hash!(p.idx);
                         hash!(p.name.as_str());
                     }
-                    TyInfer(_) => unreachable!(),
+                    TyInfer(_) => bug!(),
                     TyError => byte!(21),
                     TyClosure(d, _) => {
                         byte!(22);