@@ -22,16 +22,11 @@ impl fmt::Display for TerminationInfo {
22
22
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
23
23
use TerminationInfo :: * ;
24
24
match self {
25
- Exit ( code) =>
26
- write ! ( f, "the evaluated program completed with exit code {}" , code) ,
27
- Abort ( msg) =>
28
- write ! ( f, "{}" , msg) ,
29
- UnsupportedInIsolation ( msg) =>
30
- write ! ( f, "{}" , msg) ,
31
- ExperimentalUb { msg, .. } =>
32
- write ! ( f, "{}" , msg) ,
33
- Deadlock =>
34
- write ! ( f, "the evaluated program deadlocked" ) ,
25
+ Exit ( code) => write ! ( f, "the evaluated program completed with exit code {}" , code) ,
26
+ Abort ( msg) => write ! ( f, "{}" , msg) ,
27
+ UnsupportedInIsolation ( msg) => write ! ( f, "{}" , msg) ,
28
+ ExperimentalUb { msg, .. } => write ! ( f, "{}" , msg) ,
29
+ Deadlock => write ! ( f, "the evaluated program deadlocked" ) ,
35
30
}
36
31
}
37
32
}
@@ -60,14 +55,12 @@ pub fn report_error<'tcx, 'mir>(
60
55
use TerminationInfo :: * ;
61
56
let title = match info {
62
57
Exit ( code) => return Some ( * code) ,
63
- Abort ( _) =>
64
- "abnormal termination" ,
65
- UnsupportedInIsolation ( _) =>
66
- "unsupported operation" ,
67
- ExperimentalUb { .. } =>
68
- "Undefined Behavior" ,
58
+ Abort ( _) => "abnormal termination" ,
59
+ UnsupportedInIsolation ( _) => "unsupported operation" ,
60
+ ExperimentalUb { .. } => "Undefined Behavior" ,
69
61
Deadlock => "deadlock" ,
70
62
} ;
63
+ #[ rustfmt:: skip]
71
64
let helps = match info {
72
65
UnsupportedInIsolation ( _) =>
73
66
vec ! [ format!( "pass the flag `-Zmiri-disable-isolation` to disable isolation" ) ] ,
@@ -81,6 +74,7 @@ pub fn report_error<'tcx, 'mir>(
81
74
( title, helps)
82
75
}
83
76
_ => {
77
+ #[ rustfmt:: skip]
84
78
let title = match e. kind ( ) {
85
79
Unsupported ( _) =>
86
80
"unsupported operation" ,
@@ -93,6 +87,7 @@ pub fn report_error<'tcx, 'mir>(
93
87
_ =>
94
88
bug ! ( "This error should be impossible in Miri: {}" , e) ,
95
89
} ;
90
+ #[ rustfmt:: skip]
96
91
let helps = match e. kind ( ) {
97
92
Unsupported ( UnsupportedOpInfo :: NoMirFor ( ..) ) =>
98
93
vec ! [ format!( "make sure to use a Miri sysroot, which you can prepare with `cargo miri setup`" ) ] ,
@@ -120,7 +115,14 @@ pub fn report_error<'tcx, 'mir>(
120
115
121
116
e. print_backtrace ( ) ;
122
117
let msg = e. to_string ( ) ;
123
- report_msg ( * ecx. tcx , /*error*/ true , & format ! ( "{}: {}" , title, msg) , msg, helps, & ecx. generate_stacktrace ( ) ) ;
118
+ report_msg (
119
+ * ecx. tcx ,
120
+ /*error*/ true ,
121
+ & format ! ( "{}: {}" , title, msg) ,
122
+ msg,
123
+ helps,
124
+ & ecx. generate_stacktrace ( ) ,
125
+ ) ;
124
126
125
127
// Debug-dump all locals.
126
128
for ( i, frame) in ecx. active_thread_stack ( ) . iter ( ) . enumerate ( ) {
@@ -249,7 +251,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
249
251
}
250
252
// Add popped frame back.
251
253
if stacktrace. len ( ) < info. stack_size {
252
- assert ! ( stacktrace. len( ) == info. stack_size-1 , "we should never pop more than one frame at once" ) ;
254
+ assert ! (
255
+ stacktrace. len( ) == info. stack_size - 1 ,
256
+ "we should never pop more than one frame at once"
257
+ ) ;
253
258
let frame_info = FrameInfo {
254
259
instance : info. instance . unwrap ( ) ,
255
260
span : info. span ,
@@ -259,25 +264,30 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
259
264
} else if let Some ( instance) = info. instance {
260
265
// Adjust topmost frame.
261
266
stacktrace[ 0 ] . span = info. span ;
262
- assert_eq ! ( stacktrace[ 0 ] . instance, instance, "we should not pop and push a frame in one step" ) ;
267
+ assert_eq ! (
268
+ stacktrace[ 0 ] . instance, instance,
269
+ "we should not pop and push a frame in one step"
270
+ ) ;
263
271
}
264
272
265
273
// Show diagnostics.
266
274
for e in diagnostics. drain ( ..) {
267
275
use NonHaltingDiagnostic :: * ;
268
276
let msg = match e {
269
- CreatedPointerTag ( tag) =>
270
- format ! ( "created tag {:?}" , tag) ,
271
- PoppedPointerTag ( item) =>
272
- format ! ( "popped tracked tag for item {:?}" , item) ,
273
- CreatedCallId ( id) =>
274
- format ! ( "function call with id {}" , id) ,
275
- CreatedAlloc ( AllocId ( id) ) =>
276
- format ! ( "created allocation with id {}" , id) ,
277
- FreedAlloc ( AllocId ( id) ) =>
278
- format ! ( "freed allocation with id {}" , id) ,
277
+ CreatedPointerTag ( tag) => format ! ( "created tag {:?}" , tag) ,
278
+ PoppedPointerTag ( item) => format ! ( "popped tracked tag for item {:?}" , item) ,
279
+ CreatedCallId ( id) => format ! ( "function call with id {}" , id) ,
280
+ CreatedAlloc ( AllocId ( id) ) => format ! ( "created allocation with id {}" , id) ,
281
+ FreedAlloc ( AllocId ( id) ) => format ! ( "freed allocation with id {}" , id) ,
279
282
} ;
280
- report_msg ( * this. tcx , /*error*/ false , "tracking was triggered" , msg, vec ! [ ] , & stacktrace) ;
283
+ report_msg (
284
+ * this. tcx ,
285
+ /*error*/ false ,
286
+ "tracking was triggered" ,
287
+ msg,
288
+ vec ! [ ] ,
289
+ & stacktrace,
290
+ ) ;
281
291
}
282
292
} ) ;
283
293
}
0 commit comments