Skip to content

Commit

Permalink
librustc_driver => 2018
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Mar 26, 2019
1 parent 07d3508 commit 24a0cae
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 45 deletions.
5 changes: 3 additions & 2 deletions src/librustc_driver/Cargo.toml
Expand Up @@ -2,6 +2,7 @@
authors = ["The Rust Project Developers"]
name = "rustc_driver"
version = "0.0.0"
edition = "2018"

[lib]
name = "rustc_driver"
Expand All @@ -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" }
Expand Down
31 changes: 2 additions & 29 deletions src/librustc_driver/lib.rs
Expand Up @@ -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};

Expand Down
32 changes: 18 additions & 14 deletions src/librustc_driver/pretty.rs
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 => {
Expand Down Expand Up @@ -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)
Expand All @@ -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(()),
Expand Down Expand Up @@ -373,21 +373,21 @@ 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)
} else {
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) => {
Expand Down Expand Up @@ -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()?;
Expand Down Expand Up @@ -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 {
Expand All @@ -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()?;
Expand Down Expand Up @@ -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 {}",
Expand Down

0 comments on commit 24a0cae

Please sign in to comment.