librustc_incremental => 2018

This commit is contained in:
Taiki Endo 2019-02-08 21:16:35 +09:00
parent 1efdda10cd
commit 4f2e97e0ed
8 changed files with 29 additions and 32 deletions

View file

@ -2,6 +2,7 @@
authors = ["The Rust Project Developers"] authors = ["The Rust Project Developers"]
name = "rustc_incremental" name = "rustc_incremental"
version = "0.0.0" version = "0.0.0"
edition = "2018"
[lib] [lib]
name = "rustc_incremental" name = "rustc_incremental"

View file

@ -217,7 +217,7 @@ fn check_paths<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
} }
} }
fn dump_graph(tcx: TyCtxt) { fn dump_graph(tcx: TyCtxt<'_, '_, '_>) {
let path: String = env::var("RUST_DEP_GRAPH").unwrap_or_else(|_| "dep_graph".to_string()); let path: String = env::var("RUST_DEP_GRAPH").unwrap_or_else(|_| "dep_graph".to_string());
let query = tcx.dep_graph.query(); let query = tcx.dep_graph.query();
@ -261,11 +261,11 @@ pub struct GraphvizDepGraph<'q>(FxHashSet<&'q DepNode>,
impl<'a, 'tcx, 'q> dot::GraphWalk<'a> for GraphvizDepGraph<'q> { impl<'a, 'tcx, 'q> dot::GraphWalk<'a> for GraphvizDepGraph<'q> {
type Node = &'q DepNode; type Node = &'q DepNode;
type Edge = (&'q DepNode, &'q DepNode); type Edge = (&'q DepNode, &'q DepNode);
fn nodes(&self) -> dot::Nodes<&'q DepNode> { fn nodes(&self) -> dot::Nodes<'_, &'q DepNode> {
let nodes: Vec<_> = self.0.iter().cloned().collect(); let nodes: Vec<_> = self.0.iter().cloned().collect();
nodes.into() nodes.into()
} }
fn edges(&self) -> dot::Edges<(&'q DepNode, &'q DepNode)> { fn edges(&self) -> dot::Edges<'_, (&'q DepNode, &'q DepNode)> {
self.1[..].into() self.1[..].into()
} }
fn source(&self, edge: &(&'q DepNode, &'q DepNode)) -> &'q DepNode { fn source(&self, edge: &(&'q DepNode, &'q DepNode)) -> &'q DepNode {
@ -279,10 +279,10 @@ impl<'a, 'tcx, 'q> dot::GraphWalk<'a> for GraphvizDepGraph<'q> {
impl<'a, 'tcx, 'q> dot::Labeller<'a> for GraphvizDepGraph<'q> { impl<'a, 'tcx, 'q> dot::Labeller<'a> for GraphvizDepGraph<'q> {
type Node = &'q DepNode; type Node = &'q DepNode;
type Edge = (&'q DepNode, &'q DepNode); type Edge = (&'q DepNode, &'q DepNode);
fn graph_id(&self) -> dot::Id { fn graph_id(&self) -> dot::Id<'_> {
dot::Id::new("DependencyGraph").unwrap() dot::Id::new("DependencyGraph").unwrap()
} }
fn node_id(&self, n: &&'q DepNode) -> dot::Id { fn node_id(&self, n: &&'q DepNode) -> dot::Id<'_> {
let s: String = let s: String =
format!("{:?}", n).chars() format!("{:?}", n).chars()
.map(|c| if c == '_' || c.is_alphanumeric() { c } else { '_' }) .map(|c| if c == '_' || c.is_alphanumeric() { c } else { '_' })
@ -290,7 +290,7 @@ impl<'a, 'tcx, 'q> dot::Labeller<'a> for GraphvizDepGraph<'q> {
debug!("n={:?} s={:?}", n, s); debug!("n={:?} s={:?}", n, s);
dot::Id::new(s).unwrap() dot::Id::new(s).unwrap()
} }
fn node_label(&self, n: &&'q DepNode) -> dot::LabelText { fn node_label(&self, n: &&'q DepNode) -> dot::LabelText<'_> {
dot::LabelText::label(format!("{:?}", n)) dot::LabelText::label(format!("{:?}", n))
} }
} }

View file

@ -9,16 +9,13 @@
#![recursion_limit="256"] #![recursion_limit="256"]
extern crate graphviz; #![deny(rust_2018_idioms)]
#[macro_use] extern crate rustc; #[macro_use] extern crate rustc;
extern crate rustc_data_structures; #[allow(unused_extern_crates)]
extern crate serialize as rustc_serialize; extern crate serialize as rustc_serialize; // used by deriving
extern crate rand;
extern crate rustc_fs_util;
#[macro_use] extern crate log; #[macro_use] extern crate log;
extern crate syntax;
extern crate syntax_pos;
mod assert_dep_graph; mod assert_dep_graph;
pub mod assert_module_sources; pub mod assert_module_sources;

