diff --git a/src/librustc/infer/type_variable.rs b/src/librustc/infer/type_variable.rs index c8da346085d6..141556c102d0 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 aede30d23abe..1eb0a9956d09 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 1d1d05ea79f1..7a607e2419da 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 bc10d0c90ef0..a33ee6bd204e 100644 --- a/src/librustc/mir/repr.rs +++ b/src/librustc/mir/repr.rs @@ -1016,7 +1016,7 @@ fn fmt_const_val(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 eba3332c8f71..4d4ba50bd4a7 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 edbeb3930244..f15b9ee44ce5 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 9c7ddabc8fac..7635ff1eb4cb 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 47d57d14baa8..191c261b7e35 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 dc45795c0c33..e5f2e5fc70ad 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);