Skip to content

Commit 263eedc

Browse files
committed
Auto merge of #1199 - RalfJung:cargo-miri, r=RalfJung
cargo-miri: fix trailing indent in xargo files
2 parents fe5d977 + 48a4e3f commit 263eedc

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

src/bin/cargo-miri.rs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ default_features = false
353353
features = ["panic_unwind"]
354354
355355
[dependencies.test]
356-
"#,
356+
"#,
357357
)
358358
.unwrap();
359359
// The boring bits: a dummy project for xargo.
@@ -369,7 +369,7 @@ version = "0.0.0"
369369
370370
[lib]
371371
path = "lib.rs"
372-
"#,
372+
"#,
373373
)
374374
.unwrap();
375375
File::create(dir.join("lib.rs")).unwrap();
@@ -563,28 +563,29 @@ fn inside_cargo_rustc() {
563563
// other args for target crates - that is, crates which are ultimately
564564
// going to get interpreted by Miri.
565565
if target_crate {
566-
let sysroot = std::env::var("MIRI_SYSROOT").expect("The wrapper should have set MIRI_SYSROOT");
566+
let sysroot =
567+
std::env::var("MIRI_SYSROOT").expect("The wrapper should have set MIRI_SYSROOT");
567568
args.push("--sysroot".to_owned());
568569
args.push(sysroot);
569570
args.splice(0..0, miri::miri_default_args().iter().map(ToString::to_string));
570571
}
571572

572573
// Figure out the binary we need to call. If this is a runnable target crate, we want to call
573574
// Miri to start interpretation; otherwise we want to call rustc to build the crate as usual.
574-
let mut command =
575-
if target_crate && is_runnable_crate() {
576-
// This is the 'target crate' - the binary or test crate that
577-
// we want to interpret under Miri. We deserialize the user-provided arguments
578-
// from the special environment variable "MIRI_ARGS", and feed them
579-
// to the 'miri' binary.
580-
let magic = std::env::var("MIRI_ARGS").expect("missing MIRI_ARGS");
581-
let mut user_args: Vec<String> = serde_json::from_str(&magic).expect("failed to deserialize MIRI_ARGS");
582-
args.append(&mut user_args);
583-
// Run this in Miri.
584-
Command::new(find_miri())
585-
} else {
586-
Command::new("rustc")
587-
};
575+
let mut command = if target_crate && is_runnable_crate() {
576+
// This is the 'target crate' - the binary or test crate that
577+
// we want to interpret under Miri. We deserialize the user-provided arguments
578+
// from the special environment variable "MIRI_ARGS", and feed them
579+
// to the 'miri' binary.
580+
let magic = std::env::var("MIRI_ARGS").expect("missing MIRI_ARGS");
581+
let mut user_args: Vec<String> =
582+
serde_json::from_str(&magic).expect("failed to deserialize MIRI_ARGS");
583+
args.append(&mut user_args);
584+
// Run this in Miri.
585+
Command::new(find_miri())
586+
} else {
587+
Command::new("rustc")
588+
};
588589

589590
// Run it.
590591
command.args(&args);

src/bin/miri-rustc-tests.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ use std::io::Write;
1515
use std::path::Path;
1616
use std::sync::{Arc, Mutex};
1717

18+
use rustc::ty::TyCtxt;
19+
use rustc_driver::Compilation;
1820
use rustc_hir as hir;
1921
use rustc_hir::def_id::LOCAL_CRATE;
2022
use rustc_hir::itemlikevisit;
21-
use rustc::ty::TyCtxt;
22-
use rustc_driver::Compilation;
2323
use rustc_interface::{interface, Queries};
2424

2525
use miri::MiriConfig;
@@ -42,7 +42,9 @@ impl rustc_driver::Callbacks for MiriCompilerCalls {
4242
impl<'tcx, 'hir> itemlikevisit::ItemLikeVisitor<'hir> for Visitor<'tcx> {
4343
fn visit_item(&mut self, i: &'hir hir::Item) {
4444
if let hir::ItemKind::Fn(.., body_id) = i.kind {
45-
if i.attrs.iter().any(|attr| attr.check_name(rustc_span::symbol::sym::test))
45+
if i.attrs
46+
.iter()
47+
.any(|attr| attr.check_name(rustc_span::symbol::sym::test))
4648
{
4749
let config = MiriConfig {
4850
validate: true,

src/bin/miri.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use std::str::FromStr;
2121

2222
use hex::FromHexError;
2323

24-
use rustc_hir::def_id::LOCAL_CRATE;
2524
use rustc_driver::Compilation;
25+
use rustc_hir::def_id::LOCAL_CRATE;
2626
use rustc_interface::{interface, Queries};
2727

2828
struct MiriCompilerCalls {

0 commit comments

Comments
 (0)