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 15 pull requests #39613

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
108293d
Added Default impl to PathBuf
Jan 1, 2017
6d9f359
Add i686-unknown-netbsdelf target
jakllsch Jan 23, 2017
5c9fdd1
doc comment rewording
king6cong Feb 3, 2017
e866d07
lint/ctypes: Don't warn on non-unsized structs with PhantomData.
emilio Feb 2, 2017
8579218
Improve error message for uninferrable types #38812
cengiz-io Jan 24, 2017
89ae2ca
Remove extra newlines from expectation files
cengiz-io Jan 24, 2017
7aff6ad
Remove extra note and revert name in message
cengiz-io Jan 25, 2017
3fa28cb
Add a new ui test and update existing ones
cengiz-io Feb 2, 2017
380ba6d
go back to use //
king6cong Feb 6, 2017
7c8c45e
Extract collections benchmarks to libcollections/benches
phungleson Feb 6, 2017
b975786
regr test
nikomatsakis Feb 6, 2017
78f542b
Rename i686-unknown-netbsdelf target to i686-unknown-netbsd
jakllsch Feb 6, 2017
fa0a728
back: Limit the number of LLVM worker threads.
michaelwoerister Feb 6, 2017
4f5fc4e
fix case where some edges can't be recreated by expanding the graph
nikomatsakis Feb 6, 2017
7c2752a
rustbuild: support setting verbosity in config.toml
Keruspe Feb 6, 2017
1ee88e5
A few documentation improvements for `syntax::print::pp`
bjorn3 Feb 5, 2017
4268872
rustbuild: add verbose to config.toml.example
Keruspe Feb 6, 2017
19bbd85
Fix branch name Cargo's downloaded from
alexcrichton Feb 5, 2017
bf126d2
Fix a manifest-generation bug on beta
alexcrichton Feb 6, 2017
235741f
liblibc: Update to include aarch64-unknown-freebsd support
dumbbell Feb 6, 2017
ddb0a78
Unignore u128 test for stage 0,1
est31 Feb 7, 2017
df73bc9
Fix ICE when accessing mutably an immutable enum
estebank Feb 6, 2017
c9eaa66
Rollup merge of #38764 - Aaronepower:master, r=aturon
frewsxcv Feb 7, 2017
c125b88
Rollup merge of #39361 - cengizIO:master, r=arielb1
frewsxcv Feb 7, 2017
fae92d8
Rollup merge of #39426 - jakllsch:netbsd-c, r=alexcrichton
frewsxcv Feb 7, 2017
9995b13
Rollup merge of #39462 - emilio:improper-ctypes, r=nikomatsakis
frewsxcv Feb 7, 2017
76f8873
Rollup merge of #39482 - king6cong:master, r=frewsxcv
frewsxcv Feb 7, 2017
cf7fbb7
Rollup merge of #39557 - bjorn3:pp-docs, r=jseyfried
frewsxcv Feb 7, 2017
2762b4d
Rollup merge of #39561 - phungleson:libcollectionsbench, r=alexcrichton
frewsxcv Feb 7, 2017
763d342
Rollup merge of #39582 - nikomatsakis:incr-comp-issue-39569, r=michae…
frewsxcv Feb 7, 2017
0deb522
Rollup merge of #39583 - michaelwoerister:limit-llvm-threads, r=nikom…
frewsxcv Feb 7, 2017
b5e4745
Rollup merge of #39587 - Keruspe:master, r=alexcrichton
frewsxcv Feb 7, 2017
985b050
Rollup merge of #39598 - alexcrichton:cargo-branch, r=brson
frewsxcv Feb 7, 2017
35ec4ba
Rollup merge of #39599 - alexcrichton:cargo-tarball-name, r=brson
frewsxcv Feb 7, 2017
20e2e0e
Rollup merge of #39601 - dumbbell:update-liblibc-to-include-aarch64-u…
frewsxcv Feb 7, 2017
cfaedd2
Rollup merge of #39602 - estebank:fix-39544, r=eddyb
frewsxcv Feb 7, 2017
9d5dbeb
Rollup merge of #39604 - est31:i128_tests, r=alexcrichton
frewsxcv Feb 7, 2017
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
119 changes: 84 additions & 35 deletions src/librustc_incremental/persist/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,46 +176,32 @@ pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
// Recreate the edges in the graph that are still clean.
let mut clean_work_products = FxHashSet();
let mut dirty_work_products = FxHashSet(); // incomplete; just used to suppress debug output
let mut extra_edges = vec![];
for (source, targets) in &edge_map {
for target in targets {
// If the target is dirty, skip the edge. If this is an edge
// that targets a work-product, we can print the blame
// information now.
if let Some(blame) = dirty_raw_nodes.get(target) {
if let DepNode::WorkProduct(ref wp) = *target {
if tcx.sess.opts.debugging_opts.incremental_info {
if dirty_work_products.insert(wp.clone()) {
// It'd be nice to pretty-print these paths better than just
// using the `Debug` impls, but wev.
println!("incremental: module {:?} is dirty because {:?} \
changed or was removed",
wp,
blame.map_def(|&index| {
Some(directory.def_path_string(tcx, index))
}).unwrap());
}
}
}
continue;
}

// If the source is dirty, the target will be dirty.
assert!(!dirty_raw_nodes.contains_key(source));

// Retrace the source -> target edges to def-ids and then
// create an edge in the graph. Retracing may yield none if
// some of the data happens to have been removed; this ought
// to be impossible unless it is dirty, so we can unwrap.
let source_node = retraced.map(source).unwrap();
let target_node = retraced.map(target).unwrap();
let _task = tcx.dep_graph.in_task(target_node);
tcx.dep_graph.read(source_node);
if let DepNode::WorkProduct(ref wp) = *target {
clean_work_products.insert(wp.clone());
}
process_edges(tcx, source, target, &edge_map, &directory, &retraced, &dirty_raw_nodes,
&mut clean_work_products, &mut dirty_work_products, &mut extra_edges);
}
}

