@@ -17,8 +17,7 @@ use rustc::mir::interpret::{
1717 ErrorHandled ,
1818 GlobalId , Scalar , Pointer , FrameInfo , AllocId ,
1919 InterpResult , InterpError ,
20- truncate, sign_extend, UnsupportedInfo :: * , InvalidProgramInfo :: * ,
21- ResourceExhaustionInfo :: * , UndefinedBehaviourInfo :: * ,
20+ truncate, sign_extend, InvalidProgramInfo :: * ,
2221} ;
2322use rustc_data_structures:: fx:: FxHashMap ;
2423
@@ -136,7 +135,7 @@ pub enum LocalValue<Tag=(), Id=AllocId> {
136135impl < ' tcx , Tag : Copy + ' static > LocalState < ' tcx , Tag > {
137136 pub fn access ( & self ) -> InterpResult < ' tcx , Operand < Tag > > {
138137 match self . value {
139- LocalValue :: Dead => err ! ( Unsupported ( DeadLocal ) ) ,
138+ LocalValue :: Dead => err ! ( DeadLocal ) ,
140139 LocalValue :: Uninitialized =>
141140 bug ! ( "The type checker should prevent reading from a never-written local" ) ,
142141 LocalValue :: Live ( val) => Ok ( val) ,
@@ -149,7 +148,7 @@ impl<'tcx, Tag: Copy + 'static> LocalState<'tcx, Tag> {
149148 & mut self ,
150149 ) -> InterpResult < ' tcx , Result < & mut LocalValue < Tag > , MemPlace < Tag > > > {
151150 match self . value {
152- LocalValue :: Dead => err ! ( Unsupported ( DeadLocal ) ) ,
151+ LocalValue :: Dead => err ! ( DeadLocal ) ,
153152 LocalValue :: Live ( Operand :: Indirect ( mplace) ) => Ok ( Err ( mplace) ) ,
154153 ref mut local @ LocalValue :: Live ( Operand :: Immediate ( _) ) |
155154 ref mut local @ LocalValue :: Uninitialized => {
@@ -303,7 +302,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
303302 & substs,
304303 ) ) ,
305304 None => if substs. needs_subst ( ) {
306- err ! ( InvalidProgram ( TooGeneric ) ) . into ( )
305+ err_inval ! ( TooGeneric ) . into ( )
307306 } else {
308307 Ok ( substs)
309308 } ,
@@ -337,14 +336,14 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
337336 && self . tcx . has_typeck_tables ( did)
338337 && self . tcx . typeck_tables_of ( did) . tainted_by_errors
339338 {
340- return err ! ( InvalidProgram ( TypeckError ) ) ;
339+ return err_inval ! ( TypeckError ) ;
341340 }
342341 trace ! ( "load mir {:?}" , instance) ;
343342 match instance {
344343 ty:: InstanceDef :: Item ( def_id) => if self . tcx . is_mir_available ( did) {
345344 Ok ( self . tcx . optimized_mir ( did) )
346345 } else {
347- err ! ( Unsupported ( NoMirFor ( self . tcx. def_path_str( def_id) ) ) )
346+ err ! ( NoMirFor ( self . tcx. def_path_str( def_id) ) )
348347 } ,
349348 _ => Ok ( self . tcx . instance_mir ( instance) ) ,
350349 }
@@ -357,7 +356,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
357356 match self . stack . last ( ) {
358357 Some ( frame) => Ok ( self . monomorphize_with_substs ( t, frame. instance . substs ) ?) ,
359358 None => if t. needs_subst ( ) {
360- err ! ( InvalidProgram ( TooGeneric ) ) . into ( )
359+ err_inval ! ( TooGeneric ) . into ( )
361360 } else {
362361 Ok ( t)
363362 } ,
@@ -374,7 +373,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
374373 let substituted = t. subst ( * self . tcx , substs) ;
375374
376375 if substituted. needs_subst ( ) {
377- return err ! ( InvalidProgram ( TooGeneric ) ) ;
376+ return err_inval ! ( TooGeneric ) ;
378377 }
379378
380379 Ok ( self . tcx . normalize_erasing_regions ( ty:: ParamEnv :: reveal_all ( ) , substituted) )
@@ -573,7 +572,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
573572 info ! ( "ENTERING({}) {}" , self . cur_frame( ) , self . frame( ) . instance) ;
574573
575574 if self . stack . len ( ) > self . tcx . sess . const_eval_stack_frame_limit {
576- err ! ( ResourceExhaustion ( StackFrameLimitReached ) )
575+ err_exhaust ! ( StackFrameLimitReached )
577576 } else {
578577 Ok ( ( ) )
579578 }
@@ -621,7 +620,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
621620 }
622621 } else {
623622 // Uh, that shouldn't happen... the function did not intend to return
624- return err ! ( UndefinedBehaviour ( Unreachable ) ) ;
623+ return err_ub ! ( Unreachable ) ;
625624 }
626625 // Jump to new block -- *after* validation so that the spans make more sense.
627626 match frame. return_to_block {
0 commit comments