Skip to content

Commit 654519d

Browse files
committed
use PanicInfo and UnsupportedOpInfo
1 parent 8e9d0fa commit 654519d

File tree

14 files changed

+42
-42
lines changed

14 files changed

+42
-42
lines changed

src/librustc/mir/interpret/error.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ impl<'tcx> From<InterpError<'tcx>> for InterpErrorInfo<'tcx> {
237237
}
238238

239239
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
240-
pub enum PanicMessage<O> {
240+
pub enum PanicInfo<O> {
241241
Panic {
242242
msg: Symbol,
243243
line: u32,
@@ -257,14 +257,14 @@ pub enum PanicMessage<O> {
257257
}
258258

259259
/// Type for MIR `Assert` terminator error messages.
260-
pub type AssertMessage<'tcx> = PanicMessage<mir::Operand<'tcx>>;
260+
pub type AssertMessage<'tcx> = PanicInfo<mir::Operand<'tcx>>;
261261

262-
impl<O> PanicMessage<O> {
262+
impl<O> PanicInfo<O> {
263263
/// Getting a description does not require `O` to be printable, and does not
264264
/// require allocation.
265265
/// The caller is expected to handle `Panic` and `BoundsCheck` separately.
266266
pub fn description(&self) -> &'static str {
267-
use PanicMessage::*;
267+
use PanicInfo::*;
268268
match self {
269269
Overflow(mir::BinOp::Add) =>
270270
"attempt to add with overflow",
@@ -293,14 +293,14 @@ impl<O> PanicMessage<O> {
293293
GeneratorResumedAfterPanic =>
294294
"generator resumed after panicking",
295295
Panic { .. } | BoundsCheck { .. } =>
296-
bug!("Unexpected PanicMessage"),
296+
bug!("Unexpected PanicInfo"),
297297
}
298298
}
299299
}
300300

301-
impl<O: fmt::Debug> fmt::Debug for PanicMessage<O> {
301+
impl<O: fmt::Debug> fmt::Debug for PanicInfo<O> {
302302
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
303-
use PanicMessage::*;
303+
use PanicInfo::*;
304304
match self {
305305
Panic { ref msg, line, col, ref file } =>
306306
write!(f, "the evaluated program panicked at '{}', {}:{}:{}", msg, file, line, col),
@@ -568,7 +568,7 @@ impl fmt::Debug for ResourceExhaustionInfo {
568568
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
569569
pub enum InterpError<'tcx> {
570570
/// The program panicked.
571-
Panic(PanicMessage<u64>),
571+
Panic(PanicInfo<u64>),
572572
/// The program caused undefined behavior.
573573
UndefinedBehaviour(UndefinedBehaviourInfo),
574574
/// The program did something the interpreter does not support (some of these *might* be UB

src/librustc/mir/interpret/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ macro_rules! err_ub {
3131
macro_rules! err_panic {
3232
($($tt:tt)*) => {
3333
Err($crate::mir::interpret::InterpError::Panic(
34-
$crate::mir::interpret::PanicMessage::$($tt)*
34+
$crate::mir::interpret::PanicInfo::$($tt)*
3535
).into())
3636
};
3737
}
@@ -52,7 +52,7 @@ mod pointer;
5252

5353
pub use self::error::{
5454
InterpErrorInfo, InterpResult, InterpError, AssertMessage, ConstEvalErr, struct_error,
55-
FrameInfo, ConstEvalRawResult, ConstEvalResult, ErrorHandled, PanicMessage, UnsupportedInfo,
55+
FrameInfo, ConstEvalRawResult, ConstEvalResult, ErrorHandled, PanicInfo, UnsupportedInfo,
5656
InvalidProgramInfo, ResourceExhaustionInfo, UndefinedBehaviourInfo,
5757
};
5858

src/librustc/mir/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use crate::hir::def::{CtorKind, Namespace};
88
use crate::hir::def_id::DefId;
99
use crate::hir::{self, InlineAsm as HirInlineAsm};
10-
use crate::mir::interpret::{ConstValue, PanicMessage, Scalar};
10+
use crate::mir::interpret::{ConstValue, PanicInfo, Scalar};
1111
use crate::mir::visit::MirVisitable;
1212
use crate::ty::adjustment::PointerCast;
1313
use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
@@ -3152,7 +3152,7 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
31523152
}
31533153
}
31543154
Assert { ref cond, expected, ref msg, target, cleanup } => {
3155-
use PanicMessage::*;
3155+
use PanicInfo::*;
31563156
let msg = match msg {
31573157
BoundsCheck { ref len, ref index } =>
31583158
BoundsCheck {
@@ -3200,7 +3200,7 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
32003200
}
32013201
Assert { ref cond, ref msg, .. } => {
32023202
if cond.visit_with(visitor) {
3203-
use PanicMessage::*;
3203+
use PanicInfo::*;
32043204
match msg {
32053205
BoundsCheck { ref len, ref index } =>
32063206
len.visit_with(visitor) || index.visit_with(visitor),

src/librustc/mir/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ macro_rules! make_mir_visitor {
514514
fn super_assert_message(&mut self,
515515
msg: & $($mutability)? AssertMessage<'tcx>,
516516
location: Location) {
517-
use crate::mir::interpret::PanicMessage::*;
517+
use crate::mir::interpret::PanicInfo::*;
518518
match msg {
519519
BoundsCheck { len, index } => {
520520
self.visit_operand(len, location);

src/librustc_codegen_ssa/mir/block.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use rustc::middle::lang_items;
22
use rustc::ty::{self, Ty, TypeFoldable, Instance};
33
use rustc::ty::layout::{self, LayoutOf, HasTyCtxt, FnTypeExt};
44
use rustc::mir::{self, Place, PlaceBase, Static, StaticKind};
5-
use rustc::mir::interpret::PanicMessage;
5+
use rustc::mir::interpret::PanicInfo;
66
use rustc_target::abi::call::{ArgType, FnType, PassMode, IgnoreMode};
77
use rustc_target::spec::abi::Abi;
88
use crate::base;
@@ -368,7 +368,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
368368
// checked operation, just a comparison with the minimum
369369
// value, so we have to check for the assert message.
370370
if !bx.check_overflow() {
371-
if let PanicMessage::OverflowNeg = *msg {
371+
if let PanicInfo::OverflowNeg = *msg {
372372
const_cond = Some(expected);
373373
}
374374
}
@@ -403,7 +403,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
403403

404404
// Put together the arguments to the panic entry point.
405405
let (lang_item, args) = match msg {
406-
PanicMessage::BoundsCheck { ref len, ref index } => {
406+
PanicInfo::BoundsCheck { ref len, ref index } => {
407407
let len = self.codegen_operand(&mut bx, len).immediate();
408408
let index = self.codegen_operand(&mut bx, index).immediate();
409409

src/librustc_mir/borrow_check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,8 @@ impl<'cx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'tcx
733733
cleanup: _,
734734
} => {
735735
self.consume_operand(loc, (cond, span), flow_state);
736-
use rustc::mir::interpret::PanicMessage;
737-
if let PanicMessage::BoundsCheck { ref len, ref index } = *msg {
736+
use rustc::mir::interpret::PanicInfo;
737+
if let PanicInfo::BoundsCheck { ref len, ref index } = *msg {
738738
self.consume_operand(loc, (len, span), flow_state);
739739
self.consume_operand(loc, (index, span), flow_state);
740740
}

src/librustc_mir/borrow_check/nll/invalidation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
207207
cleanup: _,
208208
} => {
209209
self.consume_operand(location, cond);
210-
use rustc::mir::interpret::PanicMessage;
211-
if let PanicMessage::BoundsCheck { ref len, ref index } = *msg {
210+
use rustc::mir::interpret::PanicInfo;
211+
if let PanicInfo::BoundsCheck { ref len, ref index } = *msg {
212212
self.consume_operand(location, len);
213213
self.consume_operand(location, index);
214214
}

src/librustc_mir/borrow_check/nll/type_check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use rustc::infer::canonical::QueryRegionConstraints;
2626
use rustc::infer::outlives::env::RegionBoundPairs;
2727
use rustc::infer::{InferCtxt, InferOk, LateBoundRegionConversionTime, NLLRegionVariableOrigin};
2828
use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
29-
use rustc::mir::interpret::{ConstValue, PanicMessage};
29+
use rustc::mir::interpret::{ConstValue, PanicInfo};
3030
use rustc::mir::tcx::PlaceTy;
3131
use rustc::mir::visit::{PlaceContext, Visitor, NonMutatingUseContext};
3232
use rustc::mir::*;
@@ -1632,7 +1632,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
16321632
span_mirbug!(self, term, "bad Assert ({:?}, not bool", cond_ty);
16331633
}
16341634

1635-
if let PanicMessage::BoundsCheck { ref len, ref index } = *msg {
1635+
if let PanicInfo::BoundsCheck { ref len, ref index } = *msg {
16361636
if len.ty(body, tcx) != tcx.types.usize {
16371637
span_mirbug!(self, len, "bounds-check length non-usize {:?}", len)
16381638
}

src/librustc_mir/build/expr/as_place.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::build::expr::category::Category;
44
use crate::build::ForGuard::{OutsideGuard, RefWithinGuard};
55
use crate::build::{BlockAnd, BlockAndExtension, Builder};
66
use crate::hair::*;
7-
use rustc::mir::interpret::{PanicMessage::BoundsCheck};
7+
use rustc::mir::interpret::{PanicInfo::BoundsCheck};
88
use rustc::mir::*;
99
use rustc::ty::{CanonicalUserTypeAnnotation, Variance};
1010

src/librustc_mir/build/expr/as_rvalue.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::build::expr::category::{Category, RvalueFunc};
77
use crate::build::{BlockAnd, BlockAndExtension, Builder};
88
use crate::hair::*;
99
use rustc::middle::region;
10-
use rustc::mir::interpret::PanicMessage;
10+
use rustc::mir::interpret::PanicInfo;
1111
use rustc::mir::*;
1212
use rustc::ty::{self, CanonicalUserTypeAnnotation, Ty, UpvarSubsts};
1313
use syntax_pos::Span;
@@ -101,7 +101,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
101101
block,
102102
Operand::Move(is_min),
103103
false,
104-
PanicMessage::OverflowNeg,
104+
PanicInfo::OverflowNeg,
105105
expr_span,
106106
);
107107
}
@@ -401,7 +401,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
401401
let val = result_value.clone().field(val_fld, ty);
402402
let of = result_value.field(of_fld, bool_ty);
403403

404-
let err = PanicMessage::Overflow(op);
404+
let err = PanicInfo::Overflow(op);
405405

406406
block = self.assert(block, Operand::Move(of), false, err, span);
407407

@@ -412,11 +412,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
412412
// and 2. there are two possible failure cases, divide-by-zero and overflow.
413413

414414
let zero_err = if op == BinOp::Div {
415-
PanicMessage::DivisionByZero
415+
PanicInfo::DivisionByZero
416416
} else {
417-
PanicMessage::RemainderByZero
417+
PanicInfo::RemainderByZero
418418
};
419-
let overflow_err = PanicMessage::Overflow(op);
419+
let overflow_err = PanicInfo::Overflow(op);
420420

421421
// Check for / 0
422422
let is_zero = self.temp(bool_ty, span);

0 commit comments

Comments
 (0)