// Subtle. Sometimes we have intermediate nodes that we can't recreate in the new graph.
// This is pretty unusual but it arises in a scenario like this:
//
// Hir(X) -> Foo(Y) -> Bar
//
// Note that the `Hir(Y)` is not an input to `Foo(Y)` -- this
// almost never happens, but can happen in some obscure
// scenarios. In that case, if `Y` is removed, then we can't
// recreate `Foo(Y)` (the def-id `Y` no longer exists); what we do
// then is to push the edge `Hir(X) -> Bar` onto `extra_edges`
// (along with any other targets of `Foo(Y)`). We will then add
// the edge from `Hir(X)` to `Bar` (or, if `Bar` itself cannot be
// recreated, to the targets of `Bar`).
while let Some((source, target)) = extra_edges.pop() {
process_edges(tcx, source, target, &edge_map, &directory, &retraced, &dirty_raw_nodes,
&mut clean_work_products, &mut dirty_work_products, &mut extra_edges);
}

// Add in work-products that are still clean, and delete those that are
// dirty.
reconcile_work_products(tcx, work_products, &clean_work_products);
Expand Down Expand Up @@ -393,3 +379,66 @@ fn load_prev_metadata_hashes(tcx: TyCtxt,
serialized_hashes.index_map.len());
}

fn process_edges<'a, 'tcx, 'edges>(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
source: &'edges DepNode<DefPathIndex>,
target: &'edges DepNode<DefPathIndex>,
edges: &'edges FxHashMap<DepNode<DefPathIndex>, Vec<DepNode<DefPathIndex>>>,
directory: &DefIdDirectory,
retraced: &RetracedDefIdDirectory,
dirty_raw_nodes: &DirtyNodes,
clean_work_products: &mut FxHashSet<Arc<WorkProductId>>,
dirty_work_products: &mut FxHashSet<Arc<WorkProductId>>,
extra_edges: &mut Vec<(&'edges DepNode<DefPathIndex>, &'edges DepNode<DefPathIndex>)>)
{
// If the target is dirty, skip the edge. If this is an edge
// that targets a work-product, we can print the blame
// information now.
if let Some(blame) = dirty_raw_nodes.get(target) {
if let DepNode::WorkProduct(ref wp) = *target {
if tcx.sess.opts.debugging_opts.incremental_info {
if dirty_work_products.insert(wp.clone()) {
// It'd be nice to pretty-print these paths better than just
// using the `Debug` impls, but wev.
println!("incremental: module {:?} is dirty because {:?} \
changed or was removed",
wp,
blame.map_def(|&index| {
Some(directory.def_path_string(tcx, index))
}).unwrap());
}
}
}
return;
}

// If the source is dirty, the target will be dirty.
assert!(!dirty_raw_nodes.contains_key(source));

// Retrace the source -> target edges to def-ids and then create
// an edge in the graph. Retracing may yield none if some of the
// data happens to have been removed.
if let Some(source_node) = retraced.map(source) {
if let Some(target_node) = retraced.map(target) {
let _task = tcx.dep_graph.in_task(target_node);
tcx.dep_graph.read(source_node);
if let DepNode::WorkProduct(ref wp) = *target {
clean_work_products.insert(wp.clone());
}
} else {
// As discussed in `decode_dep_graph` above, sometimes the
// target cannot be recreated again, in which case we add
// edges to go from `source` to the targets of `target`.
extra_edges.extend(
edges[target].iter().map(|t| (source, t)));
}
} else {
// It's also possible that the source can't be created! But we
// can ignore such cases, because (a) if `source` is a HIR
// node, it would be considered dirty; and (b) in other cases,
// there must be some input to this node that is clean, and so
// we'll re-create the edges over in the case where target is
// undefined.
}
}

38 changes: 38 additions & 0 deletions src/test/incremental/issue-39569.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright 2014 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.

// Regression test for a weird corner case in our dep-graph reduction
// code. When we solve `CoerceUnsized<Foo>`, we find no impls, so we
// don't end up with an edge to any HIR nodes, but it still gets
// preserved in the dep graph.

// revisions:rpass1 rpass2
// compile-flags: -Z query-dep-graph

use std::sync::Arc;

#[cfg(rpass1)]
struct Foo { x: usize }

#[cfg(rpass1)]
fn main() {
let x: Arc<Foo> = Arc::new(Foo { x: 22 });
let y: Arc<Foo> = x;
}

#[cfg(rpass2)]
struct FooX { x: usize }

#[cfg(rpass2)]
fn main() {
let x: Arc<FooX> = Arc::new(FooX { x: 22 });
let y: Arc<FooX> = x;
}