Skip to content

Commit 4f2d0cf

Browse files
authored
Rollup merge of #58322 - taiki-e:librustc_codegen_ssa-2018, r=petrochenkov
librustc_codegen_ssa => 2018 Transitions `librustc_codegen_ssa` to Rust 2018; cc #58099 r? @petrochenkov
2 parents 308c07b + be71fcc commit 4f2d0cf

26 files changed

+75
-91
lines changed

src/librustc_codegen_ssa/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_ssa"
44
version = "0.0.0"
5+
edition = "2018"
56

67
[lib]
78
name = "rustc_codegen_ssa"

src/librustc_codegen_ssa/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_target::spec::LinkerFlavor;
99
use rustc::hir::def_id::CrateNum;
1010

1111
use super::command::Command;
12-
use CrateInfo;
12+
use crate::CrateInfo;
1313

1414
use cc::windows_registry;
1515
use std::fs;

src/librustc_codegen_ssa/back/lto.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::write::CodegenContext;
2-
use traits::*;
3-
use ModuleCodegen;
2+
use crate::traits::*;
3+
use crate::ModuleCodegen;
44

55
use rustc::util::time_graph::Timeline;
66
use rustc_errors::FatalError;

src/librustc_codegen_ssa/back/write.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
use {ModuleCodegen, ModuleKind, CachedModuleCodegen, CompiledModule, CrateInfo, CodegenResults,
2-
RLIB_BYTECODE_EXTENSION};
1+
use crate::{ModuleCodegen, ModuleKind, CachedModuleCodegen, CompiledModule, CrateInfo,
2+
CodegenResults, RLIB_BYTECODE_EXTENSION};
33
use super::linker::LinkerInfo;
44
use super::lto::{self, SerializedModule};
55
use super::link::{self, remove, get_linker};
66
use super::command::Command;
77
use super::symbol_export::ExportedSymbols;
88

