about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2020-02-12 19:40:31 +0100
committerRalf Jung <post@ralfj.de>2020-02-13 11:04:49 +0100
commited2f22c5a973f4deffa4bd6efbbee0393ff91691 (patch)
treee648d02dc43fed955e3e444793c8a61d8b3f3951 /src
parent7e7d1c39edafcbce55ba08449689566e335545b7 (diff)
downloadrust-ed2f22c5a973f4deffa4bd6efbbee0393ff91691.tar.gz
rust-ed2f22c5a973f4deffa4bd6efbbee0393ff91691.zip
rename PanicInfo -> AssertKind
Diffstat (limited to 'src')
-rw-r--r--src/librustc/mir/mod.rs18
-rw-r--r--src/librustc/mir/visit.rs2
-rw-r--r--src/librustc_codegen_ssa/mir/block.rs6
-rw-r--r--src/librustc_mir/borrow_check/invalidation.rs4
-rw-r--r--src/librustc_mir/borrow_check/mod.rs4
-rw-r--r--src/librustc_mir/borrow_check/type_check/mod.rs4
-rw-r--r--src/librustc_mir/const_eval/error.rs4
-rw-r--r--src/librustc_mir/const_eval/machine.rs4
-rw-r--r--src/librustc_mir/transform/const_prop.rs20
-rw-r--r--src/librustc_mir/transform/generator.rs2
-rw-r--r--src/librustc_mir_build/build/expr/as_place.rs2
-rw-r--r--src/librustc_mir_build/build/expr/as_rvalue.rs12
12 files changed, 41 insertions, 41 deletions
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index 8d224b6d739..4520d3a3333 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -1155,7 +1155,7 @@ pub enum TerminatorKind<'tcx> {
 
 /// Information about an assertion failure.
 #[derive(Clone, RustcEncodable, RustcDecodable, HashStable, PartialEq)]
