From 72e6f0cc167159f8a1ab3ce8ce92fbb34c347429 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 21 Apr 2024 17:35:09 +0000 Subject: [PATCH] Remove a couple of items from the crate prelude --- src/abi/mod.rs | 2 ++ src/base.rs | 2 ++ src/common.rs | 4 +++- src/debuginfo/mod.rs | 2 +- src/driver/jit.rs | 1 + src/inline_asm.rs | 1 + src/lib.rs | 12 ++++-------- src/main_shim.rs | 1 + src/value_and_place.rs | 1 + 9 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/abi/mod.rs b/src/abi/mod.rs index 6363a0d59a4..6f346af25c6 100644 --- a/src/abi/mod.rs +++ b/src/abi/mod.rs @@ -7,11 +7,13 @@ use std::borrow::Cow; use cranelift_codegen::ir::SigRef; +use cranelift_codegen::isa::CallConv; use cranelift_module::ModuleError; use rustc_codegen_ssa::errors::CompilerBuiltinsCannotCall; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc_middle::ty::layout::FnAbiOf; use rustc_middle::ty::print::with_no_trimmed_paths; +use rustc_middle::ty::TypeVisitableExt; use rustc_monomorphize::is_call_from_compiler_builtins_to_upstream_monomorphization; use rustc_session::Session; use rustc_span::source_map::Spanned; diff --git a/src/base.rs b/src/base.rs index f07421431da..46301278382 100644 --- a/src/base.rs +++ b/src/base.rs @@ -2,12 +2,14 @@ use cranelift_codegen::ir::UserFuncName; use cranelift_codegen::CodegenError; +use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext}; use cranelift_module::ModuleError; use rustc_ast::InlineAsmOptions; use rustc_index::IndexVec; use rustc_middle::ty::adjustment::PointerCoercion; use rustc_middle::ty::layout::FnAbiOf; use rustc_middle::ty::print::with_no_trimmed_paths; +use rustc_middle::ty::TypeVisitableExt; use rustc_monomorphize::is_call_from_compiler_builtins_to_upstream_monomorphization; use crate::constant::ConstantCx; diff --git a/src/common.rs b/src/common.rs index cf0b065414d..2a24d6150bd 100644 --- a/src/common.rs +++ b/src/common.rs @@ -1,8 +1,10 @@ use cranelift_codegen::isa::TargetFrontendConfig; +use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext}; use rustc_index::IndexVec; use rustc_middle::ty::layout::{ - FnAbiError, FnAbiOfHelpers, FnAbiRequest, LayoutError, LayoutOfHelpers, + self, FnAbiError, FnAbiOfHelpers, FnAbiRequest, LayoutError, LayoutOfHelpers, }; +use rustc_middle::ty::TypeFoldable; use rustc_span::source_map::Spanned; use rustc_target::abi::call::FnAbi; use rustc_target::abi::{Integer, Primitive}; diff --git a/src/debuginfo/mod.rs b/src/debuginfo/mod.rs index 5d943b5d996..f0b78e5d7c6 100644 --- a/src/debuginfo/mod.rs +++ b/src/debuginfo/mod.rs @@ -19,7 +19,7 @@ use rustc_hir::def::DefKind; use rustc_hir::def_id::DefIdMap; use rustc_session::Session; -use rustc_span::{SourceFileHash, StableSourceFileId}; +use rustc_span::{FileNameDisplayPreference, SourceFileHash, StableSourceFileId}; use rustc_target::abi::call::FnAbi; pub(crate) use self::emit::{DebugReloc, DebugRelocName}; diff --git a/src/driver/jit.rs b/src/driver/jit.rs index 6dbc3f19127..929fa92596d 100644 --- a/src/driver/jit.rs +++ b/src/driver/jit.rs @@ -6,6 +6,7 @@ use std::os::raw::{c_char, c_int}; use std::sync::{mpsc, Mutex, OnceLock}; +use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext}; use cranelift_jit::{JITBuilder, JITModule}; use rustc_codegen_ssa::CrateInfo; use rustc_middle::mir::mono::MonoItem; diff --git a/src/inline_asm.rs b/src/inline_asm.rs index c97086ee0ad..28b92f730da 100644 --- a/src/inline_asm.rs +++ b/src/inline_asm.rs @@ -2,6 +2,7 @@ use std::fmt::Write; +use cranelift_codegen::isa::CallConv; use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_span::sym; use rustc_target::asm::*; diff --git a/src/lib.rs b/src/lib.rs index d0ab64a5584..c9f84b69997 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -87,21 +87,17 @@ mod prelude { AbiParam, Block, FuncRef, Inst, InstBuilder, MemFlags, Signature, SourceLoc, StackSlot, StackSlotData, StackSlotKind, TrapCode, Type, Value, }; - pub(crate) use cranelift_codegen::isa::{self, CallConv}; pub(crate) use cranelift_codegen::Context; - pub(crate) use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext, Variable}; pub(crate) use cranelift_module::{self, DataDescription, FuncId, Linkage, Module}; pub(crate) use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; pub(crate) use rustc_hir::def_id::{DefId, LOCAL_CRATE}; pub(crate) use rustc_index::Idx; - pub(crate) use rustc_middle::bug; pub(crate) use rustc_middle::mir::{self, *}; - pub(crate) use rustc_middle::ty::layout::{self, LayoutOf, TyAndLayout}; + pub(crate) use rustc_middle::ty::layout::{LayoutOf, TyAndLayout}; pub(crate) use rustc_middle::ty::{ - self, FloatTy, Instance, InstanceDef, IntTy, ParamEnv, Ty, TyCtxt, TypeAndMut, - TypeFoldable, TypeVisitableExt, UintTy, + self, FloatTy, Instance, InstanceDef, IntTy, ParamEnv, Ty, TyCtxt, TypeAndMut, UintTy, }; - pub(crate) use rustc_span::{FileNameDisplayPreference, Span}; + pub(crate) use rustc_span::Span; pub(crate) use rustc_target::abi::{Abi, FieldIdx, Scalar, Size, VariantIdx, FIRST_VARIANT}; pub(crate) use crate::abi::*; @@ -261,7 +257,7 @@ fn target_triple(sess: &Session) -> target_lexicon::Triple { } } -fn build_isa(sess: &Session, backend_config: &BackendConfig) -> Arc { +fn build_isa(sess: &Session, backend_config: &BackendConfig) -> Arc { use target_lexicon::BinaryFormat; let target_triple = crate::target_triple(sess); diff --git a/src/main_shim.rs b/src/main_shim.rs index 1abfded8b11..1f20ec42ddb 100644 --- a/src/main_shim.rs +++ b/src/main_shim.rs @@ -1,3 +1,4 @@ +use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext}; use rustc_hir::LangItem; use rustc_middle::ty::AssocKind; use rustc_middle::ty::GenericArg; diff --git a/src/value_and_place.rs b/src/value_and_place.rs index ad863903cee..dded6df7771 100644 --- a/src/value_and_place.rs +++ b/src/value_and_place.rs @@ -2,6 +2,7 @@ use cranelift_codegen::entity::EntityRef; use cranelift_codegen::ir::immediates::Offset32; +use cranelift_frontend::Variable; use rustc_middle::ty::FnSig; use crate::prelude::*;