Skip to content

Commit daafeb3

Browse files
committed
document Miri error categories
1 parent 5670d04 commit daafeb3

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
@@ -313,6 +313,9 @@ impl<O: fmt::Debug> fmt::Debug for PanicInfo<O> {
313313
}
314314
}
315315

316+
/// Error information for when the program we executed turned out not to actually be a valid
317+
/// program. This cannot happen in stand-alone Miri, but it can happen during CTFE/ConstProp
318+
/// where we work on generic code or execution does not have all information available.
316319
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
317320
pub enum InvalidProgramInfo<'tcx> {
318321
/// Resolution can fail if we are in a too generic context.
@@ -342,6 +345,7 @@ impl fmt::Debug for InvalidProgramInfo<'tcx> {
342345
}
343346
}
344347

348+
/// Error information for when the program caused Undefined Behavior.
345349
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
346350
pub enum UndefinedBehaviorInfo {
347351
/// Free-form case. Only for errors that are never caught!
@@ -364,12 +368,19 @@ impl fmt::Debug for UndefinedBehaviorInfo {
364368
}
365369
}
366370

371+
/// Error information for when the program did something that might (or might not) be correct
372+
/// to do according to the Rust spec, but due to limitations in the interpreter, the
373+
/// operation could not be carried out. These limitations can differ between CTFE and the
374+
/// Miri engine, e.g., CTFE does not support casting pointers to "real" integers.
375+
///
376+
/// Currently, we also use this as fall-back error kind for errors that have not been
377+
/// categorized yet.
367378
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
368379
pub enum UnsupportedOpInfo<'tcx> {
369380
/// Free-form case. Only for errors that are never caught!
370381
Unsupported(String),
371382

372-
// -- Everything below is not classified yet --
383+
// -- Everything below is not categorized yet --
373384
FunctionAbiMismatch(Abi, Abi),
374385
FunctionArgMismatch(Ty<'tcx>, Ty<'tcx>),
375386
FunctionRetMismatch(Ty<'tcx>, Ty<'tcx>),
@@ -536,6 +547,8 @@ impl fmt::Debug for UnsupportedOpInfo<'tcx> {
536547
}
537548
}
538549

550+
/// Error information for when the program exhausted the resources granted to it
551+
/// by the interpreter.
539552
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
540553
pub enum ResourceExhaustionInfo {
541554
/// The stack grew too big.

0 commit comments

Comments
 (0)