Skip to content

Commit 0e622a8

Browse files
committed
librustc_codegen_utils => 2018
1 parent 1efdda1 commit 0e622a8

File tree

5 files changed

+18
-23
lines changed

5 files changed

+18
-23
lines changed

src/librustc_codegen_utils/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
authors = ["The Rust Project Developers"]
33
name = "rustc_codegen_utils"
44
version = "0.0.0"
5+
edition = "2018"
56

67
[lib]
78
name = "rustc_codegen_utils"

src/librustc_codegen_utils/codegen_backend.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use rustc::middle::cstore::EncodedMetadata;
3131
use rustc::middle::cstore::MetadataLoader;
3232
use rustc::dep_graph::DepGraph;
3333
use rustc_target::spec::Target;
34-
use link::out_filename;
34+
use crate::link::out_filename;
3535

3636
pub use rustc_data_structures::sync::MetadataRef;
3737

@@ -44,8 +44,8 @@ pub trait CodegenBackend {
4444
fn diagnostics(&self) -> &[(&'static str, &'static str)] { &[] }
4545

4646
fn metadata_loader(&self) -> Box<dyn MetadataLoader + Sync>;
47-
fn provide(&self, _providers: &mut Providers);
48-
fn provide_extern(&self, _providers: &mut Providers);
47+
fn provide(&self, _providers: &mut Providers<'_>);
48+
fn provide_extern(&self, _providers: &mut Providers<'_>);
4949
fn codegen_crate<'a, 'tcx>(
5050
&self,
5151
tcx: TyCtxt<'a, 'tcx, 'tcx>,
@@ -111,16 +111,16 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
111111
box NoLlvmMetadataLoader
112112
}
113113

114-
fn provide(&self, providers: &mut Providers) {
115-
::symbol_names::provide(providers);
114+
fn provide(&self, providers: &mut Providers<'_>) {
115+
crate::symbol_names::provide(providers);
116116

117117
providers.target_features_whitelist = |_tcx, _cnum| {
118118
Default::default() // Just a dummy
119119
};
120120
providers.is_reachable_non_generic = |_tcx, _defid| true;
121121
providers.exported_symbols = |_tcx, _crate| Arc::new(Vec::new());
122122
}
123-
fn provide_extern(&self, providers: &mut Providers) {
123+
fn provide_extern(&self, providers: &mut Providers<'_>) {
124124
providers.is_reachable_non_generic = |_tcx, _defid| true;
125125
}
126126

@@ -131,12 +131,12 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
131131
) -> Box<dyn Any> {
132132
use rustc_mir::monomorphize::item::MonoItem;
133133

134-
::check_for_rustc_errors_attr(tcx);
135-
::symbol_names_test::report_symbol_names(tcx);
136-
::rustc_incremental::assert_dep_graph(tcx);
137-
::rustc_incremental::assert_module_sources::assert_module_sources(tcx);
134+
crate::check_for_rustc_errors_attr(tcx);
135+
crate::symbol_names_test::report_symbol_names(tcx);
136+
rustc_incremental::assert_dep_graph(tcx);
137+
rustc_incremental::assert_module_sources::assert_module_sources(tcx);
138138
// FIXME: Fix this
139-
// ::rustc::middle::dependency_format::calculate(tcx);
139+
// rustc::middle::dependency_format::calculate(tcx);
140140
let _ = tcx.link_args(LOCAL_CRATE);
141141
let _ = tcx.native_libraries(LOCAL_CRATE);
142142
let (_, cgus) = tcx.collect_and_partition_mono_items(LOCAL_CRATE);

src/librustc_codegen_utils/lib.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,10 @@
1616

1717
#![recursion_limit="256"]
1818

19-
extern crate flate2;
20-
#[macro_use]
21-
extern crate log;
19+
#![deny(rust_2018_idioms)]
2220

2321
#[macro_use]
2422
extern crate rustc;
25-
extern crate rustc_target;
26-
extern crate rustc_metadata;
27-
extern crate rustc_mir;
28-
extern crate rustc_incremental;
29-
extern crate syntax;
30-
extern crate syntax_pos;
3123
#[macro_use] extern crate rustc_data_structures;
3224

3325
use rustc::ty::TyCtxt;
@@ -42,7 +34,7 @@ pub mod symbol_names_test;
4234
/// error in codegen. This is used to write compile-fail tests
4335
/// that actually test that compilation succeeds without
4436
/// reporting an error.
45-
pub fn check_for_rustc_errors_attr(tcx: TyCtxt) {
37+
pub fn check_for_rustc_errors_attr(tcx: TyCtxt<'_, '_, '_>) {
4638
if let Some((def_id, _)) = tcx.entry_fn(LOCAL_CRATE) {
4739
if tcx.has_attr(def_id, "rustc_error") {
4840
tcx.sess.span_fatal(tcx.def_span(def_id), "compilation successful");

src/librustc_codegen_utils/link.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub fn find_crate_name(sess: Option<&Session>,
4141
attrs: &[ast::Attribute],
4242
input: &Input) -> String {
4343
let validate = |s: String, span: Option<Span>| {
44-
::rustc_metadata::validate_crate_name(sess, &s, span);
44+
rustc_metadata::validate_crate_name(sess, &s, span);
4545
s
4646
};
4747

src/librustc_codegen_utils/symbol_names.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,12 @@ use rustc_mir::monomorphize::Instance;
103103

104104
use syntax_pos::symbol::Symbol;
105105

106+
use log::debug;
107+
106108
use std::fmt::Write;
107109
use std::mem::discriminant;
108110

109-
pub fn provide(providers: &mut Providers) {
111+
pub fn provide(providers: &mut Providers<'_>) {
110112
*providers = Providers {
111113
def_symbol_name,
112114
symbol_name,

0 commit comments

Comments
 (0)