Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 11 pull requests #64981

Merged
merged 38 commits into from
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a3639c6
Make all alt builders produce parallel-enabled compilers
Mark-Simulacrum Sep 23, 2019
3b506d9
Remove `NodeState::OnDfsStack`.
nnethercote Sep 24, 2019
4a7fb8b
Rename `node_index` as `index`.
nnethercote Sep 24, 2019
85a56cb
Inline `mark_as_waiting_from`.
nnethercote Sep 24, 2019
7130e6c
Tweak the control flow in `process_obligations()`.
nnethercote Sep 24, 2019
ea72650
Use `filter` and `map` in `to_errors`.
nnethercote Sep 24, 2019
22943ee
Remove unnecessary uses of `ObligationForest::scratch`.
nnethercote Sep 24, 2019
6fb1f37
Introduce some intermediate variables that aid readability.
nnethercote Sep 25, 2019
9e67f19
Convert some `match` expressions to `if`s.
nnethercote Sep 25, 2019
8a62bb1
Rename `nodes_len` and use it in a few more places.
nnethercote Sep 25, 2019
2883c25
Remove an out-of-date sentence in a comment.
nnethercote Sep 25, 2019
a820672
Avoid the popping loop at the end of `compress()`.
nnethercote Sep 26, 2019
5ca99b7
Avoid `chain()` in `find_constraint_paths_between_regions()`.
nnethercote Sep 25, 2019
b0b073c
Self-Profiling: Refactor SelfProfiler API to be RAII based where poss…
michaelwoerister Sep 27, 2019
d942622
Self-Profiling: Make names of existing events more consistent and use…
michaelwoerister Sep 27, 2019
1a1067d
Make the default parallelism 1
Mark-Simulacrum Sep 30, 2019
2ae87ff
Avoid ICE on return outside of fn with literal array
estebank Sep 21, 2019
0e6fb8e
review comments
estebank Sep 21, 2019
8737061
replace try_for_each with try_fold to generate less code
andjo403 Oct 1, 2019
e1d9f82
Update cargo.
michaelwoerister Oct 1, 2019
f10d2e2
Fix clippy warnings
JohnTitor Oct 1, 2019
4447388
Update `Cargo.lock` for cargo update
alexcrichton Oct 1, 2019
8d9abcd
Update rls submodule
alexcrichton Oct 1, 2019
1611238
Reset row background for each block
ecstatic-morse Oct 1, 2019
ffc52a7
Update example table to match current output
ecstatic-morse Oct 1, 2019
bd7cd80
Fully clear `HandlerInner` in `Handler::reset_err_count`
AnthonyMikh Oct 2, 2019
04427b1
Update books
ehuss Oct 2, 2019
c11cb25
Rollup merge of #64649 - estebank:returnator, r=varkor
tmandry Oct 2, 2019
65a050f
Rollup merge of #64722 - Mark-Simulacrum:alt-parallel, r=alexcrichton
tmandry Oct 2, 2019
bd9d843
Rollup merge of #64801 - nnethercote:improve-find_constraint_paths_be…
tmandry Oct 2, 2019
0e88e56
Rollup merge of #64805 - nnethercote:ObligForest-still-more, r=nikoma…
tmandry Oct 2, 2019
8f5f92a
Rollup merge of #64840 - michaelwoerister:self-profiling-raii-refacto…
tmandry Oct 2, 2019
76fb91b
Rollup merge of #64885 - andjo403:iter, r=scottmcm
tmandry Oct 2, 2019
73aa2bd
Rollup merge of #64942 - JohnTitor:fix-clippy, r=eddyb
tmandry Oct 2, 2019
2f29548
Rollup merge of #64952 - michaelwoerister:update-cargo, r=alexcrichton
tmandry Oct 2, 2019
643ae95
Rollup merge of #64974 - ecstatic-morse:generic-graphviz-zebra, r=pet…
tmandry Oct 2, 2019
4e2bfe2
Rollup merge of #64978 - AnthonyMikh:librustc_errors/lib__fully_clear…
tmandry Oct 2, 2019
0878ca5
Rollup merge of #64979 - ehuss:update-books, r=ehuss
tmandry Oct 2, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ dependencies = [

[[package]]
name = "cargo"
version = "0.40.0"
version = "0.41.0"
dependencies = [
"atty",
"bytesize",
Expand Down Expand Up @@ -600,7 +600,7 @@ checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"

[[package]]
name = "crates-io"
version = "0.28.0"
version = "0.29.0"
dependencies = [
"curl",
"failure",
Expand Down Expand Up @@ -730,25 +730,24 @@ dependencies = [

[[package]]
name = "curl"
version = "0.4.21"
version = "0.4.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a85f2f95f2bd277d316d1aa8a477687ab4a6942258c7db7c89c187534669979c"
checksum = "d08ad3cb89d076a36b0ce5749eec2c9964f70c0c58480ab6b75a91ec4fc206d8"
dependencies = [
"curl-sys",
"kernel32-sys",
"libc",
"openssl-probe",
"openssl-sys",
"schannel",
"socket2",
"winapi 0.2.8",
"winapi 0.3.6",
]

[[package]]
name = "curl-sys"
version = "0.4.18"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d91a0052d5b982887d8e829bee0faffc7218ea3c6ebd3d6c2c8f678a93c9a42"
checksum = "2e9a9a4e417722876332136a00cacf92c2ceb331fab4b52b6a1ad16c6cd79255"
dependencies = [
"cc",
"libc",
Expand Down
3 changes: 3 additions & 0 deletions src/ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ if [ "$DEPLOY$DEPLOY_ALT" = "1" ]; then
if [ "$NO_LLVM_ASSERTIONS" = "1" ]; then
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-llvm-assertions"
elif [ "$DEPLOY_ALT" != "" ]; then
if [ "$NO_PARALLEL_COMPILER" = "" ]; then
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.parallel-compiler"
fi
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-assertions"
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.verify-llvm-ir"
fi
Expand Down
2 changes: 1 addition & 1 deletion src/doc/reference
2 changes: 1 addition & 1 deletion src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ impl DroplessArena {
// though it was supposed to give us `len`
return slice::from_raw_parts_mut(mem, i);
}
ptr::write(mem.offset(i as isize), value.unwrap());
ptr::write(mem.add(i), value.unwrap());
i += 1;
}
}
Expand Down
27 changes: 14 additions & 13 deletions src/libcore/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1859,14 +1859,13 @@ pub trait Iterator {
Self: Sized, F: FnMut(Self::Item) -> bool
{
#[inline]
fn check<T>(mut f: impl FnMut(T) -> bool) -> impl FnMut(T) -> LoopState<(), ()> {
move |x| {
fn check<T>(mut f: impl FnMut(T) -> bool) -> impl FnMut((), T) -> LoopState<(), ()> {
move |(), x| {
if f(x) { LoopState::Continue(()) }
else { LoopState::Break(()) }
}
}

self.try_for_each(check(f)) == LoopState::Continue(())
self.try_fold((), check(f)) == LoopState::Continue(())
}

/// Tests if any element of the iterator matches a predicate.
Expand Down Expand Up @@ -1913,14 +1912,14 @@ pub trait Iterator {
F: FnMut(Self::Item) -> bool
{
#[inline]
fn check<T>(mut f: impl FnMut(T) -> bool) -> impl FnMut(T) -> LoopState<(), ()> {
move |x| {
fn check<T>(mut f: impl FnMut(T) -> bool) -> impl FnMut((), T) -> LoopState<(), ()> {
move |(), x| {
if f(x) { LoopState::Break(()) }
else { LoopState::Continue(()) }
}
}

self.try_for_each(check(f)) == LoopState::Break(())
self.try_fold((), check(f)) == LoopState::Break(())
}

/// Searches for an element of an iterator that satisfies a predicate.
Expand Down Expand Up @@ -1972,14 +1971,16 @@ pub trait Iterator {
P: FnMut(&Self::Item) -> bool,
{
#[inline]
fn check<T>(mut predicate: impl FnMut(&T) -> bool) -> impl FnMut(T) -> LoopState<(), T> {
move |x| {
fn check<T>(
mut predicate: impl FnMut(&T) -> bool
) -> impl FnMut((), T) -> LoopState<(), T> {
move |(), x| {
if predicate(&x) { LoopState::Break(x) }
else { LoopState::Continue(()) }
}
}

self.try_for_each(check(predicate)).break_value()
self.try_fold((), check(predicate)).break_value()
}

/// Applies function to the elements of iterator and returns
Expand All @@ -2004,14 +2005,14 @@ pub trait Iterator {
F: FnMut(Self::Item) -> Option<B>,
{
#[inline]
fn check<T, B>(mut f: impl FnMut(T) -> Option<B>) -> impl FnMut(T) -> LoopState<(), B> {
move |x| match f(x) {
fn check<T, B>(mut f: impl FnMut(T) -> Option<B>) -> impl FnMut((), T) -> LoopState<(), B> {
move |(), x| match f(x) {
Some(x) => LoopState::Break(x),
None => LoopState::Continue(()),
}
}

self.try_for_each(check(f)).break_value()
self.try_fold((), check(f)).break_value()
}

/// Searches for an element in an iterator, returning its index.
Expand Down
19 changes: 16 additions & 3 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,7 @@ macro_rules! options {
pub const parse_list: Option<&str> = Some("a space-separated list of strings");
pub const parse_opt_list: Option<&str> = Some("a space-separated list of strings");
pub const parse_opt_comma_list: Option<&str> = Some("a comma-separated list of strings");
pub const parse_threads: Option<&str> = Some("a number");
pub const parse_uint: Option<&str> = Some("a number");
pub const parse_passes: Option<&str> =
Some("a space-separated list of passes, or `all`");
Expand Down Expand Up @@ -948,6 +949,14 @@ macro_rules! options {
}
}

fn parse_threads(slot: &mut usize, v: Option<&str>) -> bool {
match v.and_then(|s| s.parse().ok()) {
Some(0) => { *slot = ::num_cpus::get(); true },
Some(i) => { *slot = i; true },
None => false
}
}

fn parse_uint(slot: &mut usize, v: Option<&str>) -> bool {
match v.and_then(|s| s.parse().ok()) {
Some(i) => { *slot = i; true },
Expand Down Expand Up @@ -1251,7 +1260,11 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"prints the LLVM optimization passes being run"),
ast_json: bool = (false, parse_bool, [UNTRACKED],
"print the AST as JSON and halt"),
threads: Option<usize> = (None, parse_opt_uint, [UNTRACKED],
// We default to 1 here since we want to behave like
// a sequential compiler for now. This'll likely be adjusted
// in the future. Note that -Zthreads=0 is the way to get
// the num_cpus behavior.
threads: usize = (1, parse_threads, [UNTRACKED],
"use a thread pool with N threads"),
ast_json_noexpand: bool = (false, parse_bool, [UNTRACKED],
"print the pre-expansion AST as JSON and halt"),
Expand Down Expand Up @@ -2146,14 +2159,14 @@ pub fn build_session_options_and_crate_config(
}
}

if debugging_opts.threads == Some(0) {
if debugging_opts.threads == 0 {
early_error(
error_format,
"value for threads must be a positive non-zero integer",
);
}

if debugging_opts.threads.unwrap_or(1) > 1 && debugging_opts.fuel.is_some() {
if debugging_opts.threads > 1 && debugging_opts.fuel.is_some() {
early_error(
error_format,
"optimization fuel is incompatible with multiple threads",
Expand Down
32 changes: 4 additions & 28 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use syntax::source_map;
use syntax::parse::{self, ParseSess};
use syntax::symbol::Symbol;
use syntax_pos::{MultiSpan, Span};
use crate::util::profiling::SelfProfiler;
use crate::util::profiling::{SelfProfiler, SelfProfilerRef};

use rustc_target::spec::{PanicStrategy, RelroLevel, Target, TargetTriple};
use rustc_data_structures::flock;
Expand Down Expand Up @@ -129,7 +129,7 @@ pub struct Session {
pub profile_channel: Lock<Option<mpsc::Sender<ProfileQueriesMsg>>>,

/// Used by `-Z self-profile`.
pub self_profiling: Option<Arc<SelfProfiler>>,
pub prof: SelfProfilerRef,

/// Some measurements that are being gathered during compilation.
pub perf_stats: PerfStats,
Expand Down Expand Up @@ -835,24 +835,6 @@ impl Session {
}
}

#[inline(never)]
#[cold]
fn profiler_active<F: FnOnce(&SelfProfiler) -> ()>(&self, f: F) {
match &self.self_profiling {
None => bug!("profiler_active() called but there was no profiler active"),
Some(profiler) => {
f(&profiler);
}
}
}

#[inline(always)]
pub fn profiler<F: FnOnce(&SelfProfiler) -> ()>(&self, f: F) {
if unlikely!(self.self_profiling.is_some()) {
self.profiler_active(f)
}
}

pub fn print_perf_stats(&self) {
println!(
"Total time spent computing symbol hashes: {}",
Expand Down Expand Up @@ -896,16 +878,10 @@ impl Session {
ret
}

/// Returns the number of query threads that should be used for this
/// compilation
pub fn threads_from_count(query_threads: Option<usize>) -> usize {
query_threads.unwrap_or(::num_cpus::get())
}

/// Returns the number of query threads that should be used for this
/// compilation
pub fn threads(&self) -> usize {
Self::threads_from_count(self.opts.debugging_opts.threads)
self.opts.debugging_opts.threads
}

/// Returns the number of codegen units that should be used for this
Expand Down Expand Up @@ -1257,7 +1233,7 @@ fn build_session_(
imported_macro_spans: OneThread::new(RefCell::new(FxHashMap::default())),
incr_comp_session: OneThread::new(RefCell::new(IncrCompSession::NotInitialized)),
cgu_reuse_tracker,
self_profiling: self_profiler,
prof: SelfProfilerRef::new(self_profiler),
profile_channel: Lock::new(None),
perf_stats: PerfStats {
symbol_hash_time: Lock::new(Duration::from_secs(0)),
Expand Down
4 changes: 4 additions & 0 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ use crate::ty::CanonicalPolyFnSig;
use crate::util::common::ErrorReported;
use crate::util::nodemap::{DefIdMap, DefIdSet, ItemLocalMap, ItemLocalSet};
use crate::util::nodemap::{FxHashMap, FxHashSet};
use crate::util::profiling::SelfProfilerRef;

use errors::DiagnosticBuilder;
use arena::SyncDroplessArena;
Expand Down Expand Up @@ -1030,6 +1031,8 @@ pub struct GlobalCtxt<'tcx> {

pub dep_graph: DepGraph,

pub prof: SelfProfilerRef,

/// Common objects.
pub common: Common<'tcx>,

Expand Down Expand Up @@ -1260,6 +1263,7 @@ impl<'tcx> TyCtxt<'tcx> {
arena: WorkerLocal::new(|_| Arena::default()),
interners,
dep_graph,
prof: s.prof.clone(),
common,
types: common_types,
lifetimes: common_lifetimes,
Expand Down
Loading