Merge pull request #1581 from Manishearth/cargofix

Get cargo clippy working on 64 bit windows again
This commit is contained in:
Oliver Schneider 2017-02-28 14:30:15 +01:00 committed by GitHub
commit a39b5f95b8
5 changed files with 30 additions and 27 deletions

View file

@ -1,6 +1,9 @@
# Change Log # Change Log
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## 0.0.116 — 2017-02-28
* Fix `cargo clippy` on 64 bit windows systems
## 0.0.115 — 2017-02-27 ## 0.0.115 — 2017-02-27
* Rustup to *rustc 1.17.0-nightly (60a0edc6c 2017-02-26)* * Rustup to *rustc 1.17.0-nightly (60a0edc6c 2017-02-26)*
* New lints: [`zero_ptr`], [`never_loop`], [`mut_from_ref`] * New lints: [`zero_ptr`], [`never_loop`], [`mut_from_ref`]

View file

@ -1,6 +1,6 @@
[package] [package]
name = "clippy" name = "clippy"
version = "0.0.115" version = "0.0.116"
authors = [ authors = [
"Manish Goregaokar <manishsmail@gmail.com>", "Manish Goregaokar <manishsmail@gmail.com>",
"Andre Bogus <bogusandre@gmail.com>", "Andre Bogus <bogusandre@gmail.com>",
@ -30,7 +30,7 @@ test = false
[dependencies] [dependencies]
# begin automatic update # begin automatic update
clippy_lints = { version = "0.0.115", path = "clippy_lints" } clippy_lints = { version = "0.0.116", path = "clippy_lints" }
# end automatic update # end automatic update
cargo_metadata = "0.1.1" cargo_metadata = "0.1.1"

View file

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

View file

@ -1,7 +1,7 @@
[package] [package]
name = "clippy_lints" name = "clippy_lints"
# begin automatic update # begin automatic update
version = "0.0.115" version = "0.0.116"
# end automatic update # end automatic update
authors = [ authors = [
"Manish Goregaokar <manishsmail@gmail.com>", "Manish Goregaokar <manishsmail@gmail.com>",

View file

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