From: Saleem Jaffer Date: Fri, 26 Jul 2019 11:01:12 +0000 (+0530) Subject: moving remaining variants to UnsupportedInfo X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=eeb2335401b173e7f7ae84c699b96cbd7a6c3e50;p=rust.git moving remaining variants to UnsupportedInfo --- diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index 2897c70d71d..d0f3df800e4 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -359,31 +359,6 @@ pub enum UnsupportedInfo<'tcx> { UnimplementedTraitSelection, CalledClosureAsFunction, NoMirFor(String), -} - -#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)] -pub enum ResourceExhaustionInfo { - StackFrameLimitReached, - InfiniteLoop, -} - -#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)] -pub enum InterpError<'tcx> { - /// The program panicked. - Panic(PanicMessage), - /// The program caused undefined behavior. - UndefinedBehaviour(UndefinedBehaviourInfo), - /// The program did something the interpreter does not support (some of these *might* be UB - /// but the interpreter is not sure). - Unsupported(UnsupportedInfo<'tcx>), - /// The program was invalid (ill-typed, not sufficiently monomorphized, ...). - InvalidProgram(InvalidProgramInfo<'tcx>), - /// The program exhausted the interpreter's resources (stack/heap too big, - /// execution takes too long, ..). - ResourceExhaustion(ResourceExhaustionInfo), - - /// THe above 5 variants are what we want to group all the remaining InterpError variants into - /// This variant is used by machines to signal their own errors that do not /// match an existing variant. MachineError(String), @@ -421,6 +396,28 @@ pub enum InterpError<'tcx> { PathNotFound(Vec), } +#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)] +pub enum ResourceExhaustionInfo { + StackFrameLimitReached, + InfiniteLoop, +} + +#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)] +pub enum InterpError<'tcx> { + /// The program panicked. + Panic(PanicMessage), + /// The program caused undefined behavior. + UndefinedBehaviour(UndefinedBehaviourInfo), + /// The program did something the interpreter does not support (some of these *might* be UB + /// but the interpreter is not sure). + Unsupported(UnsupportedInfo<'tcx>), + /// The program was invalid (ill-typed, not sufficiently monomorphized, ...). + InvalidProgram(InvalidProgramInfo<'tcx>), + /// The program exhausted the interpreter's resources (stack/heap too big, + /// execution takes too long, ..). + ResourceExhaustion(ResourceExhaustionInfo), +} + pub type InterpResult<'tcx, T = ()> = Result>; impl fmt::Display for InterpError<'_> {