diff --git a/src/librustc_incremental/Cargo.toml b/src/librustc_incremental/Cargo.toml index b8519ee1ab1..10b448b7fec 100644 --- a/src/librustc_incremental/Cargo.toml +++ b/src/librustc_incremental/Cargo.toml @@ -2,6 +2,7 @@ authors = ["The Rust Project Developers"] name = "rustc_incremental" version = "0.0.0" +edition = "2018" [lib] name = "rustc_incremental" diff --git a/src/librustc_incremental/assert_dep_graph.rs b/src/librustc_incremental/assert_dep_graph.rs index 57ab48493fa..b715a32cb05 100644 --- a/src/librustc_incremental/assert_dep_graph.rs +++ b/src/librustc_incremental/assert_dep_graph.rs @@ -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 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> { type Node = &'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(); nodes.into() } - fn edges(&self) -> dot::Edges<(&'q DepNode, &'q DepNode)> { + fn edges(&self) -> dot::Edges<'_, (&'q DepNode, &'q DepNode)> { self.1[..].into() } 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> { type Node = &'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() } - fn node_id(&self, n: &&'q DepNode) -> dot::Id { + fn node_id(&self, n: &&'q DepNode) -> dot::Id<'_> { let s: String = format!("{:?}", n).chars() .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); 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)) } } diff --git a/src/librustc_incremental/lib.rs b/src/librustc_incremental/lib.rs index ae2e6e0b94c..1fc51c27311 100644 --- a/src/librustc_incremental/lib.rs +++ b/src/librustc_incremental/lib.rs @@ -9,16 +9,13 @@ #![recursion_limit="256"] -extern crate graphviz; +#![deny(rust_2018_idioms)] + #[macro_use] extern crate rustc; -extern crate rustc_data_structures; -extern crate serialize as rustc_serialize; -extern crate rand; -extern crate rustc_fs_util; +#[allow(unused_extern_crates)] +extern crate serialize as rustc_serialize; // used by deriving #[macro_use] extern crate log; -extern crate syntax; -extern crate syntax_pos; mod assert_dep_graph; pub mod assert_module_sources; diff --git a/src/librustc_incremental/persist/dirty_clean.rs b/src/librustc_incremental/persist/dirty_clean.rs index 3ff4d2ec38d..9b52199465b 100644 --- a/src/librustc_incremental/persist/dirty_clean.rs +++ b/src/librustc_incremental/persist/dirty_clean.rs @@ -538,7 +538,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for DirtyCleanVisitor<'a, 'tcx> { /// /// Also make sure that the `label` and `except` fields do not /// both exist. -fn check_config(tcx: TyCtxt, attr: &Attribute) -> bool { +fn check_config(tcx: TyCtxt<'_, '_, '_>, attr: &Attribute) -> bool { debug!("check_config(attr={:?})", attr); let config = &tcx.sess.parse_sess.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() { value } else { diff --git a/src/librustc_incremental/persist/load.rs b/src/librustc_incremental/persist/load.rs index f330de71918..ecf8bc4a880 100644 --- a/src/librustc_incremental/persist/load.rs +++ b/src/librustc_incremental/persist/load.rs @@ -9,7 +9,6 @@ use rustc::util::common::time_ext; use rustc_serialize::Decodable as RustcDecodable; use rustc_serialize::opaque::Decoder; use std::path::Path; -use std; use super::data::*; use super::fs::*; diff --git a/src/librustc_incremental/persist/mod.rs b/src/librustc_incremental/persist/mod.rs index bd59f24d04e..3aad4f5abb8 100644 --- a/src/librustc_incremental/persist/mod.rs +++ b/src/librustc_incremental/persist/mod.rs @@ -10,16 +10,16 @@ mod save; mod work_product; mod file_format; -pub use self::fs::finalize_session_directory; -pub use self::fs::garbage_collect_session_directories; -pub use self::fs::in_incr_comp_dir; -pub use self::fs::in_incr_comp_dir_sess; -pub use self::fs::prepare_session_directory; -pub use self::load::dep_graph_tcx_init; -pub use self::load::load_dep_graph; -pub use self::load::load_query_result_cache; -pub use self::load::LoadResult; -pub use self::save::save_dep_graph; -pub use self::save::save_work_product_index; -pub use self::work_product::copy_cgu_workproducts_to_incr_comp_cache_dir; -pub use self::work_product::delete_workproduct_files; +pub use fs::finalize_session_directory; +pub use fs::garbage_collect_session_directories; +pub use fs::in_incr_comp_dir; +pub use fs::in_incr_comp_dir_sess; +pub use fs::prepare_session_directory; +pub use load::dep_graph_tcx_init; +pub use load::load_dep_graph; +pub use load::load_query_result_cache; +pub use load::LoadResult; +pub use save::save_dep_graph; +pub use save::save_work_product_index; +pub use work_product::copy_cgu_workproducts_to_incr_comp_cache_dir; +pub use work_product::delete_workproduct_files; diff --git a/src/librustc_incremental/persist/save.rs b/src/librustc_incremental/persist/save.rs index 6a7553b3882..34fe2f1c25d 100644 --- a/src/librustc_incremental/persist/save.rs +++ b/src/librustc_incremental/persist/save.rs @@ -129,7 +129,7 @@ fn save_in(sess: &Session, path_buf: PathBuf, encode: F) } } -fn encode_dep_graph(tcx: TyCtxt, +fn encode_dep_graph(tcx: TyCtxt<'_, '_, '_>, encoder: &mut Encoder) { // First encode the commandline arguments hash tcx.sess.opts.dep_tracking_hash().encode(encoder).unwrap(); @@ -234,7 +234,7 @@ fn encode_work_product_index(work_products: &FxHashMap, encoder: &mut Encoder) { time(tcx.sess, "serialize query result cache", || { tcx.serialize_query_result_cache(encoder).unwrap(); diff --git a/src/librustc_incremental/persist/work_product.rs b/src/librustc_incremental/persist/work_product.rs index 535f6930aa3..3495b27c5eb 100644 --- a/src/librustc_incremental/persist/work_product.rs +++ b/src/librustc_incremental/persist/work_product.rs @@ -1,6 +1,6 @@ //! 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::session::Session; use rustc_fs_util::link_or_copy;