@@ -172,48 +172,41 @@ fn main() {
172
172
init_early_loggers ( ) ;
173
173
174
174
// Parse our arguments and split them across `rustc` and `miri`.
175
- let mut validate = true ;
176
- let mut stacked_borrows = true ;
177
- let mut check_alignment = true ;
178
- let mut communicate = false ;
179
- let mut ignore_leaks = false ;
180
- let mut seed: Option < u64 > = None ;
181
- let mut tracked_pointer_tag: Option < miri:: PtrId > = None ;
182
- let mut tracked_call_id: Option < miri:: CallId > = None ;
183
- let mut tracked_alloc_id: Option < miri:: AllocId > = None ;
175
+ let mut miri_config = miri:: MiriConfig :: default ( ) ;
184
176
let mut rustc_args = vec ! [ ] ;
185
- let mut crate_args = vec ! [ ] ;
186
177
let mut after_dashdash = false ;
187
- let mut excluded_env_vars = vec ! [ ] ;
188
178
for arg in env:: args ( ) {
189
179
if rustc_args. is_empty ( ) {
190
180
// Very first arg: binary name.
191
181
rustc_args. push ( arg) ;
192
182
} else if after_dashdash {
193
183
// Everything that comes after `--` is forwarded to the interpreted crate.
194
- crate_args . push ( arg) ;
184
+ miri_config . args . push ( arg) ;
195
185
} else {
196
186
match arg. as_str ( ) {
197
187
"-Zmiri-disable-validation" => {
198
- validate = false ;
188
+ miri_config . validate = false ;
199
189
}
200
190
"-Zmiri-disable-stacked-borrows" => {
201
- stacked_borrows = false ;
191
+ miri_config . stacked_borrows = false ;
202
192
}
203
193
"-Zmiri-disable-alignment-check" => {
204
- check_alignment = false ;
194
+ miri_config. check_alignment = miri:: AlignmentCheck :: None ;
195
+ }
196
+ "-Zmiri-symbolic-alignment-check" => {
197
+ miri_config. check_alignment = miri:: AlignmentCheck :: Symbolic ;
205
198
}
206
199
"-Zmiri-disable-isolation" => {
207
- communicate = true ;
200
+ miri_config . communicate = true ;
208
201
}
209
202
"-Zmiri-ignore-leaks" => {
210
- ignore_leaks = true ;
203
+ miri_config . ignore_leaks = true ;
211
204
}
212
205
"--" => {
213
206
after_dashdash = true ;
214
207
}
215
208
arg if arg. starts_with ( "-Zmiri-seed=" ) => {
216
- if seed. is_some ( ) {
209
+ if miri_config . seed . is_some ( ) {
217
210
panic ! ( "Cannot specify -Zmiri-seed multiple times!" ) ;
218
211
}
219
212
let seed_raw = hex:: decode ( arg. strip_prefix ( "-Zmiri-seed=" ) . unwrap ( ) )
@@ -234,10 +227,10 @@ fn main() {
234
227
235
228
let mut bytes = [ 0 ; 8 ] ;
236
229
bytes[ ..seed_raw. len ( ) ] . copy_from_slice ( & seed_raw) ;
237
- seed = Some ( u64:: from_be_bytes ( bytes) ) ;
230
+ miri_config . seed = Some ( u64:: from_be_bytes ( bytes) ) ;
238
231
}
239
232
arg if arg. starts_with ( "-Zmiri-env-exclude=" ) => {
240
- excluded_env_vars
233
+ miri_config . excluded_env_vars
241
234
. push ( arg. strip_prefix ( "-Zmiri-env-exclude=" ) . unwrap ( ) . to_owned ( ) ) ;
242
235
}
243
236
arg if arg. starts_with ( "-Zmiri-track-pointer-tag=" ) => {
@@ -249,7 +242,7 @@ fn main() {
249
242
) ,
250
243
} ;
251
244
if let Some ( id) = miri:: PtrId :: new ( id) {
252
- tracked_pointer_tag = Some ( id) ;
245
+ miri_config . tracked_pointer_tag = Some ( id) ;
253
246
} else {
254
247
panic ! ( "-Zmiri-track-pointer-tag requires a nonzero argument" ) ;
255
248
}
@@ -263,7 +256,7 @@ fn main() {
263
256
) ,
264
257
} ;
265
258
if let Some ( id) = miri:: CallId :: new ( id) {
266
- tracked_call_id = Some ( id) ;
259
+ miri_config . tracked_call_id = Some ( id) ;
267
260
} else {
268
261
panic ! ( "-Zmiri-track-call-id requires a nonzero argument" ) ;
269
262
}
@@ -276,7 +269,7 @@ fn main() {
276
269
err
277
270
) ,
278
271
} ;
279
- tracked_alloc_id = Some ( miri:: AllocId ( id) ) ;
272
+ miri_config . tracked_alloc_id = Some ( miri:: AllocId ( id) ) ;
280
273
}
281
274
_ => {
282
275
// Forward to rustc.
@@ -287,19 +280,6 @@ fn main() {
287
280
}
288
281
289
282
debug ! ( "rustc arguments: {:?}" , rustc_args) ;
290
- debug ! ( "crate arguments: {:?}" , crate_args) ;
291
- let miri_config = miri:: MiriConfig {
292
- validate,
293
- stacked_borrows,
294
- check_alignment,
295
- communicate,
296
- ignore_leaks,
297
- excluded_env_vars,
298
- seed,
299
- args : crate_args,
300
- tracked_pointer_tag,
301
- tracked_call_id,
302
- tracked_alloc_id,
303
- } ;
283
+ debug ! ( "crate arguments: {:?}" , miri_config. args) ;
304
284
run_compiler ( rustc_args, & mut MiriCompilerCalls { miri_config } )
305
285
}
0 commit comments