Auto merge of #1199 - RalfJung:cargo-miri, r=RalfJung

cargo-miri: fix trailing indent in xargo files
This commit is contained in:
bors 2020-03-01 20:24:37 +00:00
commit 263eedc6ea
3 changed files with 24 additions and 21 deletions

View file

@ -353,7 +353,7 @@ default_features = false
features = ["panic_unwind"]
[dependencies.test]
"#,
"#,
)
.unwrap();
// The boring bits: a dummy project for xargo.
@ -369,7 +369,7 @@ version = "0.0.0"
[lib]
path = "lib.rs"
"#,
"#,
)
.unwrap();
File::create(dir.join("lib.rs")).unwrap();
@ -563,7 +563,8 @@ fn inside_cargo_rustc() {
// other args for target crates - that is, crates which are ultimately
// going to get interpreted by Miri.
if target_crate {
let sysroot = std::env::var("MIRI_SYSROOT").expect("The wrapper should have set MIRI_SYSROOT");
let sysroot =
std::env::var("MIRI_SYSROOT").expect("The wrapper should have set MIRI_SYSROOT");
args.push("--sysroot".to_owned());
args.push(sysroot);
args.splice(0..0, miri::miri_default_args().iter().map(ToString::to_string));
@ -571,20 +572,20 @@ fn inside_cargo_rustc() {
// Figure out the binary we need to call. If this is a runnable target crate, we want to call
// Miri to start interpretation; otherwise we want to call rustc to build the crate as usual.
let mut command =
if target_crate && is_runnable_crate() {
// This is the 'target crate' - the binary or test crate that
// we want to interpret under Miri. We deserialize the user-provided arguments
// from the special environment variable "MIRI_ARGS", and feed them
// to the 'miri' binary.
let magic = std::env::var("MIRI_ARGS").expect("missing MIRI_ARGS");
let mut user_args: Vec<String> = serde_json::from_str(&magic).expect("failed to deserialize MIRI_ARGS");
args.append(&mut user_args);
// Run this in Miri.
Command::new(find_miri())
} else {
Command::new("rustc")
};
let mut command = if target_crate && is_runnable_crate() {
// This is the 'target crate' - the binary or test crate that
// we want to interpret under Miri. We deserialize the user-provided arguments
// from the special environment variable "MIRI_ARGS", and feed them
// to the 'miri' binary.
let magic = std::env::var("MIRI_ARGS").expect("missing MIRI_ARGS");
let mut user_args: Vec<String> =
serde_json::from_str(&magic).expect("failed to deserialize MIRI_ARGS");
args.append(&mut user_args);
// Run this in Miri.
Command::new(find_miri())
} else {
Command::new("rustc")
};
// Run it.
command.args(&args);

View file

@ -15,11 +15,11 @@ use std::io::Write;
use std::path::Path;
use std::sync::{Arc, Mutex};
use rustc::ty::TyCtxt;
use rustc_driver::Compilation;
use rustc_hir as hir;
use rustc_hir::def_id::LOCAL_CRATE;
use rustc_hir::itemlikevisit;
use rustc::ty::TyCtxt;
use rustc_driver::Compilation;
use rustc_interface::{interface, Queries};
use miri::MiriConfig;
@ -42,7 +42,9 @@ impl rustc_driver::Callbacks for MiriCompilerCalls {
impl<'tcx, 'hir> itemlikevisit::ItemLikeVisitor<'hir> for Visitor<'tcx> {
fn visit_item(&mut self, i: &'hir hir::Item) {
if let hir::ItemKind::Fn(.., body_id) = i.kind {
if i.attrs.iter().any(|attr| attr.check_name(rustc_span::symbol::sym::test))
if i.attrs
.iter()
.any(|attr| attr.check_name(rustc_span::symbol::sym::test))
{
let config = MiriConfig {
validate: true,

View file

@ -21,8 +21,8 @@ use std::str::FromStr;
use hex::FromHexError;
use rustc_hir::def_id::LOCAL_CRATE;
use rustc_driver::Compilation;
use rustc_hir::def_id::LOCAL_CRATE;
use rustc_interface::{interface, Queries};
struct MiriCompilerCalls {