-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #33476 - nikomatsakis:incr-comp-xcrate, r=mw
track incr. comp. dependencies across crates This PR refactors the compiler's incremental compilation hashing so that it can track dependencies across crates. The main bits are: - computing a hash representing the metadata for an item we are emitting - we do this by making `MetaData(X)` be the current task while computing metadata for an item - this naturally registers reads from any tables and things that we read for that purpose - we can then hash all the inputs to those tables - tracking when we access metadata - we do this by registering a read of `MetaData(X)` for each foreign item `X` whose metadata we read - hashing metadata from foreign items - we do this by loading up metadata from a file in the incr. comp. directory - if there is no file, we use the SVH for the entire crate There is one very simple test only at this point. The next PR will be focused on expanding out the tests. Note that this is based on top of #33228 r? @michaelwoerister
- Loading branch information
Showing
52 changed files
with
1,037 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Copyright 2012-2015 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. | ||
|
||
//! Code for debugging the dep-graph. | ||
use super::dep_node::DepNode; | ||
use std::error::Error; | ||
use std::fmt::Debug; | ||
|
||
/// A dep-node filter goes from a user-defined string to a query over | ||
/// nodes. Right now the format is like this: | ||
/// | ||
/// x & y & z | ||
/// | ||
/// where the format-string of the dep-node must contain `x`, `y`, and | ||
/// `z`. | ||
#[derive(Debug)] | ||
pub struct DepNodeFilter { | ||
text: String | ||
} | ||
|
||
impl DepNodeFilter { | ||
pub fn new(text: &str) -> Self { | ||
DepNodeFilter { | ||
text: text.trim().to_string() | ||
} | ||
} | ||
|
||
/// True if all nodes always pass the filter. | ||
pub fn accepts_all(&self) -> bool { | ||
self.text.is_empty() | ||
} | ||
|
||
/// Tests whether `node` meets the filter, returning true if so. | ||
pub fn test<D: Clone + Debug>(&self, node: &DepNode<D>) -> bool { | ||
let debug_str = format!("{:?}", node); | ||
self.text.split("&") | ||
.map(|s| s.trim()) | ||
.all(|f| debug_str.contains(f)) | ||
} | ||
} | ||
|
||
/// A filter like `F -> G` where `F` and `G` are valid dep-node | ||
/// filters. This can be used to test the source/target independently. | ||
pub struct EdgeFilter { | ||
pub source: DepNodeFilter, | ||
pub target: DepNodeFilter, | ||
} | ||
|
||
impl EdgeFilter { | ||
pub fn new(test: &str) -> Result<EdgeFilter, Box<Error>> { | ||
let parts: Vec<_> = test.split("->").collect(); | ||
if parts.len() != 2 { | ||
Err(format!("expected a filter like `a&b -> c&d`, not `{}`", test).into()) | ||
} else { | ||
Ok(EdgeFilter { | ||
source: DepNodeFilter::new(parts[0]), | ||
target: DepNodeFilter::new(parts[1]), | ||
}) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.