-pub enum PanicInfo<O> {
+pub enum AssertKind<O> {
     BoundsCheck { len: O, index: O },
     Overflow(BinOp),
     OverflowNeg,
@@ -1166,7 +1166,7 @@ pub enum PanicInfo<O> {
 }
 
 /// Type for MIR `Assert` terminator error messages.
-pub type AssertMessage<'tcx> = PanicInfo<Operand<'tcx>>;
+pub type AssertMessage<'tcx> = AssertKind<Operand<'tcx>>;
 
 pub type Successors<'a> =
     iter::Chain<option::IntoIter<&'a BasicBlock>, slice::Iter<'a, BasicBlock>>;
@@ -1397,12 +1397,12 @@ impl<'tcx> BasicBlockData<'tcx> {
     }
 }
 
-impl<O> PanicInfo<O> {
+impl<O> AssertKind<O> {
     /// Getting a description does not require `O` to be printable, and does not
     /// require allocation.
     /// The caller is expected to handle `BoundsCheck` separately.
     pub fn description(&self) -> &'static str {
-        use PanicInfo::*;
+        use AssertKind::*;
         match self {
             Overflow(BinOp::Add) => "attempt to add with overflow",
             Overflow(BinOp::Sub) => "attempt to subtract with overflow",
@@ -1419,14 +1419,14 @@ impl<O> PanicInfo<O> {
             ResumedAfterReturn(GeneratorKind::Async(_)) => "`async fn` resumed after completion",
             ResumedAfterPanic(GeneratorKind::Gen) => "generator resumed after panicking",
             ResumedAfterPanic(GeneratorKind::Async(_)) => "`async fn` resumed after panicking",
-            BoundsCheck { .. } => bug!("Unexpected PanicInfo"),
+            BoundsCheck { .. } => bug!("Unexpected AssertKind"),
         }
     }
 }
 
-impl<O: fmt::Debug> fmt::Debug for PanicInfo<O> {
+impl<O: fmt::Debug> fmt::Debug for AssertKind<O> {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        use PanicInfo::*;
+        use AssertKind::*;
         match self {
             BoundsCheck { ref len, ref index } => {
                 write!(f, "index out of bounds: the len is {:?} but the index is {:?}", len, index)
@@ -2719,7 +2719,7 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
                 }
             }
             Assert { ref cond, expected, ref msg, target, cleanup } => {
-                use PanicInfo::*;
+                use AssertKind::*;
                 let msg = match msg {
                     BoundsCheck { ref len, ref index } => {
                         BoundsCheck { len: len.fold_with(folder), index: index.fold_with(folder) }
@@ -2768,7 +2768,7 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
             }
             Assert { ref cond, ref msg, .. } => {
                 if cond.visit_with(visitor) {
-                    use PanicInfo::*;
+                    use AssertKind::*;
                     match msg {
                         BoundsCheck { ref len, ref index } => {
                             len.visit_with(visitor) || index.visit_with(visitor)
diff --git a/src/librustc/mir/visit.rs b/src/librustc/mir/visit.rs
index 529ed71a6f3..8330bbe0834 100644
--- a/src/librustc/mir/visit.rs
+++ b/src/librustc/mir/visit.rs
@@ -533,7 +533,7 @@ macro_rules! make_mir_visitor {
             fn super_assert_message(&mut self,
                                     msg: & $($mutability)? AssertMessage<'tcx>,
                                     location: Location) {
-                use crate::mir::PanicInfo::*;
+                use crate::mir::AssertKind::*;
                 match msg {
                     BoundsCheck { len, index } => {
                         self.visit_operand(len, location);
diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs
index 835050fece6..916c15eb1b6 100644
--- a/src/librustc_codegen_ssa/mir/block.rs
+++ b/src/librustc_codegen_ssa/mir/block.rs
@@ -11,7 +11,7 @@ use crate::MemFlags;
 
 use rustc::middle::lang_items;
 use rustc::mir;
-use rustc::mir::PanicInfo;
+use rustc::mir::AssertKind;
 use rustc::ty::layout::{self, FnAbiExt, HasTyCtxt, LayoutOf};
 use rustc::ty::{self, Instance, Ty, TypeFoldable};
 use rustc_index::vec::Idx;
@@ -378,7 +378,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
         // checked operation, just a comparison with the minimum
         // value, so we have to check for the assert message.
         if !bx.check_overflow() {
-            if let PanicInfo::OverflowNeg = *msg {
+            if let AssertKind::OverflowNeg = *msg {
                 const_cond = Some(expected);
             }
         }
@@ -412,7 +412,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
 
         // Put together the arguments to the panic entry point.
         let (lang_item, args) = match msg {
-            PanicInfo::BoundsCheck { ref len, ref index } => {
+            AssertKind::BoundsCheck { ref len, ref index } => {
                 let len = self.codegen_operand(&mut bx, len).immediate();
                 let index = self.codegen_operand(&mut bx, index).immediate();
                 (lang_items::PanicBoundsCheckFnLangItem, vec![location, index, len])
diff --git a/src/librustc_mir/borrow_check/invalidation.rs b/src/librustc_mir/borrow_check/invalidation.rs
index 317b5edcb41..0bead27050c 100644
--- a/src/librustc_mir/borrow_check/invalidation.rs
+++ b/src/librustc_mir/borrow_check/invalidation.rs
@@ -153,8 +153,8 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
             }
             TerminatorKind::Assert { ref cond, expected: _, ref msg, target: _, cleanup: _ } => {
                 self.consume_operand(location, cond);
-                use rustc::mir::PanicInfo;
-                if let PanicInfo::BoundsCheck { ref len, ref index } = *msg {
+                use rustc::mir::AssertKind;
+                if let AssertKind::BoundsCheck { ref len, ref index } = *msg {
                     self.consume_operand(location, len);
                     self.consume_operand(location, index);
                 }
diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs
index 899529ce242..941534e68fc 100644
--- a/src/librustc_mir/borrow_check/mod.rs
+++ b/src/librustc_mir/borrow_check/mod.rs
@@ -654,8 +654,8 @@ impl<'cx, 'tcx> dataflow::generic::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtxt
             }
             TerminatorKind::Assert { ref cond, expected: _, ref msg, target: _, cleanup: _ } => {
                 self.consume_operand(loc, (cond, span), flow_state);
-                use rustc::mir::PanicInfo;
-                if let PanicInfo::BoundsCheck { ref len, ref index } = *msg {
+                use rustc::mir::AssertKind;
+                if let AssertKind::BoundsCheck { ref len, ref index } = *msg {
                     self.consume_operand(loc, (len, span), flow_state);
                     self.consume_operand(loc, (index, span), flow_state);
                 }
diff --git a/src/librustc_mir/borrow_check/type_check/mod.rs b/src/librustc_mir/borrow_check/type_check/mod.rs
index bb074a81d2a..5f7bf148e33 100644
--- a/src/librustc_mir/borrow_check/type_check/mod.rs
+++ b/src/librustc_mir/borrow_check/type_check/mod.rs
@@ -11,7 +11,7 @@ use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
 use rustc::infer::{InferCtxt, InferOk, LateBoundRegionConversionTime, NLLRegionVariableOrigin};
 use rustc::mir::tcx::PlaceTy;
 use rustc::mir::visit::{NonMutatingUseContext, PlaceContext, Visitor};
-use rustc::mir::PanicInfo;
+use rustc::mir::AssertKind;
 use rustc::mir::*;
 use rustc::traits::query::type_op;
 use rustc::traits::query::type_op::custom::CustomTypeOp;
@@ -1563,7 +1563,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
                     span_mirbug!(self, term, "bad Assert ({:?}, not bool", cond_ty);
                 }
 
-                if let PanicInfo::BoundsCheck { ref len, ref index } = *msg {
+                if let AssertKind::BoundsCheck { ref len, ref index } = *msg {
                     if len.ty(body, tcx) != tcx.types.usize {
                         span_mirbug!(self, len, "bounds-check length non-usize {:?}", len)
                     }
diff --git a/src/librustc_mir/const_eval/error.rs b/src/librustc_mir/const_eval/error.rs
index 5f05f439d92..63ad9ec8cae 100644
--- a/src/librustc_mir/const_eval/error.rs
+++ b/src/librustc_mir/const_eval/error.rs
@@ -1,7 +1,7 @@
 use std::error::Error;
 use std::fmt;
 
-use rustc::mir::PanicInfo;
+use rustc::mir::AssertKind;
 use rustc_span::Symbol;
 
 use super::InterpCx;
@@ -12,7 +12,7 @@ use crate::interpret::{ConstEvalErr, InterpError, InterpErrorInfo, Machine};
 pub enum ConstEvalErrKind {
     NeedsRfc(String),
     ConstAccessesStatic,
-    AssertFailure(PanicInfo<u64>),
+    AssertFailure(AssertKind<u64>),
     Panic { msg: Symbol, line: u32, col: u32, file: Symbol },
 }
 
diff --git a/src/librustc_mir/const_eval/machine.rs b/src/librustc_mir/const_eval/machine.rs
index 65cc53cac9d..e40436ccf0b 100644
--- a/src/librustc_mir/const_eval/machine.rs
+++ b/src/librustc_mir/const_eval/machine.rs
@@ -281,8 +281,8 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
         msg: &AssertMessage<'tcx>,
         _unwind: Option<mir::BasicBlock>,
     ) -> InterpResult<'tcx> {
-        use rustc::mir::PanicInfo::*;
-        // Convert `PanicInfo<Operand>` to `PanicInfo<u64>`.
+        use rustc::mir::AssertKind::*;
+        // Convert `AssertKind<Operand>` to `AssertKind<u64>`.
         let err = match msg {
             BoundsCheck { ref len, ref index } => {
                 let len = ecx
diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs
index 952dede4a15..09eb6e952ad 100644
--- a/src/librustc_mir/transform/const_prop.rs
+++ b/src/librustc_mir/transform/const_prop.rs
@@ -9,8 +9,8 @@ use rustc::mir::visit::{
     MutVisitor, MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor,
 };
 use rustc::mir::{
-    read_only, AggregateKind, BasicBlock, BinOp, Body, BodyAndCache, ClearCrossCrate, Constant,
-    Local, LocalDecl, LocalKind, Location, Operand, PanicInfo, Place, ReadOnlyBodyAndCache, Rvalue,
+    read_only, AggregateKind, AssertKind, BasicBlock, BinOp, Body, BodyAndCache, ClearCrossCrate,
+    Constant, Local, LocalDecl, LocalKind, Location, Operand, Place, ReadOnlyBodyAndCache, Rvalue,
     SourceInfo, SourceScope, SourceScopeData, Statement, StatementKind, Terminator, TerminatorKind,
     UnOp, RETURN_PLACE,
 };
@@ -501,7 +501,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
         }
     }
 
-    fn report_panic_as_lint(&self, source_info: SourceInfo, panic: PanicInfo<u64>) -> Option<()> {
+    fn report_panic_as_lint(&self, source_info: SourceInfo, panic: AssertKind<u64>) -> Option<()> {
         // Somewhat convoluted way to re-use the CTFE error reporting code.
         let lint_root = self.lint_root(source_info)?;
         let error = InterpError::MachineStop(Box::new(format!("{:?}", panic)));
@@ -530,7 +530,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
             // `AssertKind` only has an `OverflowNeg` variant, to make sure that is
             // appropriate to use.
             assert_eq!(op, UnOp::Neg, "Neg is the only UnOp that can overflow");
-            self.report_panic_as_lint(source_info, PanicInfo::OverflowNeg)?;
+            self.report_panic_as_lint(source_info, AssertKind::OverflowNeg)?;
         }
 
         Some(())
@@ -572,7 +572,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
             let (_res, overflow, _ty) = this.ecx.overflowing_binary_op(op, l, r)?;
             Ok(overflow)
         })? {
-            self.report_panic_as_lint(source_info, PanicInfo::Overflow(op))?;
+            self.report_panic_as_lint(source_info, AssertKind::Overflow(op))?;
         }
 
         Some(())
@@ -910,11 +910,11 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
                             span,
                             |lint| {
                                 let msg = match msg {
-                                    PanicInfo::Overflow(_)
-                                    | PanicInfo::OverflowNeg
-                                    | PanicInfo::DivisionByZero
-                                    | PanicInfo::RemainderByZero => msg.description().to_owned(),
-                                    PanicInfo::BoundsCheck { ref len, ref index } => {
+                                    AssertKind::Overflow(_)
+                                    | AssertKind::OverflowNeg
+                                    | AssertKind::DivisionByZero
+                                    | AssertKind::RemainderByZero => msg.description().to_owned(),
+                                    AssertKind::BoundsCheck { ref len, ref index } => {
                                         let len = self
                                             .eval_operand(len, source_info)
                                             .expect("len must be const");
diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs
index da19fb34927..d5d9a8c83cd 100644
--- a/src/librustc_mir/transform/generator.rs
+++ b/src/librustc_mir/transform/generator.rs
@@ -1022,7 +1022,7 @@ fn create_generator_resume_function<'tcx>(
 
     let mut cases = create_cases(body, &transform, Operation::Resume);
 
-    use rustc::mir::PanicInfo::{ResumedAfterPanic, ResumedAfterReturn};
+    use rustc::mir::AssertKind::{ResumedAfterPanic, ResumedAfterReturn};
 
     // Jump to the entry point on the unresumed
     cases.insert(0, (UNRESUMED, BasicBlock::new(0)));
diff --git a/src/librustc_mir_build/build/expr/as_place.rs b/src/librustc_mir_build/build/expr/as_place.rs
index 86f87790f23..d77cc49c94f 100644
--- a/src/librustc_mir_build/build/expr/as_place.rs
+++ b/src/librustc_mir_build/build/expr/as_place.rs
@@ -5,7 +5,7 @@ use crate::build::ForGuard::{OutsideGuard, RefWithinGuard};
 use crate::build::{BlockAnd, BlockAndExtension, Builder};
 use crate::hair::*;
 use rustc::middle::region;
-use rustc::mir::PanicInfo::BoundsCheck;
+use rustc::mir::AssertKind::BoundsCheck;
 use rustc::mir::*;
 use rustc::ty::{self, CanonicalUserTypeAnnotation, Ty, TyCtxt, Variance};
 use rustc_span::Span;
diff --git a/src/librustc_mir_build/build/expr/as_rvalue.rs b/src/librustc_mir_build/build/expr/as_rvalue.rs
index 5722a8c1cd9..dc97f321a36 100644
--- a/src/librustc_mir_build/build/expr/as_rvalue.rs
+++ b/src/librustc_mir_build/build/expr/as_rvalue.rs
@@ -6,7 +6,7 @@ use crate::build::expr::category::{Category, RvalueFunc};
 use crate::build::{BlockAnd, BlockAndExtension, Builder};
 use crate::hair::*;
 use rustc::middle::region;
-use rustc::mir::PanicInfo;
+use rustc::mir::AssertKind;
 use rustc::mir::*;
 use rustc::ty::{self, Ty, UpvarSubsts};
 use rustc_span::Span;
@@ -86,7 +86,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
                         block,
                         Operand::Move(is_min),
                         false,
-                        PanicInfo::OverflowNeg,
+                        AssertKind::OverflowNeg,
                         expr_span,
                     );
                 }
@@ -294,7 +294,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
             let val = tcx.mk_place_field(result_value.clone(), val_fld, ty);
             let of = tcx.mk_place_field(result_value, of_fld, bool_ty);
 
-            let err = PanicInfo::Overflow(op);
+            let err = AssertKind::Overflow(op);
 
             block = self.assert(block, Operand::Move(of), false, err, span);
 
@@ -305,11 +305,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
                 // and 2. there are two possible failure cases, divide-by-zero and overflow.
 
                 let zero_err = if op == BinOp::Div {
-                    PanicInfo::DivisionByZero
+                    AssertKind::DivisionByZero
                 } else {
-                    PanicInfo::RemainderByZero
+                    AssertKind::RemainderByZero
                 };
-                let overflow_err = PanicInfo::Overflow(op);
+                let overflow_err = AssertKind::Overflow(op);
 
                 // Check for / 0
                 let is_zero = self.temp(bool_ty, span);