Auto merge of #42682 - alexcrichton:jobserver, r=michaelwoerister
Integrate jobserver support to parallel codegen This commit integrates the `jobserver` crate into the compiler. The crate was previously integrated in to Cargo as part of rust-lang/cargo#4110. The purpose here is to two-fold: * Primarily the compiler can cooperate with Cargo on parallelism. When you run `cargo build -j4` then this'll make sure that the entire build process between Cargo/rustc won't use more than 4 cores, whereas today you'd get 4 rustc instances which may all try to spawn lots of threads. * Secondarily rustc/Cargo can now integrate with a foreign GNU `make` jobserver. This means that if you call cargo/rustc from `make` or another jobserver-compatible implementation it'll use foreign parallelism settings instead of creating new ones locally. As the number of parallel codegen instances in the compiler continues to grow over time with the advent of incremental compilation it's expected that this'll become more of a problem, so this is intended to nip concurrent concerns in the bud by having all the tools to cooperate! Note that while rustc has support for itself creating a jobserver it's far more likely that rustc will always use the jobserver configured by Cargo. Cargo today will now set a jobserver unconditionally for rustc to use.
This commit is contained in:
commit
80271e8edf
19 changed files with 512 additions and 309 deletions
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
#![no_std]
|
||||
|
||||
extern crate rand;
|
||||
extern crate serialize as rustc_serialize;
|
||||
|
||||
#[derive(RustcEncodable)] //~ ERROR this trait cannot be derived
|
||||
|
|
|
|||
|
|
@ -7,17 +7,16 @@
|
|||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
//
|
||||
|
||||
// WONTFIX(#20184) Needs landing pads (not present in stage1) or the compiler hangs.
|
||||
// ignore-stage1
|
||||
// compile-flags: -C codegen-units=2
|
||||
// error-pattern: build without -C codegen-units for more exact errors
|
||||
// ignore-emscripten
|
||||
|
||||
#![feature(asm)]
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
asm!("nowayisthisavalidinstruction");
|
||||
asm!("nowayisthisavalidinstruction"); //~ ERROR instruction
|
||||
}
|
||||
}
|
||||
|
|
|
|||
11
src/test/compile-fail/auxiliary/issue-36881-aux.rs
Normal file
11
src/test/compile-fail/auxiliary/issue-36881-aux.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub trait Foo {}
|
||||
11
src/test/compile-fail/auxiliary/lint_unused_extern_crate2.rs
Normal file
11
src/test/compile-fail/auxiliary/lint_unused_extern_crate2.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub fn foo() {}
|
||||
11
src/test/compile-fail/auxiliary/lint_unused_extern_crate3.rs
Normal file
11
src/test/compile-fail/auxiliary/lint_unused_extern_crate3.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub fn foo() {}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
|
@ -8,9 +8,9 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(rand)]
|
||||
// aux-build:issue-36881-aux.rs
|
||||
|
||||
fn main() {
|
||||
extern crate rand;
|
||||
use rand::Rng; //~ ERROR unresolved import
|
||||
extern crate issue_36881_aux;
|
||||
use issue_36881_aux::Foo; //~ ERROR unresolved import
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,34 +9,34 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:lint_unused_extern_crate.rs
|
||||
// aux-build:lint_unused_extern_crate2.rs
|
||||
// aux-build:lint_unused_extern_crate3.rs
|
||||
// aux-build:lint_unused_extern_crate4.rs
|
||||
|
||||
#![deny(unused_extern_crates)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(deprecated)]
|
||||
#![feature(alloc)]
|
||||
#![feature(libc)]
|
||||
#![feature(rand)]
|
||||
|
||||
extern crate libc; //~ ERROR: unused extern crate
|
||||
extern crate lint_unused_extern_crate4; //~ ERROR: unused extern crate
|
||||
|
||||
extern crate alloc as collecs; // no error, it is used
|
||||
extern crate lint_unused_extern_crate3; // no error, it is used
|
||||
|
||||
extern crate rand; // no error, the use marks it as used
|
||||
// even if imported objects aren't used
|
||||
extern crate lint_unused_extern_crate2; // no error, the use marks it as used
|
||||
// even if imported objects aren't used
|
||||
|
||||
extern crate lint_unused_extern_crate as other; // no error, the use * marks it as used
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use rand::isaac::IsaacRng;
|
||||
use lint_unused_extern_crate2::foo as bar;
|
||||
|
||||
use other::*;
|
||||
|
||||
mod foo {
|
||||
// Test that this is unused even though an earler `extern crate rand` is used.
|
||||
extern crate rand; //~ ERROR unused extern crate
|
||||
// Test that this is unused even though an earler `extern crate` is used.
|
||||
extern crate lint_unused_extern_crate2; //~ ERROR unused extern crate
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x: collecs::vec::Vec<usize> = Vec::new();
|
||||
lint_unused_extern_crate3::foo();
|
||||
let y = foo();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,13 @@
|
|||
|
||||
// no-prefer-dynamic
|
||||
|
||||
#![feature(allocator, core_intrinsics)]
|
||||
#![feature(allocator, core_intrinsics, panic_unwind)]
|
||||
#![allocator]
|
||||
#![crate_type = "rlib"]
|
||||
#![no_std]
|
||||
|
||||
extern crate unwind;
|
||||
|
||||
pub static mut HITS: usize = 0;
|
||||
|
||||
type size_t = usize;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue