Skip to content

Commit ba4b3b6

Browse files
authored
Rollup merge of rust-lang#64541 - RalfJung:miri-errors, r=oli-obk
document Miri error categories r? @oli-obk
2 parents 44308d3 + daafeb3 commit ba4b3b6

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/librustc/mir/interpret/error.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,9 @@ impl<O: fmt::Debug> fmt::Debug for PanicInfo<O> {
322322
}
323323
}
324324

325+
/// Error information for when the program we executed turned out not to actually be a valid
326+
/// program. This cannot happen in stand-alone Miri, but it can happen during CTFE/ConstProp
327+
/// where we work on generic code or execution does not have all information available.
325328
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
326329
pub enum InvalidProgramInfo<'tcx> {
327330
/// Resolution can fail if we are in a too generic context.
@@ -351,6 +354,7 @@ impl fmt::Debug for InvalidProgramInfo<'tcx> {
351354
}
352355
}
353356

357+
/// Error information for when the program caused Undefined Behavior.
354358
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
355359
pub enum UndefinedBehaviorInfo {
356360
/// Free-form case. Only for errors that are never caught!
@@ -373,12 +377,19 @@ impl fmt::Debug for UndefinedBehaviorInfo {
373377
}
374378
}
375379

380+
/// Error information for when the program did something that might (or might not) be correct
381+
/// to do according to the Rust spec, but due to limitations in the interpreter, the
382+
/// operation could not be carried out. These limitations can differ between CTFE and the
383+
/// Miri engine, e.g., CTFE does not support casting pointers to "real" integers.
384+
///
385+
/// Currently, we also use this as fall-back error kind for errors that have not been
386+
/// categorized yet.
376387
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
377388
pub enum UnsupportedOpInfo<'tcx> {
378389
/// Free-form case. Only for errors that are never caught!
379390
Unsupported(String),
380391

381-
// -- Everything below is not classified yet --
392+
// -- Everything below is not categorized yet --
382393
FunctionAbiMismatch(Abi, Abi),
383394
FunctionArgMismatch(Ty<'tcx>, Ty<'tcx>),
384395
FunctionRetMismatch(Ty<'tcx>, Ty<'tcx>),
@@ -545,6 +556,8 @@ impl fmt::Debug for UnsupportedOpInfo<'tcx> {
545556
}
546557
}
547558

559+
/// Error information for when the program exhausted the resources granted to it
560+
/// by the interpreter.
548561
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
549562
pub enum ResourceExhaustionInfo {
550563
/// The stack grew too big.

0 commit comments

Comments
 (0)