From 14f3f6c71294fbbcb0a32286d942a4080156c6bc Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Tue, 26 Mar 2019 19:07:13 +0100 Subject: [PATCH 1/2] librustc_interface => 2018 --- src/librustc_interface/Cargo.toml | 1 + src/librustc_interface/interface.rs | 10 +++++----- src/librustc_interface/lib.rs | 27 ++------------------------- src/librustc_interface/passes.rs | 12 +++++++----- src/librustc_interface/profile/mod.rs | 3 ++- src/librustc_interface/queries.rs | 5 +++-- src/librustc_interface/util.rs | 1 + 7 files changed, 21 insertions(+), 38 deletions(-) diff --git a/src/librustc_interface/Cargo.toml b/src/librustc_interface/Cargo.toml index 294e23dc6177c..356547db88675 100644 --- a/src/librustc_interface/Cargo.toml +++ b/src/librustc_interface/Cargo.toml @@ -2,6 +2,7 @@ authors = ["The Rust Project Developers"] name = "rustc_interface" version = "0.0.0" +edition = "2018" [lib] name = "rustc_interface" diff --git a/src/librustc_interface/interface.rs b/src/librustc_interface/interface.rs index ec6b26afb8c50..bec868be505b5 100644 --- a/src/librustc_interface/interface.rs +++ b/src/librustc_interface/interface.rs @@ -1,4 +1,8 @@ -use queries::Queries; +use crate::queries::Queries; +use crate::util; +use crate::profile; +pub use crate::passes::BoxedResolver; + use rustc::lint; use rustc::session::config::{self, Input}; use rustc::session::{DiagnosticOutput, Session}; @@ -15,10 +19,6 @@ use std::result; use std::sync::{Arc, Mutex}; use syntax; use syntax::source_map::{FileLoader, SourceMap}; -use util; -use profile; - -pub use passes::BoxedResolver; pub type Result = result::Result; diff --git a/src/librustc_interface/lib.rs b/src/librustc_interface/lib.rs index 6a931c249b5bf..3314681b6981a 100644 --- a/src/librustc_interface/lib.rs +++ b/src/librustc_interface/lib.rs @@ -6,37 +6,14 @@ #![feature(generators)] #![cfg_attr(unix, feature(libc))] +#![deny(rust_2018_idioms)] + #![allow(unused_imports)] #![recursion_limit="256"] #[cfg(unix)] extern crate libc; -#[macro_use] -extern crate log; -extern crate rustc; -extern crate rustc_codegen_utils; -extern crate rustc_allocator; -extern crate rustc_borrowck; -extern crate rustc_incremental; -extern crate rustc_traits; -#[macro_use] -extern crate rustc_data_structures; -extern crate rustc_errors; -extern crate rustc_lint; -extern crate rustc_metadata; -extern crate rustc_mir; -extern crate rustc_passes; -extern crate rustc_plugin; -extern crate rustc_privacy; -extern crate rustc_rayon as rayon; -extern crate rustc_resolve; -extern crate rustc_typeck; -extern crate smallvec; -extern crate serialize; -extern crate syntax; -extern crate syntax_pos; -extern crate syntax_ext; pub mod interface; mod passes; diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index c199829b298c0..318857c3406e3 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -1,7 +1,8 @@ -use interface::{Compiler, Result}; -use util; -use proc_macro_decls; +use crate::interface::{Compiler, Result}; +use crate::util; +use crate::proc_macro_decls; +use log::{debug, info, warn, log_enabled}; use rustc::dep_graph::DepGraph; use rustc::hir; use rustc::hir::lowering::lower_crate; @@ -20,6 +21,7 @@ use rustc::session::search_paths::PathKind; use rustc_allocator as allocator; use rustc_borrowck as borrowck; use rustc_codegen_utils::codegen_backend::CodegenBackend; +use rustc_data_structures::{box_region_allow_access, declare_box_region_type, parallel}; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::stable_hasher::StableHasher; use rustc_data_structures::sync::{Lrc, ParallelIterator, par_iter}; @@ -758,7 +760,7 @@ pub fn prepare_outputs( Ok(outputs) } -pub fn default_provide(providers: &mut ty::query::Providers) { +pub fn default_provide(providers: &mut ty::query::Providers<'_>) { providers.analysis = analysis; proc_macro_decls::provide(providers); plugin::build::provide(providers); @@ -783,7 +785,7 @@ pub fn default_provide(providers: &mut ty::query::Providers) { lint::provide(providers); } -pub fn default_provide_extern(providers: &mut ty::query::Providers) { +pub fn default_provide_extern(providers: &mut ty::query::Providers<'_>) { cstore::provide_extern(providers); } diff --git a/src/librustc_interface/profile/mod.rs b/src/librustc_interface/profile/mod.rs index eb13a5668f927..d0c8dff207083 100644 --- a/src/librustc_interface/profile/mod.rs +++ b/src/librustc_interface/profile/mod.rs @@ -1,8 +1,9 @@ +use log::debug; +use rustc::dep_graph::DepNode; use rustc::session::Session; use rustc::util::common::{ProfQDumpParams, ProfileQueriesMsg, profq_msg, profq_set_chan}; use std::sync::mpsc::{Receiver}; use std::io::{Write}; -use rustc::dep_graph::{DepNode}; use std::time::{Duration, Instant}; pub mod trace; diff --git a/src/librustc_interface/queries.rs b/src/librustc_interface/queries.rs index 57ced0464d9fa..570509ffb2b8c 100644 --- a/src/librustc_interface/queries.rs +++ b/src/librustc_interface/queries.rs @@ -1,5 +1,6 @@ -use interface::{Compiler, Result}; -use passes::{self, BoxedResolver, ExpansionResult, BoxedGlobalCtxt, PluginInfo}; +use crate::interface::{Compiler, Result}; +use crate::passes::{self, BoxedResolver, ExpansionResult, BoxedGlobalCtxt, PluginInfo}; + use rustc_incremental::DepGraphFuture; use rustc_data_structures::sync::Lrc; use rustc::session::config::{Input, OutputFilenames, OutputType}; diff --git a/src/librustc_interface/util.rs b/src/librustc_interface/util.rs index b1ef4e315d98d..6e4f2bf24e32f 100644 --- a/src/librustc_interface/util.rs +++ b/src/librustc_interface/util.rs @@ -1,3 +1,4 @@ +use log::info; use rustc::session::config::{Input, OutputFilenames, ErrorOutputType}; use rustc::session::{self, config, early_error, filesearch, Session, DiagnosticOutput}; use rustc::session::CrateDisambiguator; From bf1068b1370f7bc3e17164cb4abd010b15073fa8 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Wed, 27 Mar 2019 09:48:50 +0100 Subject: [PATCH 2/2] librustc_interface => 2018; rename rustc-rayon to rayon in Cargo.toml --- src/librustc_interface/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_interface/Cargo.toml b/src/librustc_interface/Cargo.toml index 356547db88675..ec934ee48212c 100644 --- a/src/librustc_interface/Cargo.toml +++ b/src/librustc_interface/Cargo.toml @@ -11,7 +11,7 @@ crate-type = ["dylib"] [dependencies] log = "0.4" -rustc-rayon = "0.1.1" +rayon = { version = "0.1.1", package = "rustc-rayon" } smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } scoped-tls = "1.0" syntax = { path = "../libsyntax" }