Skip to content

Commit d7a4dd1

Browse files
authored
Rollup merge of rust-lang#58259 - taiki-e:librustc_codegen_utils-2018, r=Centril
librustc_codegen_utils => 2018 Transitions `librustc_codegen_utils` to Rust 2018; cc rust-lang#58099 r? @Centril
2 parents 869135c + 0e622a8 commit d7a4dd1

File tree

5 files changed

+18
-23
lines changed

5 files changed

+18
-23
lines changed

src/librustc_codegen_utils/Cargo.toml

Lines changed: 1 addition & 0 deletions
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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use rustc::middle::cstore::EncodedMetadata;
2929
use rustc::middle::cstore::MetadataLoader;
3030
use rustc::dep_graph::DepGraph;
3131
use rustc_target::spec::Target;
32-
use link::out_filename;
32+
use crate::link::out_filename;
3333

3434
pub use rustc_data_structures::sync::MetadataRef;
3535

@@ -42,8 +42,8 @@ pub trait CodegenBackend {
4242
fn diagnostics(&self) -> &[(&'static str, &'static str)] { &[] }
4343

4444
fn metadata_loader(&self) -> Box<dyn MetadataLoader + Sync>;
45-
fn provide(&self, _providers: &mut Providers);
46-
fn provide_extern(&self, _providers: &mut Providers);
45+
fn provide(&self, _providers: &mut Providers<'_>);
46+
fn provide_extern(&self, _providers: &mut Providers<'_>);
4747
fn codegen_crate<'a, 'tcx>(
4848
&self,
4949
tcx: TyCtxt<'a, 'tcx, 'tcx>,
@@ -109,16 +109,16 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
109109
box NoLlvmMetadataLoader
110110
}
111111

112-
fn provide(&self, providers: &mut Providers) {
113-
::symbol_names::provide(providers);
112+
fn provide(&self, providers: &mut Providers<'_>) {
113+
crate::symbol_names::provide(providers);
114114

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

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

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

src/librustc_codegen_utils/lib.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,10 @@
1414

1515
#![recursion_limit="256"]
1616

17-
extern crate flate2;
18-
#[macro_use]
19-
extern crate log;
17+
#![deny(rust_2018_idioms)]
2018

2119
#[macro_use]
2220
extern crate rustc;
23-
extern crate rustc_target;
24-
extern crate rustc_metadata;
25-
extern crate rustc_mir;
26-
extern crate rustc_incremental;
27-
extern crate syntax;
28-
extern crate syntax_pos;
2921
#[macro_use] extern crate rustc_data_structures;
3022

3123
use rustc::ty::TyCtxt;
@@ -40,7 +32,7 @@ pub mod symbol_names_test;
4032
/// error in codegen. This is used to write compile-fail tests
4133
/// that actually test that compilation succeeds without
4234
/// reporting an error.
43-
pub fn check_for_rustc_errors_attr(tcx: TyCtxt) {
35+
pub fn check_for_rustc_errors_attr(tcx: TyCtxt<'_, '_, '_>) {
4436
if let Some((def_id, _)) = tcx.entry_fn(LOCAL_CRATE) {
4537
if tcx.has_attr(def_id, "rustc_error") {
4638
tcx.sess.span_fatal(tcx.def_span(def_id), "compilation successful");

src/librustc_codegen_utils/link.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 1 deletion
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)