about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTaiki Endo <te316e89@gmail.com>2019-02-08 21:06:07 +0900
committerTaiki Endo <te316e89@gmail.com>2019-02-08 21:06:07 +0900
commit0e622a8ba1d43904ff16231e4fe8a1907e66d563 (patch)
treedda144d97261cf6990157ae9e38b77938e283485 /src
parent1efdda10cdde386ea3e470ba2b482fdc73c12001 (diff)
downloadrust-0e622a8ba1d43904ff16231e4fe8a1907e66d563.tar.gz
rust-0e622a8ba1d43904ff16231e4fe8a1907e66d563.zip
librustc_codegen_utils => 2018
Diffstat (limited to 'src')
-rw-r--r--src/librustc_codegen_utils/Cargo.toml1
-rw-r--r--src/librustc_codegen_utils/codegen_backend.rs22
-rw-r--r--src/librustc_codegen_utils/lib.rs12
-rw-r--r--src/librustc_codegen_utils/link.rs2
-rw-r--r--src/librustc_codegen_utils/symbol_names.rs4
5 files changed, 18 insertions, 23 deletions
diff --git a/src/librustc_codegen_utils/Cargo.toml b/src/librustc_codegen_utils/Cargo.toml
index 34a09f30b64..5f241eb20fb 100644
--- a/src/librustc_codegen_utils/Cargo.toml
+++ b/src/librustc_codegen_utils/Cargo.toml
@@ -2,6 +2,7 @@
 authors = ["The Rust Project Developers"]
 name = "rustc_codegen_utils"
 version = "0.0.0"
+edition = "2018"
 
 [lib]
 name = "rustc_codegen_utils"
diff --git a/src/librustc_codegen_utils/codegen_backend.rs b/src/librustc_codegen_utils/codegen_backend.rs
index 8981c542961..8270d2a4077 100644
--- a/src/librustc_codegen_utils/codegen_backend.rs
+++ b/src/librustc_codegen_utils/codegen_backend.rs
@@ -31,7 +31,7 @@ use rustc::middle::cstore::EncodedMetadata;
 use rustc::middle::cstore::MetadataLoader;
 use rustc::dep_graph::DepGraph;
 use rustc_target::spec::Target;
-use link::out_filename;
+use crate::link::out_filename;
 
 pub use rustc_data_structures::sync::MetadataRef;
 
@@ -44,8 +44,8 @@ pub trait CodegenBackend {
     fn diagnostics(&self) -> &[(&'static str, &'static str)] { &[] }
 
     fn metadata_loader(&self) -> Box<dyn MetadataLoader + Sync>;
-    fn provide(&self, _providers: &mut Providers);
-    fn provide_extern(&self, _providers: &mut Providers);
+    fn provide(&self, _providers: &mut Providers<'_>);
+    fn provide_extern(&self, _providers: &mut Providers<'_>);
     fn codegen_crate<'a, 'tcx>(
         &self,
         tcx: TyCtxt<'a, 'tcx, 'tcx>,
@@ -111,8 +111,8 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
         box NoLlvmMetadataLoader
     }
 
-    fn provide(&self, providers: &mut Providers) {
-        ::symbol_names::provide(providers);
+    fn provide(&self, providers: &mut Providers<'_>) {
+        crate::symbol_names::provide(providers);
 
         providers.target_features_whitelist = |_tcx, _cnum| {
             Default::default() // Just a dummy
@@ -120,7 +120,7 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
         providers.is_reachable_non_generic = |_tcx, _defid| true;
         providers.exported_symbols = |_tcx, _crate| Arc::new(Vec::new());
     }
-    fn provide_extern(&self, providers: &mut Providers) {
+    fn provide_extern(&self, providers: &mut Providers<'_>) {
         providers.is_reachable_non_generic = |_tcx, _defid| true;
     }
 
@@ -131,12 +131,12 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
     ) -> Box<dyn Any> {
         use rustc_mir::monomorphize::item::MonoItem;
 
-        ::check_for_rustc_errors_attr(tcx);
-        ::symbol_names_test::report_symbol_names(tcx);
-        ::rustc_incremental::assert_dep_graph(tcx);
-        ::rustc_incremental::assert_module_sources::assert_module_sources(tcx);
+        crate::check_for_rustc_errors_attr(tcx);
+        crate::symbol_names_test::report_symbol_names(tcx);
+        rustc_incremental::assert_dep_graph(tcx);
+        rustc_incremental::assert_module_sources::assert_module_sources(tcx);
         // FIXME: Fix this
-        // ::rustc::middle::dependency_format::calculate(tcx);
+        // rustc::middle::dependency_format::calculate(tcx);
         let _ = tcx.link_args(LOCAL_CRATE);
         let _ = tcx.native_libraries(LOCAL_CRATE);
         let (_, cgus) = tcx.collect_and_partition_mono_items(LOCAL_CRATE);
diff --git a/src/librustc_codegen_utils/lib.rs b/src/librustc_codegen_utils/lib.rs
index 8e96f985401..4c01681320f 100644
--- a/src/librustc_codegen_utils/lib.rs
+++ b/src/librustc_codegen_utils/lib.rs
@@ -16,18 +16,10 @@
 
 #![recursion_limit="256"]
 
-extern crate flate2;
-#[macro_use]
-extern crate log;
+#![deny(rust_2018_idioms)]
 
 #[macro_use]
 extern crate rustc;
-extern crate rustc_target;
-extern crate rustc_metadata;
-extern crate rustc_mir;
-extern crate rustc_incremental;
-extern crate syntax;
-extern crate syntax_pos;
 #[macro_use] extern crate rustc_data_structures;
 
 use rustc::ty::TyCtxt;
@@ -42,7 +34,7 @@ pub mod symbol_names_test;
 /// error in codegen. This is used to write compile-fail tests
 /// that actually test that compilation succeeds without
 /// reporting an error.
-pub fn check_for_rustc_errors_attr(tcx: TyCtxt) {
+pub fn check_for_rustc_errors_attr(tcx: TyCtxt<'_, '_, '_>) {
     if let Some((def_id, _)) = tcx.entry_fn(LOCAL_CRATE) {
         if tcx.has_attr(def_id, "rustc_error") {
             tcx.sess.span_fatal(tcx.def_span(def_id), "compilation successful");
diff --git a/src/librustc_codegen_utils/link.rs b/src/librustc_codegen_utils/link.rs
index 09e22bd2c91..f3a1b219f8a 100644
--- a/src/librustc_codegen_utils/link.rs
+++ b/src/librustc_codegen_utils/link.rs
@@ -41,7 +41,7 @@ pub fn find_crate_name(sess: Option<&Session>,
                        attrs: &[ast::Attribute],
                        input: &Input) -> String {
     let validate = |s: String, span: Option<Span>| {
-        ::rustc_metadata::validate_crate_name(sess, &s, span);
+        rustc_metadata::validate_crate_name(sess, &s, span);
         s
     };
 
diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs
index 3238a0b10bf..8d105853d92 100644
--- a/src/librustc_codegen_utils/symbol_names.rs
+++ b/src/librustc_codegen_utils/symbol_names.rs
@@ -103,10 +103,12 @@ use rustc_mir::monomorphize::Instance;
 
 use syntax_pos::symbol::Symbol;
 
+use log::debug;
+
 use std::fmt::Write;
 use std::mem::discriminant;
 
-pub fn provide(providers: &mut Providers) {
+pub fn provide(providers: &mut Providers<'_>) {
     *providers = Providers {
         def_symbol_name,
         symbol_name,