View file

@ -538,7 +538,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for DirtyCleanVisitor<'a, 'tcx> {
/// ///
/// Also make sure that the `label` and `except` fields do not /// Also make sure that the `label` and `except` fields do not
/// both exist. /// both exist.
fn check_config(tcx: TyCtxt, attr: &Attribute) -> bool { fn check_config(tcx: TyCtxt<'_, '_, '_>, attr: &Attribute) -> bool {
debug!("check_config(attr={:?})", attr); debug!("check_config(attr={:?})", attr);
let config = &tcx.sess.parse_sess.config; let config = &tcx.sess.parse_sess.config;
debug!("check_config: config={:?}", config); debug!("check_config: config={:?}", config);
@ -573,7 +573,7 @@ fn check_config(tcx: TyCtxt, attr: &Attribute) -> bool {
} }
} }
fn expect_associated_value(tcx: TyCtxt, item: &NestedMetaItem) -> ast::Name { fn expect_associated_value(tcx: TyCtxt<'_, '_, '_>, item: &NestedMetaItem) -> ast::Name {
if let Some(value) = item.value_str() { if let Some(value) = item.value_str() {
value value
} else { } else {

View file

@ -9,7 +9,6 @@ use rustc::util::common::time_ext;
use rustc_serialize::Decodable as RustcDecodable; use rustc_serialize::Decodable as RustcDecodable;
use rustc_serialize::opaque::Decoder; use rustc_serialize::opaque::Decoder;
use std::path::Path; use std::path::Path;
use std;
use super::data::*; use super::data::*;
use super::fs::*; use super::fs::*;

View file

@ -10,16 +10,16 @@ mod save;
mod work_product; mod work_product;
mod file_format; mod file_format;
pub use self::fs::finalize_session_directory; pub use fs::finalize_session_directory;
pub use self::fs::garbage_collect_session_directories; pub use fs::garbage_collect_session_directories;
pub use self::fs::in_incr_comp_dir; pub use fs::in_incr_comp_dir;
pub use self::fs::in_incr_comp_dir_sess; pub use fs::in_incr_comp_dir_sess;
pub use self::fs::prepare_session_directory; pub use fs::prepare_session_directory;
pub use self::load::dep_graph_tcx_init; pub use load::dep_graph_tcx_init;
pub use self::load::load_dep_graph; pub use load::load_dep_graph;
pub use self::load::load_query_result_cache; pub use load::load_query_result_cache;
pub use self::load::LoadResult; pub use load::LoadResult;
pub use self::save::save_dep_graph; pub use save::save_dep_graph;
pub use self::save::save_work_product_index; pub use save::save_work_product_index;
pub use self::work_product::copy_cgu_workproducts_to_incr_comp_cache_dir; pub use work_product::copy_cgu_workproducts_to_incr_comp_cache_dir;
pub use self::work_product::delete_workproduct_files; pub use work_product::delete_workproduct_files;

View file

@ -129,7 +129,7 @@ fn save_in<F>(sess: &Session, path_buf: PathBuf, encode: F)
} }
} }
fn encode_dep_graph(tcx: TyCtxt, fn encode_dep_graph(tcx: TyCtxt<'_, '_, '_>,
encoder: &mut Encoder) { encoder: &mut Encoder) {
// First encode the commandline arguments hash // First encode the commandline arguments hash
tcx.sess.opts.dep_tracking_hash().encode(encoder).unwrap(); tcx.sess.opts.dep_tracking_hash().encode(encoder).unwrap();
@ -234,7 +234,7 @@ fn encode_work_product_index(work_products: &FxHashMap<WorkProductId, WorkProduc
serialized_products.encode(encoder).unwrap(); serialized_products.encode(encoder).unwrap();
} }
fn encode_query_cache(tcx: TyCtxt, fn encode_query_cache(tcx: TyCtxt<'_, '_, '_>,
encoder: &mut Encoder) { encoder: &mut Encoder) {
time(tcx.sess, "serialize query result cache", || { time(tcx.sess, "serialize query result cache", || {
tcx.serialize_query_result_cache(encoder).unwrap(); tcx.serialize_query_result_cache(encoder).unwrap();

View file

@ -1,6 +1,6 @@
//! This module contains files for saving intermediate work-products. //! This module contains files for saving intermediate work-products.
use persist::fs::*; use crate::persist::fs::*;
use rustc::dep_graph::{WorkProduct, WorkProductId, WorkProductFileKind}; use rustc::dep_graph::{WorkProduct, WorkProductId, WorkProductFileKind};
use rustc::session::Session; use rustc::session::Session;
use rustc_fs_util::link_or_copy; use rustc_fs_util::link_or_copy;