@@ -8,7 +8,6 @@ use rand::SeedableRng;
8
8
use rustc_hir:: def_id:: DefId ;
9
9
use rustc:: ty:: layout:: { LayoutOf , Size } ;
10
10
use rustc:: ty:: { self , TyCtxt } ;
11
- use rustc_mir:: interpret:: InterpErrorInfo ;
12
11
13
12
use crate :: * ;
14
13
@@ -209,62 +208,3 @@ pub fn eval_main<'tcx>(tcx: TyCtxt<'tcx>, main_id: DefId, config: MiriConfig) ->
209
208
Err ( e) => report_err ( & ecx, e) ,
210
209
}
211
210
}
212
-
213
- fn report_err < ' tcx , ' mir > (
214
- ecx : & InterpCx < ' mir , ' tcx , Evaluator < ' tcx > > ,
215
- mut e : InterpErrorInfo < ' tcx > ,
216
- ) -> Option < i64 > {
217
- // Special treatment for some error kinds
218
- let msg = match e. kind {
219
- InterpError :: MachineStop ( ref info) => {
220
- let info = info. downcast_ref :: < TerminationInfo > ( ) . expect ( "invalid MachineStop payload" ) ;
221
- match info {
222
- TerminationInfo :: Exit ( code) => return Some ( * code) ,
223
- TerminationInfo :: PoppedTrackedPointerTag ( item) =>
224
- format ! ( "popped tracked tag for item {:?}" , item) ,
225
- TerminationInfo :: Abort => format ! ( "the evaluated program aborted execution" ) ,
226
- }
227
- }
228
- err_unsup ! ( NoMirFor ( ..) ) => format ! (
229
- "{}. Did you set `MIRI_SYSROOT` to a Miri-enabled sysroot? You can prepare one with `cargo miri setup`." ,
230
- e
231
- ) ,
232
- InterpError :: InvalidProgram ( _) => bug ! ( "This error should be impossible in Miri: {}" , e) ,
233
- _ => e. to_string ( ) ,
234
- } ;
235
- e. print_backtrace ( ) ;
236
- if let Some ( frame) = ecx. stack ( ) . last ( ) {
237
- let span = frame. current_source_info ( ) . unwrap ( ) . span ;
238
-
239
- let msg = format ! ( "Miri evaluation error: {}" , msg) ;
240
- let mut err = ecx. tcx . sess . struct_span_err ( span, msg. as_str ( ) ) ;
241
- let frames = ecx. generate_stacktrace ( None ) ;
242
- err. span_label ( span, msg) ;
243
- // We iterate with indices because we need to look at the next frame (the caller).
244
- for idx in 0 ..frames. len ( ) {
245
- let frame_info = & frames[ idx] ;
246
- let call_site_is_local = frames
247
- . get ( idx + 1 )
248
- . map_or ( false , |caller_info| caller_info. instance . def_id ( ) . is_local ( ) ) ;
249
- if call_site_is_local {
250
- err. span_note ( frame_info. call_site , & frame_info. to_string ( ) ) ;
251
- } else {
252
- err. note ( & frame_info. to_string ( ) ) ;
253
- }
254
- }
255
- err. emit ( ) ;
256
- } else {
257
- ecx. tcx . sess . err ( & msg) ;
258
- }
259
-
260
- for ( i, frame) in ecx. stack ( ) . iter ( ) . enumerate ( ) {
261
- trace ! ( "-------------------" ) ;
262
- trace ! ( "Frame {}" , i) ;
263
- trace ! ( " return: {:?}" , frame. return_place. map( |p| * p) ) ;
264
- for ( i, local) in frame. locals . iter ( ) . enumerate ( ) {
265
- trace ! ( " local {}: {:?}" , i, local. value) ;
266
- }
267
- }
268
- // Let the reported error determine the return code.
269
- return None ;
270
- }
0 commit comments