Get cargo clippy working on 64 bit windows again

fixes #1244
This commit is contained in:
Oliver Schneider 2017-02-28 12:47:48 +01:00
parent 0623730a96
commit 5c2549482a
2 changed files with 23 additions and 24 deletions

View file

@ -4,10 +4,8 @@ environment:
matrix:
- TARGET: i686-pc-windows-gnu
MSYS2_BITS: 32
RUN_CARGO_CLIPPY: true
- TARGET: i686-pc-windows-msvc
MSYS2_BITS: 32
RUN_CARGO_CLIPPY: true
- TARGET: x86_64-pc-windows-gnu
MSYS2_BITS: 64
- TARGET: x86_64-pc-windows-msvc
@ -29,7 +27,7 @@ test_script:
- cargo test --features debugging
- copy target\debug\cargo-clippy.exe C:\Users\appveyor\.cargo\bin\
- cargo clippy -- -D clippy
- if defined RUN_CARGO_CLIPPY cd clippy_lints && cargo clippy -- -D clippy && cd ..
- cd clippy_lints && cargo clippy -- -D clippy && cd ..
notifications:
- provider: Email

View file

@ -244,30 +244,31 @@ pub fn main() {
.expect("need to specify SYSROOT env var during clippy compilation, or use rustup or multirust")
};
// this conditional check for the --sysroot flag is there so users can call `cargo-clippy` directly
// without having to pass --sysroot or anything
let mut args: Vec<String> = if env::args().any(|s| s == "--sysroot") {
env::args().collect()
} else {
env::args().chain(Some("--sysroot".to_owned())).chain(Some(sys_root)).collect()
};
rustc_driver::in_rustc_thread(|| {
// this conditional check for the --sysroot flag is there so users can call `cargo-clippy` directly
// without having to pass --sysroot or anything
let mut args: Vec<String> = if env::args().any(|s| s == "--sysroot") {
env::args().collect()
} else {
env::args().chain(Some("--sysroot".to_owned())).chain(Some(sys_root)).collect()
};
// this check ensures that dependencies are built but not linted and the final crate is
// linted but not built
let clippy_enabled = env::args().any(|s| s == "-Zno-trans");
// this check ensures that dependencies are built but not linted and the final crate is
// linted but not built
let clippy_enabled = env::args().any(|s| s == "-Zno-trans");
if clippy_enabled {
args.extend_from_slice(&["--cfg".to_owned(), r#"feature="cargo-clippy""#.to_owned()]);
}
let mut ccc = ClippyCompilerCalls::new(clippy_enabled);
let (result, _) = rustc_driver::run_compiler(&args, &mut ccc, None, None);
if let Err(err_count) = result {
if err_count > 0 {
std::process::exit(1);
if clippy_enabled {
args.extend_from_slice(&["--cfg".to_owned(), r#"feature="cargo-clippy""#.to_owned()]);
}
}
let mut ccc = ClippyCompilerCalls::new(clippy_enabled);
let (result, _) = rustc_driver::run_compiler(&args, &mut ccc, None, None);
if let Err(err_count) = result {
if err_count > 0 {
std::process::exit(1);
}
}
}).expect("rustc_thread failed");
}
}