From 1b7ca961d9b971a0d5833143ea0c14ac64bf2303 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Mon, 18 Feb 2019 03:58:58 +0900 Subject: [PATCH] librustc_codegen_llvm => 2018 --- src/librustc_codegen_llvm/Cargo.toml | 3 +- src/librustc_codegen_llvm/abi.rs | 12 ++++---- src/librustc_codegen_llvm/allocator.rs | 6 ++-- src/librustc_codegen_llvm/asm.rs | 10 +++---- src/librustc_codegen_llvm/attributes.rs | 14 ++++----- src/librustc_codegen_llvm/back/archive.rs | 9 +++--- src/librustc_codegen_llvm/back/link.rs | 14 ++++----- src/librustc_codegen_llvm/back/lto.rs | 15 +++++----- src/librustc_codegen_llvm/back/write.rs | 29 +++++++++--------- src/librustc_codegen_llvm/base.rs | 14 ++++----- src/librustc_codegen_llvm/builder.rs | 17 +++++------ src/librustc_codegen_llvm/callee.rs | 10 +++---- src/librustc_codegen_llvm/common.rs | 16 +++++----- src/librustc_codegen_llvm/consts.rs | 18 +++++------ src/librustc_codegen_llvm/context.rs | 30 +++++++++---------- .../debuginfo/create_scope_map.rs | 6 ++-- src/librustc_codegen_llvm/debuginfo/gdb.rs | 8 ++--- .../debuginfo/metadata.rs | 12 ++++---- src/librustc_codegen_llvm/debuginfo/mod.rs | 14 ++++----- .../debuginfo/namespace.rs | 8 ++--- .../debuginfo/source_loc.rs | 6 ++-- .../debuginfo/type_names.rs | 4 +-- src/librustc_codegen_llvm/debuginfo/utils.rs | 8 ++--- src/librustc_codegen_llvm/declare.rs | 14 ++++----- src/librustc_codegen_llvm/intrinsic.rs | 20 ++++++------- src/librustc_codegen_llvm/lib.rs | 10 ++----- src/librustc_codegen_llvm/llvm/diagnostic.rs | 2 +- src/librustc_codegen_llvm/llvm/ffi.rs | 2 -- src/librustc_codegen_llvm/llvm/mod.rs | 2 +- src/librustc_codegen_llvm/llvm_util.rs | 4 +-- src/librustc_codegen_llvm/metadata.rs | 6 ++-- src/librustc_codegen_llvm/mono_item.rs | 12 ++++---- src/librustc_codegen_llvm/type_.rs | 16 +++++----- src/librustc_codegen_llvm/type_of.rs | 6 ++-- src/librustc_codegen_llvm/va_arg.rs | 8 ++--- src/librustc_codegen_llvm/value.rs | 4 +-- 36 files changed, 190 insertions(+), 199 deletions(-) diff --git a/src/librustc_codegen_llvm/Cargo.toml b/src/librustc_codegen_llvm/Cargo.toml index b711502b14b..841cf98164e 100644 --- a/src/librustc_codegen_llvm/Cargo.toml +++ b/src/librustc_codegen_llvm/Cargo.toml @@ -2,6 +2,7 @@ authors = ["The Rust Project Developers"] name = "rustc_codegen_llvm" version = "0.0.0" +edition = "2018" [lib] name = "rustc_codegen_llvm" @@ -10,7 +11,7 @@ crate-type = ["dylib"] test = false [dependencies] -cc = "1.0.1" +cc = "1.0.1" # Used to locate MSVC num_cpus = "1.0" rustc-demangle = "0.1.4" rustc_llvm = { path = "../librustc_llvm" } diff --git a/src/librustc_codegen_llvm/abi.rs b/src/librustc_codegen_llvm/abi.rs index f7d2699a27e..992149f7a47 100644 --- a/src/librustc_codegen_llvm/abi.rs +++ b/src/librustc_codegen_llvm/abi.rs @@ -1,12 +1,12 @@ -use llvm::{self, AttributePlace}; +use crate::llvm::{self, AttributePlace}; +use crate::builder::Builder; +use crate::context::CodegenCx; +use crate::type_::Type; +use crate::type_of::{LayoutLlvmExt, PointerKind}; +use crate::value::Value; use rustc_codegen_ssa::MemFlags; -use builder::Builder; -use context::CodegenCx; use rustc_codegen_ssa::mir::place::PlaceRef; use rustc_codegen_ssa::mir::operand::OperandValue; -use type_::Type; -use type_of::{LayoutLlvmExt, PointerKind}; -use value::Value; use rustc_target::abi::call::ArgType; use rustc_codegen_ssa::traits::*; diff --git a/src/librustc_codegen_llvm/allocator.rs b/src/librustc_codegen_llvm/allocator.rs index 56bbaf55f75..7430cd3f709 100644 --- a/src/librustc_codegen_llvm/allocator.rs +++ b/src/librustc_codegen_llvm/allocator.rs @@ -1,13 +1,13 @@ use std::ffi::CString; -use attributes; +use crate::attributes; use libc::c_uint; use rustc::middle::allocator::AllocatorKind; use rustc::ty::TyCtxt; use rustc_allocator::{ALLOCATOR_METHODS, AllocatorTy}; -use ModuleLlvm; -use llvm::{self, False, True}; +use crate::ModuleLlvm; +use crate::llvm::{self, False, True}; pub(crate) unsafe fn codegen(tcx: TyCtxt, mods: &ModuleLlvm, kind: AllocatorKind) { let llcx = &*mods.llcx; diff --git a/src/librustc_codegen_llvm/asm.rs b/src/librustc_codegen_llvm/asm.rs index 5c1a8b070c9..4427308f415 100644 --- a/src/librustc_codegen_llvm/asm.rs +++ b/src/librustc_codegen_llvm/asm.rs @@ -1,8 +1,8 @@ -use llvm; -use context::CodegenCx; -use type_of::LayoutLlvmExt; -use builder::Builder; -use value::Value; +use crate::llvm; +use crate::context::CodegenCx; +use crate::type_of::LayoutLlvmExt; +use crate::builder::Builder; +use crate::value::Value; use rustc::hir; use rustc_codegen_ssa::traits::*; diff --git a/src/librustc_codegen_llvm/attributes.rs b/src/librustc_codegen_llvm/attributes.rs index e6bc7bca46b..827ebff10f5 100644 --- a/src/librustc_codegen_llvm/attributes.rs +++ b/src/librustc_codegen_llvm/attributes.rs @@ -15,15 +15,15 @@ use rustc_target::spec::PanicStrategy; use rustc_codegen_ssa::traits::*; -use abi::Abi; -use attributes; -use llvm::{self, Attribute}; -use llvm::AttributePlace::Function; -use llvm_util; +use crate::abi::Abi; +use crate::attributes; +use crate::llvm::{self, Attribute}; +use crate::llvm::AttributePlace::Function; +use crate::llvm_util; pub use syntax::attr::{self, InlineAttr, OptimizeAttr}; -use context::CodegenCx; -use value::Value; +use crate::context::CodegenCx; +use crate::value::Value; /// Mark LLVM function to use provided inline heuristic. #[inline] diff --git a/src/librustc_codegen_llvm/back/archive.rs b/src/librustc_codegen_llvm/back/archive.rs index e02f7df2efc..1c090f14469 100644 --- a/src/librustc_codegen_llvm/back/archive.rs +++ b/src/librustc_codegen_llvm/back/archive.rs @@ -7,12 +7,11 @@ use std::ptr; use std::str; -use back::bytecode::RLIB_BYTECODE_EXTENSION; +use crate::back::bytecode::RLIB_BYTECODE_EXTENSION; +use crate::llvm::archive_ro::{ArchiveRO, Child}; +use crate::llvm::{self, ArchiveKind}; +use crate::metadata::METADATA_FILENAME; use rustc_codegen_ssa::back::archive::find_library; -use libc; -use llvm::archive_ro::{ArchiveRO, Child}; -use llvm::{self, ArchiveKind}; -use metadata::METADATA_FILENAME; use rustc::session::Session; pub struct ArchiveConfig<'a> { diff --git a/src/librustc_codegen_llvm/back/link.rs b/src/librustc_codegen_llvm/back/link.rs index 548c94abc07..a3b34485715 100644 --- a/src/librustc_codegen_llvm/back/link.rs +++ b/src/librustc_codegen_llvm/back/link.rs @@ -1,13 +1,15 @@ -use back::wasm; use super::archive::{ArchiveBuilder, ArchiveConfig}; use super::bytecode::RLIB_BYTECODE_EXTENSION; +use super::rpath::RPathConfig; +use super::rpath; +use crate::back::wasm; +use crate::metadata::METADATA_FILENAME; +use crate::context::get_reloc_model; +use crate::llvm; use rustc_codegen_ssa::back::linker::Linker; use rustc_codegen_ssa::back::link::{remove, ignored_for_lto, each_linked_rlib, linker_and_flavor, get_linker}; use rustc_codegen_ssa::back::command::Command; -use super::rpath::RPathConfig; -use super::rpath; -use metadata::METADATA_FILENAME; use rustc::session::config::{self, DebugInfo, OutputFilenames, OutputType, PrintRequest}; use rustc::session::config::{RUST_CGU_EXT, Lto, Sanitizer}; use rustc::session::filesearch; @@ -22,8 +24,6 @@ use tempfile::{Builder as TempFileBuilder, TempDir}; use rustc_target::spec::{PanicStrategy, RelroLevel, LinkerFlavor}; use rustc_data_structures::fx::FxHashSet; -use context::get_reloc_model; -use llvm; use std::ascii; use std::char; @@ -523,7 +523,7 @@ fn link_natively(sess: &Session, } { - let target_cpu = ::llvm_util::target_cpu(sess); + let target_cpu = crate::llvm_util::target_cpu(sess); let mut linker = codegen_results.linker_info.to_linker(cmd, &sess, flavor, target_cpu); link_args(&mut *linker, flavor, sess, crate_type, tmpdir, out_filename, codegen_results); diff --git a/src/librustc_codegen_llvm/back/lto.rs b/src/librustc_codegen_llvm/back/lto.rs index fc3ab7f734a..944569c8b74 100644 --- a/src/librustc_codegen_llvm/back/lto.rs +++ b/src/librustc_codegen_llvm/back/lto.rs @@ -1,12 +1,15 @@ -use back::bytecode::{DecodedBytecode, RLIB_BYTECODE_EXTENSION}; +use crate::back::bytecode::{DecodedBytecode, RLIB_BYTECODE_EXTENSION}; +use crate::back::write::{self, DiagnosticHandlers, with_llvm_pmb, save_temp_bitcode, + to_llvm_opt_settings}; +use crate::llvm::archive_ro::ArchiveRO; +use crate::llvm::{self, True, False}; +use crate::time_graph::Timeline; +use crate::{ModuleLlvm, LlvmCodegenBackend}; use rustc_codegen_ssa::back::symbol_export; use rustc_codegen_ssa::back::write::{ModuleConfig, CodegenContext, FatLTOInput}; use rustc_codegen_ssa::back::lto::{SerializedModule, LtoModuleCodegen, ThinShared, ThinModule}; use rustc_codegen_ssa::traits::*; -use back::write::{self, DiagnosticHandlers, with_llvm_pmb, save_temp_bitcode, to_llvm_opt_settings}; use errors::{FatalError, Handler}; -use llvm::archive_ro::ArchiveRO; -use llvm::{self, True, False}; use rustc::dep_graph::WorkProduct; use rustc::dep_graph::cgu_reuse_tracker::CguReuse; use rustc::hir::def_id::LOCAL_CRATE; @@ -14,12 +17,8 @@ use rustc::session::config::{self, Lto}; use rustc::util::common::time_ext; use rustc_data_structures::fx::FxHashMap; -use time_graph::Timeline; -use {ModuleLlvm, LlvmCodegenBackend}; use rustc_codegen_ssa::{ModuleCodegen, ModuleKind}; -use libc; - use std::ffi::{CStr, CString}; use std::ptr; use std::slice; diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs index e7871531972..1b160805152 100644 --- a/src/librustc_codegen_llvm/back/write.rs +++ b/src/librustc_codegen_llvm/back/write.rs @@ -1,28 +1,27 @@ -use attributes; -use back::bytecode::{self, RLIB_BYTECODE_EXTENSION}; -use back::lto::ThinBuffer; +use crate::attributes; +use crate::back::bytecode::{self, RLIB_BYTECODE_EXTENSION}; +use crate::back::lto::ThinBuffer; +use crate::base; +use crate::consts; +use crate::time_graph::Timeline; +use crate::llvm::{self, DiagnosticInfo, PassManager, SMDiagnostic}; +use crate::llvm_util; +use crate::ModuleLlvm; +use crate::type_::Type; +use crate::context::{is_pie_binary, get_reloc_model}; +use crate::common; +use crate::LlvmCodegenBackend; use rustc_codegen_ssa::back::write::{CodegenContext, ModuleConfig, run_assembler}; use rustc_codegen_ssa::traits::*; -use base; -use consts; use rustc::hir::def_id::LOCAL_CRATE; use rustc::session::config::{self, OutputType, Passes, Lto}; use rustc::session::Session; use rustc::ty::TyCtxt; -use time_graph::Timeline; -use llvm::{self, DiagnosticInfo, PassManager, SMDiagnostic}; -use llvm_util; -use ModuleLlvm; use rustc_codegen_ssa::{ModuleCodegen, CompiledModule}; use rustc::util::common::time_ext; use rustc_fs_util::{path_to_c_string, link_or_copy}; use rustc_data_structures::small_c_str::SmallCStr; -use errors::{self, Handler, FatalError}; -use type_::Type; -use context::{is_pie_binary, get_reloc_model}; -use common; -use LlvmCodegenBackend; -use rustc_demangle; +use errors::{Handler, FatalError}; use std::ffi::{CString, CStr}; use std::fs; diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs index 70986a4e179..33531bb6948 100644 --- a/src/librustc_codegen_llvm/base.rs +++ b/src/librustc_codegen_llvm/base.rs @@ -18,18 +18,18 @@ use rustc_codegen_ssa::base::maybe_create_entry_wrapper; use super::LlvmCodegenBackend; -use llvm; -use metadata; +use crate::llvm; +use crate::metadata; +use crate::builder::Builder; +use crate::common; +use crate::context::CodegenCx; +use crate::monomorphize::partitioning::CodegenUnitExt; use rustc::dep_graph; use rustc::mir::mono::{Linkage, Visibility, Stats}; use rustc::middle::cstore::{EncodedMetadata}; use rustc::ty::TyCtxt; use rustc::middle::exported_symbols; use rustc::session::config::{self, DebugInfo}; -use builder::Builder; -use common; -use context::CodegenCx; -use monomorphize::partitioning::CodegenUnitExt; use rustc_codegen_ssa::mono_item::MonoItemExt; use rustc_data_structures::small_c_str::SmallCStr; @@ -41,7 +41,7 @@ use syntax_pos::symbol::InternedString; use rustc::hir::CodegenFnAttrs; -use value::Value; +use crate::value::Value; pub fn write_metadata<'a, 'gcx>( diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index b79d0da0bcd..39c8f8a0940 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -1,12 +1,12 @@ -use llvm::{AtomicRmwBinOp, AtomicOrdering, SynchronizationScope, AsmDialect}; -use llvm::{self, False, BasicBlock}; +use crate::llvm::{AtomicRmwBinOp, AtomicOrdering, SynchronizationScope, AsmDialect}; +use crate::llvm::{self, False, BasicBlock}; +use crate::common::Funclet; +use crate::context::CodegenCx; +use crate::type_::Type; +use crate::type_of::LayoutLlvmExt; +use crate::value::Value; use rustc_codegen_ssa::common::{IntPredicate, TypeKind, RealPredicate}; -use rustc_codegen_ssa::{self, MemFlags}; -use common::Funclet; -use context::CodegenCx; -use type_::Type; -use type_of::LayoutLlvmExt; -use value::Value; +use rustc_codegen_ssa::MemFlags; use libc::{c_uint, c_char}; use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::layout::{self, Align, Size, TyLayout}; @@ -14,7 +14,6 @@ use rustc::session::config; use rustc_data_structures::small_c_str::SmallCStr; use rustc_codegen_ssa::traits::*; -use syntax; use rustc_codegen_ssa::base::to_immediate; use rustc_codegen_ssa::mir::operand::{OperandValue, OperandRef}; use rustc_codegen_ssa::mir::place::PlaceRef; diff --git a/src/librustc_codegen_llvm/callee.rs b/src/librustc_codegen_llvm/callee.rs index 9426328da32..43a5767e5c6 100644 --- a/src/librustc_codegen_llvm/callee.rs +++ b/src/librustc_codegen_llvm/callee.rs @@ -4,11 +4,11 @@ //! and methods are represented as just a fn ptr and not a full //! closure. -use attributes; -use llvm; -use monomorphize::Instance; -use context::CodegenCx; -use value::Value; +use crate::attributes; +use crate::llvm; +use crate::monomorphize::Instance; +use crate::context::CodegenCx; +use crate::value::Value; use rustc_codegen_ssa::traits::*; use rustc::ty::TypeFoldable; diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs index 675d6ccb504..4bd036ea3b1 100644 --- a/src/librustc_codegen_llvm/common.rs +++ b/src/librustc_codegen_llvm/common.rs @@ -2,17 +2,17 @@ //! Code that is useful in various codegen modules. -use llvm::{self, True, False, Bool, BasicBlock, OperandBundleDef}; -use abi; -use consts; -use type_::Type; -use type_of::LayoutLlvmExt; -use value::Value; +use crate::llvm::{self, True, False, Bool, BasicBlock, OperandBundleDef}; +use crate::abi; +use crate::consts; +use crate::type_::Type; +use crate::type_of::LayoutLlvmExt; +use crate::value::Value; use rustc_codegen_ssa::traits::*; +use crate::consts::const_alloc_to_llvm; use rustc::ty::layout::{HasDataLayout, LayoutOf, self, TyLayout, Size}; use rustc::mir::interpret::{Scalar, AllocKind, Allocation}; -use consts::const_alloc_to_llvm; use rustc_codegen_ssa::mir::place::PlaceRef; use libc::{c_uint, c_char}; @@ -20,7 +20,7 @@ use syntax::symbol::LocalInternedString; use syntax::ast::Mutability; -pub use context::CodegenCx; +pub use crate::context::CodegenCx; /* * A note on nomenclature of linking: "extern", "foreign", and "upcall". diff --git a/src/librustc_codegen_llvm/consts.rs b/src/librustc_codegen_llvm/consts.rs index ca9e2c87be2..6232d44df5e 100644 --- a/src/librustc_codegen_llvm/consts.rs +++ b/src/librustc_codegen_llvm/consts.rs @@ -1,20 +1,20 @@ +use crate::llvm::{self, SetUnnamedAddr, True}; +use crate::debuginfo; +use crate::monomorphize::MonoItem; +use crate::common::CodegenCx; +use crate::monomorphize::Instance; +use crate::base; +use crate::type_::Type; +use crate::type_of::LayoutLlvmExt; +use crate::value::Value; use libc::c_uint; -use llvm::{self, SetUnnamedAddr, True}; use rustc::hir::def_id::DefId; use rustc::mir::interpret::{ConstValue, Allocation, read_target_uint, Pointer, ErrorHandled, GlobalId}; use rustc::hir::Node; -use debuginfo; -use monomorphize::MonoItem; -use common::CodegenCx; -use monomorphize::Instance; use syntax_pos::Span; use rustc_target::abi::HasDataLayout; use syntax_pos::symbol::LocalInternedString; -use base; -use type_::Type; -use type_of::LayoutLlvmExt; -use value::Value; use rustc::ty::{self, Ty}; use rustc_codegen_ssa::traits::*; diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index 8144132832e..d9c4d22b411 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -1,14 +1,14 @@ -use attributes; -use llvm; +use crate::attributes; +use crate::llvm; +use crate::debuginfo; +use crate::monomorphize::Instance; +use crate::value::Value; use rustc::dep_graph::DepGraphSafe; use rustc::hir; -use debuginfo; -use monomorphize::Instance; -use value::Value; -use monomorphize::partitioning::CodegenUnit; -use type_::Type; -use type_of::PointeeInfo; +use crate::monomorphize::partitioning::CodegenUnit; +use crate::type_::Type; +use crate::type_of::PointeeInfo; use rustc_codegen_ssa::traits::*; use libc::c_uint; @@ -23,7 +23,7 @@ use rustc_target::spec::{HasTargetSpec, Target}; use rustc_codegen_ssa::callee::resolve_and_get_fn; use rustc_codegen_ssa::base::wants_msvc_seh; -use callee::get_fn; +use crate::callee::get_fn; use std::ffi::CStr; use std::cell::{Cell, RefCell}; @@ -31,7 +31,7 @@ use std::str; use std::sync::Arc; use syntax::symbol::LocalInternedString; -use abi::Abi; +use crate::abi::Abi; /// There is one `CodegenCx` per compilation unit. Each one has its own LLVM /// `llvm::Context` so that several compilation units may be optimized in parallel. @@ -103,7 +103,7 @@ pub fn get_reloc_model(sess: &Session) -> llvm::RelocMode { None => &sess.target.target.options.relocation_model[..], }; - match ::back::write::RELOC_MODEL_ARGS.iter().find( + match crate::back::write::RELOC_MODEL_ARGS.iter().find( |&&arg| arg.0 == reloc_model_arg) { Some(x) => x.1, _ => { @@ -121,7 +121,7 @@ fn get_tls_model(sess: &Session) -> llvm::ThreadLocalMode { None => &sess.target.target.options.tls_model[..], }; - match ::back::write::TLS_MODEL_ARGS.iter().find( + match crate::back::write::TLS_MODEL_ARGS.iter().find( |&&arg| arg.0 == tls_model_arg) { Some(x) => x.1, _ => { @@ -154,7 +154,7 @@ pub unsafe fn create_module( // Ensure the data-layout values hardcoded remain the defaults. if sess.target.target.options.is_builtin { - let tm = ::back::write::create_target_machine(tcx, false); + let tm = crate::back::write::create_target_machine(tcx, false); llvm::LLVMRustSetDataLayoutFromTargetMachine(llmod, tm); llvm::LLVMRustDisposeTargetMachine(tm); @@ -212,7 +212,7 @@ pub unsafe fn create_module( impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { crate fn new(tcx: TyCtxt<'ll, 'tcx, 'tcx>, codegen_unit: Arc>, - llvm_module: &'ll ::ModuleLlvm) + llvm_module: &'ll crate::ModuleLlvm) -> Self { // An interesting part of Windows which MSVC forces our hand on (and // apparently MinGW didn't) is the usage of `dllimport` and `dllexport` @@ -377,7 +377,7 @@ fn eh_personality(&self) -> &'ll Value { // Returns a Value of the "eh_unwind_resume" lang item if one is defined, // otherwise declares it as an external function. fn eh_unwind_resume(&self) -> &'ll Value { - use attributes; + use crate::attributes; let unwresume = &self.eh_unwind_resume; if let Some(llfn) = unwresume.get() { return llfn; diff --git a/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs b/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs index 791526c98c8..3ba05bf1b5c 100644 --- a/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs +++ b/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs @@ -2,9 +2,9 @@ use super::metadata::file_metadata; use super::utils::{DIB, span_start}; -use llvm; -use llvm::debuginfo::{DIScope, DISubprogram}; -use common::CodegenCx; +use crate::llvm; +use crate::llvm::debuginfo::{DIScope, DISubprogram}; +use crate::common::CodegenCx; use rustc::mir::{Mir, SourceScope}; use libc::c_uint; diff --git a/src/librustc_codegen_llvm/debuginfo/gdb.rs b/src/librustc_codegen_llvm/debuginfo/gdb.rs index c883d603095..2555c92fb7c 100644 --- a/src/librustc_codegen_llvm/debuginfo/gdb.rs +++ b/src/librustc_codegen_llvm/debuginfo/gdb.rs @@ -1,11 +1,11 @@ // .debug_gdb_scripts binary section. -use llvm; +use crate::llvm; -use common::CodegenCx; -use builder::Builder; +use crate::common::CodegenCx; +use crate::builder::Builder; +use crate::value::Value; use rustc::session::config::DebugInfo; -use value::Value; use rustc_codegen_ssa::traits::*; use syntax::attr; diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index 3a7864cb7a5..da9ff54b062 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -7,15 +7,16 @@ use super::namespace::mangled_name_of_instance; use super::type_names::compute_debuginfo_type_name; use super::{CrateDebugContext}; +use crate::abi; +use crate::value::Value; use rustc_codegen_ssa::traits::*; -use abi; -use value::Value; -use llvm; -use llvm::debuginfo::{DIArray, DIType, DIFile, DIScope, DIDescriptor, +use crate::llvm; +use crate::llvm::debuginfo::{DIArray, DIType, DIFile, DIScope, DIDescriptor, DICompositeType, DILexicalBlock, DIFlags, DebugEmissionKind}; -use llvm_util; +use crate::llvm_util; +use crate::common::CodegenCx; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc::hir::CodegenFnAttrFlags; use rustc::hir::def::CtorKind; @@ -23,7 +24,6 @@ use rustc::ich::NodeIdHashingMode; use rustc_data_structures::fingerprint::Fingerprint; use rustc::ty::Instance; -use common::CodegenCx; use rustc::ty::{self, AdtKind, ParamEnv, Ty, TyCtxt}; use rustc::ty::layout::{self, Align, Integer, IntegerExt, LayoutOf, PrimitiveExt, Size, TyLayout}; diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs index 625f6cd45fb..664ca253387 100644 --- a/src/librustc_codegen_llvm/debuginfo/mod.rs +++ b/src/librustc_codegen_llvm/debuginfo/mod.rs @@ -10,24 +10,24 @@ use self::metadata::{type_metadata, file_metadata, TypeMap}; use self::source_loc::InternalDebugLocation::{self, UnknownLocation}; -use llvm; -use llvm::debuginfo::{DIFile, DIType, DIScope, DIBuilder, DISubprogram, DIArray, DIFlags, +use crate::llvm; +use crate::llvm::debuginfo::{DIFile, DIType, DIScope, DIBuilder, DISubprogram, DIArray, DIFlags, DISPFlags, DILexicalBlock}; use rustc::hir::CodegenFnAttrFlags; use rustc::hir::def_id::{DefId, CrateNum, LOCAL_CRATE}; use rustc::ty::subst::{Substs, UnpackedKind}; -use abi::Abi; -use common::CodegenCx; -use builder::Builder; -use monomorphize::Instance; +use crate::abi::Abi; +use crate::common::CodegenCx; +use crate::builder::Builder; +use crate::monomorphize::Instance; +use crate::value::Value; use rustc::ty::{self, ParamEnv, Ty, InstanceDef}; use rustc::mir; use rustc::session::config::{self, DebugInfo}; use rustc::util::nodemap::{DefIdMap, FxHashMap, FxHashSet}; use rustc_data_structures::small_c_str::SmallCStr; use rustc_data_structures::indexed_vec::IndexVec; -use value::Value; use rustc_codegen_ssa::debuginfo::{FunctionDebugContext, MirDebugScope, VariableAccess, VariableKind, FunctionDebugContextData}; diff --git a/src/librustc_codegen_llvm/debuginfo/namespace.rs b/src/librustc_codegen_llvm/debuginfo/namespace.rs index 36188b8fc47..f7c377adf35 100644 --- a/src/librustc_codegen_llvm/debuginfo/namespace.rs +++ b/src/librustc_codegen_llvm/debuginfo/namespace.rs @@ -2,14 +2,14 @@ use super::metadata::{unknown_file_metadata, UNKNOWN_LINE_NUMBER}; use super::utils::{DIB, debug_context}; -use monomorphize::Instance; +use crate::monomorphize::Instance; use rustc::ty; -use llvm; -use llvm::debuginfo::DIScope; +use crate::llvm; +use crate::llvm::debuginfo::DIScope; +use crate::common::CodegenCx; use rustc::hir::def_id::DefId; use rustc::hir::map::DefPathData; -use common::CodegenCx; use rustc_data_structures::small_c_str::SmallCStr; diff --git a/src/librustc_codegen_llvm/debuginfo/source_loc.rs b/src/librustc_codegen_llvm/debuginfo/source_loc.rs index ccf56c11e73..f7620e11c23 100644 --- a/src/librustc_codegen_llvm/debuginfo/source_loc.rs +++ b/src/librustc_codegen_llvm/debuginfo/source_loc.rs @@ -4,9 +4,9 @@ use super::metadata::UNKNOWN_COLUMN_NUMBER; use rustc_codegen_ssa::debuginfo::FunctionDebugContext; -use llvm; -use llvm::debuginfo::DIScope; -use builder::Builder; +use crate::llvm; +use crate::llvm::debuginfo::DIScope; +use crate::builder::Builder; use rustc_codegen_ssa::traits::*; use libc::c_uint; diff --git a/src/librustc_codegen_llvm/debuginfo/type_names.rs b/src/librustc_codegen_llvm/debuginfo/type_names.rs index 32432f7e4ec..1697bb7b52d 100644 --- a/src/librustc_codegen_llvm/debuginfo/type_names.rs +++ b/src/librustc_codegen_llvm/debuginfo/type_names.rs @@ -1,6 +1,6 @@ // Type Names for Debug Info. -use common::CodegenCx; +use crate::common::CodegenCx; use rustc::hir::def_id::DefId; use rustc::ty::subst::Substs; use rustc::ty::{self, Ty}; @@ -125,7 +125,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, } let abi = sig.abi(); - if abi != ::abi::Abi::Rust { + if abi != crate::abi::Abi::Rust { output.push_str("extern \""); output.push_str(abi.name()); output.push_str("\" "); diff --git a/src/librustc_codegen_llvm/debuginfo/utils.rs b/src/librustc_codegen_llvm/debuginfo/utils.rs index f2d92eefad3..e1b299df6c3 100644 --- a/src/librustc_codegen_llvm/debuginfo/utils.rs +++ b/src/librustc_codegen_llvm/debuginfo/utils.rs @@ -6,12 +6,12 @@ use rustc::hir::def_id::DefId; use rustc::ty::DefIdTree; -use llvm; -use llvm::debuginfo::{DIScope, DIBuilder, DIDescriptor, DIArray}; -use common::{CodegenCx}; +use crate::llvm; +use crate::llvm::debuginfo::{DIScope, DIBuilder, DIDescriptor, DIArray}; +use crate::common::{CodegenCx}; use rustc_codegen_ssa::traits::*; -use syntax_pos::{self, Span}; +use syntax_pos::Span; pub fn is_node_local_to_unit(cx: &CodegenCx, def_id: DefId) -> bool { diff --git a/src/librustc_codegen_llvm/declare.rs b/src/librustc_codegen_llvm/declare.rs index 6b7ee16cb71..3febcb019ce 100644 --- a/src/librustc_codegen_llvm/declare.rs +++ b/src/librustc_codegen_llvm/declare.rs @@ -11,18 +11,18 @@ //! * Use define_* family of methods when you might be defining the Value. //! * When in doubt, define. -use llvm; -use llvm::AttributePlace::Function; +use crate::llvm; +use crate::llvm::AttributePlace::Function; +use crate::abi::{FnType, FnTypeExt}; +use crate::attributes; +use crate::context::CodegenCx; +use crate::type_::Type; +use crate::value::Value; use rustc::ty::{self, PolyFnSig}; use rustc::ty::layout::LayoutOf; use rustc::session::config::Sanitizer; use rustc_data_structures::small_c_str::SmallCStr; -use abi::{FnType, FnTypeExt}; -use attributes; -use context::CodegenCx; -use type_::Type; use rustc_codegen_ssa::traits::*; -use value::Value; /// Declare a function. /// diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index 58b466dbe6f..e99de02580c 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -1,26 +1,26 @@ #![allow(non_upper_case_globals)] -use attributes; -use llvm; -use llvm_util; -use abi::{Abi, FnType, LlvmType, PassMode}; +use crate::attributes; +use crate::llvm; +use crate::llvm_util; +use crate::abi::{Abi, FnType, LlvmType, PassMode}; +use crate::context::CodegenCx; +use crate::type_::Type; +use crate::type_of::LayoutLlvmExt; +use crate::builder::Builder; +use crate::value::Value; +use crate::va_arg::emit_va_arg; use rustc_codegen_ssa::MemFlags; use rustc_codegen_ssa::mir::place::PlaceRef; use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue}; use rustc_codegen_ssa::glue; use rustc_codegen_ssa::base::{to_immediate, wants_msvc_seh, compare_simd_types}; -use context::CodegenCx; -use type_::Type; -use type_of::LayoutLlvmExt; use rustc::ty::{self, Ty}; use rustc::ty::layout::{self, LayoutOf, HasTyCtxt, Primitive}; use rustc_codegen_ssa::common::{IntPredicate, TypeKind}; use rustc::hir; use syntax::ast::{self, FloatTy}; use syntax::symbol::Symbol; -use builder::Builder; -use value::Value; -use va_arg::emit_va_arg; use rustc_codegen_ssa::traits::*; diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index e344f8732f8..9219f42d692 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -21,6 +21,9 @@ #![feature(concat_idents)] #![feature(link_args)] #![feature(static_nobundle)] +#![deny(rust_2018_idioms)] +#![allow(explicit_outlives_requirements)] +#![allow(elided_lifetimes_in_paths)] use back::write::create_target_machine; use syntax_pos::symbol::Symbol; @@ -29,16 +32,11 @@ #[macro_use] extern crate bitflags; extern crate libc; #[macro_use] extern crate rustc; -extern crate jobserver; -extern crate num_cpus; extern crate rustc_mir; extern crate rustc_allocator; -extern crate rustc_apfloat; extern crate rustc_target; #[macro_use] extern crate rustc_data_structures; -extern crate rustc_demangle; extern crate rustc_incremental; -extern crate rustc_llvm; extern crate rustc_codegen_utils; extern crate rustc_codegen_ssa; extern crate rustc_fs_util; @@ -48,9 +46,7 @@ extern crate syntax_pos; extern crate rustc_errors as errors; extern crate serialize; -extern crate cc; // Used to locate MSVC extern crate tempfile; -extern crate memmap; use rustc_codegen_ssa::traits::*; use rustc_codegen_ssa::back::write::{CodegenContext, ModuleConfig, FatLTOInput}; diff --git a/src/librustc_codegen_llvm/llvm/diagnostic.rs b/src/librustc_codegen_llvm/llvm/diagnostic.rs index 0f5d28f9fec..a8d272f157c 100644 --- a/src/librustc_codegen_llvm/llvm/diagnostic.rs +++ b/src/librustc_codegen_llvm/llvm/diagnostic.rs @@ -4,7 +4,7 @@ pub use self::Diagnostic::*; use libc::c_uint; -use value::Value; +use crate::value::Value; use super::{DiagnosticInfo, Twine}; diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs index 52292f67b33..e761d2247a7 100644 --- a/src/librustc_codegen_llvm/llvm/ffi.rs +++ b/src/librustc_codegen_llvm/llvm/ffi.rs @@ -9,8 +9,6 @@ use libc::{c_ulonglong, c_void}; use std::marker::PhantomData; -use syntax; -use rustc_codegen_ssa; use super::RustString; diff --git a/src/librustc_codegen_llvm/llvm/mod.rs b/src/librustc_codegen_llvm/llvm/mod.rs index 6a596d78da2..543cc912930 100644 --- a/src/librustc_codegen_llvm/llvm/mod.rs +++ b/src/librustc_codegen_llvm/llvm/mod.rs @@ -16,7 +16,7 @@ use std::slice; use std::ffi::CStr; use std::cell::RefCell; -use libc::{self, c_uint, c_char, size_t}; +use libc::{c_uint, c_char, size_t}; use rustc_data_structures::small_c_str::SmallCStr; pub mod archive_ro; diff --git a/src/librustc_codegen_llvm/llvm_util.rs b/src/librustc_codegen_llvm/llvm_util.rs index ecca45a4d42..5fea9c8747e 100644 --- a/src/librustc_codegen_llvm/llvm_util.rs +++ b/src/librustc_codegen_llvm/llvm_util.rs @@ -1,6 +1,6 @@ +use crate::back::write::create_informational_target_machine; +use crate::llvm; use syntax_pos::symbol::Symbol; -use back::write::create_informational_target_machine; -use llvm; use rustc::session::Session; use rustc::session::config::PrintRequest; use rustc_target::spec::MergeFunctions; diff --git a/src/librustc_codegen_llvm/metadata.rs b/src/librustc_codegen_llvm/metadata.rs index 6e77768b558..a2df687d58f 100644 --- a/src/librustc_codegen_llvm/metadata.rs +++ b/src/librustc_codegen_llvm/metadata.rs @@ -1,8 +1,8 @@ +use crate::llvm; +use crate::llvm::{False, ObjectFile, mk_section_iter}; +use crate::llvm::archive_ro::ArchiveRO; use rustc::middle::cstore::MetadataLoader; use rustc_target::spec::Target; -use llvm; -use llvm::{False, ObjectFile, mk_section_iter}; -use llvm::archive_ro::ArchiveRO; use rustc_data_structures::owning_ref::OwningRef; use std::path::Path; diff --git a/src/librustc_codegen_llvm/mono_item.rs b/src/librustc_codegen_llvm/mono_item.rs index 69fc8783dc8..4fe6a1f4f4b 100644 --- a/src/librustc_codegen_llvm/mono_item.rs +++ b/src/librustc_codegen_llvm/mono_item.rs @@ -1,9 +1,9 @@ -use attributes; -use base; -use context::CodegenCx; -use llvm; -use monomorphize::Instance; -use type_of::LayoutLlvmExt; +use crate::attributes; +use crate::base; +use crate::context::CodegenCx; +use crate::llvm; +use crate::monomorphize::Instance; +use crate::type_of::LayoutLlvmExt; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::mir::mono::{Linkage, Visibility}; use rustc::ty::TypeFoldable; diff --git a/src/librustc_codegen_llvm/type_.rs b/src/librustc_codegen_llvm/type_.rs index 958e00506d6..781326506d0 100644 --- a/src/librustc_codegen_llvm/type_.rs +++ b/src/librustc_codegen_llvm/type_.rs @@ -1,22 +1,22 @@ #![allow(non_upper_case_globals)] -pub use llvm::Type; +pub use crate::llvm::Type; -use llvm; -use llvm::{Bool, False, True}; -use context::CodegenCx; +use crate::llvm; +use crate::llvm::{Bool, False, True}; +use crate::context::CodegenCx; +use crate::value::Value; use rustc_codegen_ssa::traits::*; -use value::Value; +use crate::common; +use crate::type_of::LayoutLlvmExt; +use crate::abi::{LlvmType, FnTypeExt}; use rustc::util::nodemap::FxHashMap; use rustc::ty::Ty; use rustc::ty::layout::TyLayout; use rustc_target::abi::call::{CastTarget, FnType, Reg}; use rustc_data_structures::small_c_str::SmallCStr; -use common; use rustc_codegen_ssa::common::TypeKind; -use type_of::LayoutLlvmExt; -use abi::{LlvmType, FnTypeExt}; use std::fmt; use std::cell::RefCell; diff --git a/src/librustc_codegen_llvm/type_of.rs b/src/librustc_codegen_llvm/type_of.rs index 39f48b266c2..fb5624d5607 100644 --- a/src/librustc_codegen_llvm/type_of.rs +++ b/src/librustc_codegen_llvm/type_of.rs @@ -1,12 +1,12 @@ -use abi::{FnType, FnTypeExt}; -use common::*; +use crate::abi::{FnType, FnTypeExt}; +use crate::common::*; +use crate::type_::Type; use rustc::hir; use rustc::ty::{self, Ty, TypeFoldable}; use rustc::ty::layout::{self, Align, LayoutOf, Size, TyLayout}; use rustc_target::abi::FloatTy; use rustc_mir::monomorphize::item::DefPathBasedNames; use rustc_codegen_ssa::traits::*; -use type_::Type; use std::fmt::Write; diff --git a/src/librustc_codegen_llvm/va_arg.rs b/src/librustc_codegen_llvm/va_arg.rs index 9239f85a8f2..8719390b51a 100644 --- a/src/librustc_codegen_llvm/va_arg.rs +++ b/src/librustc_codegen_llvm/va_arg.rs @@ -1,11 +1,11 @@ -use builder::Builder; +use crate::builder::Builder; +use crate::type_::Type; +use crate::type_of::LayoutLlvmExt; +use crate::value::Value; use rustc_codegen_ssa::mir::operand::OperandRef; use rustc_codegen_ssa::traits::{BaseTypeMethods, BuilderMethods, ConstMethods, DerivedTypeMethods}; use rustc::ty::layout::{Align, HasDataLayout, HasTyCtxt, LayoutOf, Size}; use rustc::ty::Ty; -use type_::Type; -use type_of::LayoutLlvmExt; -use value::Value; #[allow(dead_code)] fn round_pointer_up_to_alignment( diff --git a/src/librustc_codegen_llvm/value.rs b/src/librustc_codegen_llvm/value.rs index 3ad1521be93..68809284bb7 100644 --- a/src/librustc_codegen_llvm/value.rs +++ b/src/librustc_codegen_llvm/value.rs @@ -1,6 +1,6 @@ -pub use llvm::Value; +pub use crate::llvm::Value; -use llvm; +use crate::llvm; use std::fmt; use std::hash::{Hash, Hasher};