9-
use memmap;
9+
use crate::traits::*;
1010
use rustc_incremental::{copy_cgu_workproducts_to_incr_comp_cache_dir,
1111
in_incr_comp_dir, in_incr_comp_dir_sess};
1212
use rustc::dep_graph::{WorkProduct, WorkProductId, WorkProductFileKind};
@@ -16,7 +16,6 @@ use rustc::session::config::{self, OutputFilenames, OutputType, Passes, Sanitize
1616
use rustc::session::Session;
1717
use rustc::util::nodemap::FxHashMap;
1818
use rustc::util::time_graph::{self, TimeGraph, Timeline};
19-
use traits::*;
2019
use rustc::hir::def_id::{CrateNum, LOCAL_CRATE};
2120
use rustc::ty::TyCtxt;
2221
use rustc::util::common::{time_depth, set_time_depth, print_time_passes_entry};

src/librustc_codegen_ssa/base.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//! but one llvm::Type corresponds to many `Ty`s; for instance, tup(int, int,
1414
//! int) and rec(x=int, y=int, z=int) will have the same llvm::Type.
1515
16-
use {ModuleCodegen, ModuleKind, CachedModuleCodegen};
16+
use crate::{ModuleCodegen, ModuleKind, CachedModuleCodegen};
1717

1818
use rustc::dep_graph::cgu_reuse_tracker::CguReuse;
1919
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
@@ -28,26 +28,26 @@ use rustc::util::common::{time, print_time_passes_entry};
2828
use rustc::util::profiling::ProfileCategory;
2929
use rustc::session::config::{self, EntryFnType, Lto};
3030
use rustc::session::Session;
31-
use mir::place::PlaceRef;
32-
use back::write::{OngoingCodegen, start_async_codegen, submit_pre_lto_module_to_llvm,
33-
submit_post_lto_module_to_llvm};
34-
use {MemFlags, CrateInfo};
35-
use callee;
3631
use rustc_mir::monomorphize::item::DefPathBasedNames;
37-
use common::{RealPredicate, TypeKind, IntPredicate};
38-
use meth;
39-
use mir;
4032
use rustc::util::time_graph;
4133
use rustc_mir::monomorphize::Instance;
4234
use rustc_mir::monomorphize::partitioning::{CodegenUnit, CodegenUnitExt};
43-
use mono_item::MonoItem;
4435
use rustc::util::nodemap::FxHashMap;
4536
use rustc_data_structures::indexed_vec::Idx;
4637
use rustc_data_structures::sync::Lrc;
4738
use rustc_codegen_utils::{symbol_names_test, check_for_rustc_errors_attr};
4839
use rustc::ty::layout::{FAT_PTR_ADDR, FAT_PTR_EXTRA};
40+
use crate::mir::place::PlaceRef;
41+
use crate::back::write::{OngoingCodegen, start_async_codegen, submit_pre_lto_module_to_llvm,
42+
submit_post_lto_module_to_llvm};
43+
use crate::{MemFlags, CrateInfo};
44+
use crate::callee;
45+
use crate::common::{RealPredicate, TypeKind, IntPredicate};
46+
use crate::meth;
47+
use crate::mir;
48+
use crate::mono_item::MonoItem;
4949

50-
use traits::*;
50+
use crate::traits::*;
5151

5252
use std::any::Any;
5353
use std::cmp;
@@ -58,7 +58,7 @@ use syntax_pos::Span;
5858
use syntax::attr;
5959
use rustc::hir;
6060

61-
use mir::operand::OperandValue;
61+
use crate::mir::operand::OperandValue;
6262

6363
use std::marker::PhantomData;
6464

src/librustc_codegen_ssa/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use traits::*;
1+
use crate::traits::*;
22
use rustc::ty;
33
use rustc::ty::subst::Substs;
44
use rustc::hir::def_id::DefId;

src/librustc_codegen_ssa/common.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ use syntax_pos::{DUMMY_SP, Span};
55

66
use rustc::hir::def_id::DefId;
77
use rustc::middle::lang_items::LangItem;
8-
use base;
9-
use traits::*;
8+
use crate::base;
9+
use crate::traits::*;
1010

1111
use rustc::hir;
12-
use traits::BuilderMethods;
12+
use crate::traits::BuilderMethods;
1313

1414
pub fn type_needs_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
1515
ty.needs_drop(tcx, ty::ParamEnv::reveal_all())
@@ -123,7 +123,7 @@ pub enum TypeKind {
123123
mod temp_stable_hash_impls {
124124
use rustc_data_structures::stable_hasher::{StableHasherResult, StableHasher,
125125
HashStable};
126-
use ModuleCodegen;
126+
use crate::ModuleCodegen;
127127

128128
impl<HCX, M> HashStable<HCX> for ModuleCodegen<M> {
129129
fn hash_stable<W: StableHasherResult>(&self,

src/librustc_codegen_ssa/glue.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
//
33
// Code relating to drop glue.
44

5-
use std;
6-
7-
use common::IntPredicate;
8-
use meth;
95
use rustc::ty::{self, Ty};
10-
use traits::*;
6+
use crate::common::IntPredicate;
7+
use crate::meth;
8+
use crate::traits::*;
119

1210
pub fn size_and_align_of_dst<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
1311
bx: &mut Bx,

src/librustc_codegen_ssa/lib.rs

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,19 @@
1010
#![feature(nll)]
1111
#![allow(unused_attributes)]
1212
#![allow(dead_code)]
13+
#![deny(rust_2018_idioms)]
14+
#![allow(explicit_outlives_requirements)]
15+
#![allow(elided_lifetimes_in_paths)]
1316

1417
#![recursion_limit="256"]
1518

1619
//! This crate contains codegen code that is used by all codegen backends (LLVM and others).
1720
//! The backend-agnostic functions of this crate use functions defined in various traits that
1821
//! have to be implemented by each backends.
1922
20-
#[macro_use] extern crate bitflags;
2123
#[macro_use] extern crate log;
22-
extern crate rustc_apfloat;
23-
#[macro_use] extern crate rustc;
24-
extern crate rustc_target;
25-
extern crate rustc_mir;
24+
#[macro_use] extern crate rustc;
2625
#[macro_use] extern crate syntax;
27-
extern crate syntax_pos;
28-
extern crate rustc_incremental;
29-
extern crate rustc_codegen_utils;
30-
extern crate rustc_data_structures;
31-
extern crate rustc_allocator;
32-
extern crate rustc_fs_util;
33-
extern crate serialize;
34-
extern crate rustc_errors;
35-
extern crate rustc_demangle;
36-
extern crate cc;
37-
extern crate libc;
38-
extern crate jobserver;
39-
extern crate memmap;
40-
extern crate num_cpus;
4126

4227
use std::path::PathBuf;
4328
use rustc::dep_graph::WorkProduct;
@@ -133,7 +118,7 @@ pub enum ModuleKind {
133118
Allocator,
134119
}
135120

136-
bitflags! {
121+
bitflags::bitflags! {
137122
pub struct MemFlags: u8 {
138123
const VOLATILE = 1 << 0;
139124
const NONTEMPORAL = 1 << 1;

src/librustc_codegen_ssa/meth.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use rustc_target::abi::call::FnType;
2-
use callee;
32
use rustc_mir::monomorphize;
43

5-
use traits::*;
4+
use crate::callee;
5+
use crate::traits::*;
66

77
use rustc::ty::{self, Ty};
88

0 commit comments

Comments
 (0)