From 24a0caec832d774ede930597692b291286176802 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 27 Mar 2019 05:35:18 +0900 Subject: [PATCH] librustc_driver => 2018 --- src/librustc_driver/Cargo.toml | 5 +++-- src/librustc_driver/lib.rs | 31 ++----------------------------- src/librustc_driver/pretty.rs | 32 ++++++++++++++++++-------------- 3 files changed, 23 insertions(+), 45 deletions(-) diff --git a/src/librustc_driver/Cargo.toml b/src/librustc_driver/Cargo.toml index a77e497af7b87..5432f80a1712c 100644 --- a/src/librustc_driver/Cargo.toml +++ b/src/librustc_driver/Cargo.toml @@ -2,6 +2,7 @@ authors = ["The Rust Project Developers"] name = "rustc_driver" version = "0.0.0" +edition = "2018" [lib] name = "rustc_driver" @@ -13,14 +14,14 @@ arena = { path = "../libarena" } graphviz = { path = "../libgraphviz" } log = "0.4" env_logger = { version = "0.5", default-features = false } -rustc-rayon = "0.1.2" +rayon = { version = "0.1.2", package = "rustc-rayon" } scoped-tls = "1.0" rustc = { path = "../librustc" } rustc_allocator = { path = "../librustc_allocator" } rustc_target = { path = "../librustc_target" } rustc_borrowck = { path = "../librustc_borrowck" } rustc_data_structures = { path = "../librustc_data_structures" } -rustc_errors = { path = "../librustc_errors" } +errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_incremental = { path = "../librustc_incremental" } rustc_lint = { path = "../librustc_lint" } rustc_metadata = { path = "../librustc_metadata" } diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 25984616b878b..4b7cffaad5509 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -16,40 +16,13 @@ #![recursion_limit="256"] -extern crate arena; +#![deny(rust_2018_idioms)] + pub extern crate getopts; -extern crate graphviz; -extern crate env_logger; #[cfg(unix)] extern crate libc; -extern crate rustc_rayon as rayon; -extern crate rustc; -extern crate rustc_allocator; -extern crate rustc_target; -extern crate rustc_borrowck; -extern crate rustc_data_structures; -extern crate rustc_errors as errors; -extern crate rustc_passes; -extern crate rustc_lint; -extern crate rustc_plugin; -extern crate rustc_privacy; -extern crate rustc_incremental; -extern crate rustc_metadata; -extern crate rustc_mir; -extern crate rustc_resolve; -extern crate rustc_save_analysis; -extern crate rustc_traits; -extern crate rustc_codegen_utils; -extern crate rustc_typeck; -extern crate rustc_interface; -extern crate scoped_tls; -extern crate serialize; -extern crate smallvec; #[macro_use] extern crate log; -extern crate syntax; -extern crate syntax_ext; -extern crate syntax_pos; use pretty::{PpMode, UserIdentifiedItem}; diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index ace5198deaf2e..5cefc35607db0 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -35,9 +35,9 @@ pub use self::UserIdentifiedItem::*; pub use self::PpSourceMode::*; pub use self::PpMode::*; use self::NodesMatchingUII::*; -use abort_on_err; +use crate::abort_on_err; -use source_name; +use crate::source_name; #[derive(Copy, Clone, PartialEq, Debug)] pub enum PpSourceMode { @@ -191,7 +191,7 @@ impl PpSourceMode { tcx: TyCtxt<'tcx, 'tcx, 'tcx>, f: F ) -> A - where F: FnOnce(&dyn HirPrinterSupport, &hir::Crate) -> A + where F: FnOnce(&dyn HirPrinterSupport<'_>, &hir::Crate) -> A { match *self { PpmNormal => { @@ -296,7 +296,7 @@ impl<'hir> HirPrinterSupport<'hir> for NoAnn<'hir> { impl<'hir> pprust::PpAnn for NoAnn<'hir> {} impl<'hir> pprust_hir::PpAnn for NoAnn<'hir> { - fn nested(&self, state: &mut pprust_hir::State, nested: pprust_hir::Nested) + fn nested(&self, state: &mut pprust_hir::State<'_>, nested: pprust_hir::Nested) -> io::Result<()> { if let Some(tcx) = self.tcx { pprust_hir::PpAnn::nested(tcx.hir(), state, nested) @@ -322,13 +322,13 @@ impl<'hir> PrinterSupport for IdentifiedAnnotation<'hir> { } impl<'hir> pprust::PpAnn for IdentifiedAnnotation<'hir> { - fn pre(&self, s: &mut pprust::State, node: pprust::AnnNode) -> io::Result<()> { + fn pre(&self, s: &mut pprust::State<'_>, node: pprust::AnnNode<'_>) -> io::Result<()> { match node { pprust::AnnNode::Expr(_) => s.popen(), _ => Ok(()), } } - fn post(&self, s: &mut pprust::State, node: pprust::AnnNode) -> io::Result<()> { + fn post(&self, s: &mut pprust::State<'_>, node: pprust::AnnNode<'_>) -> io::Result<()> { match node { pprust::AnnNode::Ident(_) | pprust::AnnNode::Name(_) => Ok(()), @@ -373,7 +373,7 @@ impl<'hir> HirPrinterSupport<'hir> for IdentifiedAnnotation<'hir> { } impl<'hir> pprust_hir::PpAnn for IdentifiedAnnotation<'hir> { - fn nested(&self, state: &mut pprust_hir::State, nested: pprust_hir::Nested) + fn nested(&self, state: &mut pprust_hir::State<'_>, nested: pprust_hir::Nested) -> io::Result<()> { if let Some(ref tcx) = self.tcx { pprust_hir::PpAnn::nested(tcx.hir(), state, nested) @@ -381,13 +381,13 @@ impl<'hir> pprust_hir::PpAnn for IdentifiedAnnotation<'hir> { Ok(()) } } - fn pre(&self, s: &mut pprust_hir::State, node: pprust_hir::AnnNode) -> io::Result<()> { + fn pre(&self, s: &mut pprust_hir::State<'_>, node: pprust_hir::AnnNode<'_>) -> io::Result<()> { match node { pprust_hir::AnnNode::Expr(_) => s.popen(), _ => Ok(()), } } - fn post(&self, s: &mut pprust_hir::State, node: pprust_hir::AnnNode) -> io::Result<()> { + fn post(&self, s: &mut pprust_hir::State<'_>, node: pprust_hir::AnnNode<'_>) -> io::Result<()> { match node { pprust_hir::AnnNode::Name(_) => Ok(()), pprust_hir::AnnNode::Item(item) => { @@ -434,7 +434,7 @@ impl<'a> PrinterSupport for HygieneAnnotation<'a> { } impl<'a> pprust::PpAnn for HygieneAnnotation<'a> { - fn post(&self, s: &mut pprust::State, node: pprust::AnnNode) -> io::Result<()> { + fn post(&self, s: &mut pprust::State<'_>, node: pprust::AnnNode<'_>) -> io::Result<()> { match node { pprust::AnnNode::Ident(&ast::Ident { name, span }) => { s.s.space()?; @@ -476,7 +476,7 @@ impl<'b, 'tcx> HirPrinterSupport<'tcx> for TypedAnnotation<'b, 'tcx> { } impl<'a, 'tcx> pprust_hir::PpAnn for TypedAnnotation<'a, 'tcx> { - fn nested(&self, state: &mut pprust_hir::State, nested: pprust_hir::Nested) + fn nested(&self, state: &mut pprust_hir::State<'_>, nested: pprust_hir::Nested) -> io::Result<()> { let old_tables = self.tables.get(); if let pprust_hir::Nested::Body(id) = nested { @@ -486,13 +486,13 @@ impl<'a, 'tcx> pprust_hir::PpAnn for TypedAnnotation<'a, 'tcx> { self.tables.set(old_tables); Ok(()) } - fn pre(&self, s: &mut pprust_hir::State, node: pprust_hir::AnnNode) -> io::Result<()> { + fn pre(&self, s: &mut pprust_hir::State<'_>, node: pprust_hir::AnnNode<'_>) -> io::Result<()> { match node { pprust_hir::AnnNode::Expr(_) => s.popen(), _ => Ok(()), } } - fn post(&self, s: &mut pprust_hir::State, node: pprust_hir::AnnNode) -> io::Result<()> { + fn post(&self, s: &mut pprust_hir::State<'_>, node: pprust_hir::AnnNode<'_>) -> io::Result<()> { match node { pprust_hir::AnnNode::Expr(expr) => { s.s.space()?; @@ -580,7 +580,11 @@ impl UserIdentifiedItem { } } - fn to_one_node_id(self, user_option: &str, sess: &Session, map: &hir_map::Map) -> ast::NodeId { + fn to_one_node_id(self, + user_option: &str, + sess: &Session, + map: &hir_map::Map<'_>) + -> ast::NodeId { let fail_because = |is_wrong_because| -> ast::NodeId { let message = format!("{} needs NodeId (int) or unique path suffix (b::c::d); got \ {}, which {}",