Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc_codegen_llvm: less pubs #127274

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_llvm/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ use rustc_codegen_ssa::traits::*;
use rustc_codegen_ssa::MemFlags;
use rustc_middle::bug;
use rustc_middle::ty::layout::LayoutOf;
pub use rustc_middle::ty::layout::{FAT_PTR_ADDR, FAT_PTR_EXTRA};
pub(crate) use rustc_middle::ty::layout::{FAT_PTR_ADDR, FAT_PTR_EXTRA};
use rustc_middle::ty::Ty;
use rustc_session::config;
pub use rustc_target::abi::call::*;
pub(crate) use rustc_target::abi::call::*;
use rustc_target::abi::{self, HasDataLayout, Int, Size};
pub use rustc_target::spec::abi::Abi;
pub(crate) use rustc_target::spec::abi::Abi;
use rustc_target::spec::SanitizerSet;

use libc::c_uint;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::errors::{MissingFeatures, SanitizerMemtagRequiresMte, TargetFeatureDi
use crate::llvm::AttributePlace::Function;
use crate::llvm::{self, AllocKindFlags, Attribute, AttributeKind, AttributePlace, MemoryEffects};
use crate::llvm_util;
pub use rustc_attr::{InlineAttr, InstructionSetAttr, OptimizeAttr};
pub(crate) use rustc_attr::{InlineAttr, InstructionSetAttr, OptimizeAttr};

use crate::context::CodegenCx;
use crate::value::Value;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/common.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Code that is useful in various codegen modules.

use crate::consts::const_alloc_to_llvm;
pub use crate::context::CodegenCx;
pub(crate) use crate::context::CodegenCx;
use crate::llvm::{self, BasicBlock, Bool, ConstantInt, False, OperandBundleDef, True};
use crate::type_::Type;
use crate::value::Value;
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_llvm/src/coverageinfo/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ impl CounterMappingRegion {

// This function might be used in the future; the LLVM API is still evolving, as is coverage
// support.
#[allow(dead_code)]
#[expect(dead_code)]
pub(crate) fn expansion_region(
file_id: u32,
expanded_file_id: u32,
Expand All @@ -400,7 +400,7 @@ impl CounterMappingRegion {

// This function might be used in the future; the LLVM API is still evolving, as is coverage
// support.
#[allow(dead_code)]
#[expect(dead_code)]
pub(crate) fn skipped_region(
file_id: u32,
start_line: u32,
Expand All @@ -424,7 +424,7 @@ impl CounterMappingRegion {

// This function might be used in the future; the LLVM API is still evolving, as is coverage
// support.
#[allow(dead_code)]
#[expect(dead_code)]
pub(crate) fn gap_region(
counter: Counter,
file_id: u32,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/debuginfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ pub mod metadata;
mod namespace;
mod utils;

pub use self::create_scope_map::compute_mir_scopes;
pub use self::metadata::build_global_var_di_node;
pub(crate) use self::create_scope_map::compute_mir_scopes;
pub(crate) use self::metadata::build_global_var_di_node;

#[allow(non_upper_case_globals)]
const DW_TAG_auto_variable: c_uint = 0x100;
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_codegen_llvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
#![feature(impl_trait_in_assoc_type)]
#![feature(iter_intersperse)]
#![feature(let_chains)]
#![feature(lint_reasons)]
#![feature(rustdoc_internals)]
// tidy-alphabetical-end

use back::owned_target_machine::OwnedTargetMachine;
use back::write::{create_informational_target_machine, create_target_machine};

use errors::ParseTargetMachineConfig;
pub use llvm_util::target_features;
pub(crate) use llvm_util::target_features;
use rustc_ast::expand::allocator::AllocatorKind;
use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};
use rustc_codegen_ssa::back::write::{
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/llvm/diagnostic.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! LLVM diagnostic reports.

pub use self::Diagnostic::*;
pub use self::OptimizationDiagnosticKind::*;
pub(crate) use self::Diagnostic::*;
pub(crate) use self::OptimizationDiagnosticKind::*;

use crate::value::Value;
use libc::c_uint;
Expand Down
35 changes: 24 additions & 11 deletions compiler/rustc_codegen_llvm/src/llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ pub const False: Bool = 0 as Bool;

#[derive(Copy, Clone, PartialEq)]
#[repr(C)]
#[allow(dead_code)] // Variants constructed by C++.
pub enum LLVMRustResult {
Success,
Failure,
Expand Down Expand Up @@ -147,10 +146,10 @@ pub enum UnnamedAddr {
#[derive(Copy, Clone)]
#[repr(C)]
pub enum DLLStorageClass {
#[allow(dead_code)]
#[expect(dead_code)]
Default = 0,
DllImport = 1, // Function to be imported from DLL.
#[allow(dead_code)]
#[expect(dead_code)]
DllExport = 2, // Function to be accessible from DLL.
}

Expand All @@ -161,6 +160,7 @@ pub enum DLLStorageClass {
#[derive(Copy, Clone, Debug)]
pub enum AttributeKind {
AlwaysInline = 0,
#[expect(dead_code)]
ByVal = 1,
Cold = 2,
InlineHint = 3,
Expand All @@ -176,15 +176,19 @@ pub enum AttributeKind {
OptimizeForSize = 13,
ReadOnly = 14,
SExt = 15,
#[expect(dead_code)]
StructRet = 16,
#[expect(dead_code)]
UWTable = 17,
ZExt = 18,
InReg = 19,
SanitizeThread = 20,
SanitizeAddress = 21,
SanitizeMemory = 22,
NonLazyBind = 23,
#[expect(dead_code)]
OptimizeNone = 24,
#[expect(dead_code)]
ReadNone = 26,
SanitizeHWAddress = 28,
WillReturn = 29,
Expand All @@ -195,6 +199,7 @@ pub enum AttributeKind {
SanitizeMemTag = 34,
NoCfCheck = 35,
ShadowCallStack = 36,
#[expect(dead_code)]
AllocSize = 37,
AllocatedPointer = 38,
AllocAlign = 39,
Expand Down Expand Up @@ -289,7 +294,8 @@ impl RealPredicate {
/// LLVMTypeKind
#[derive(Copy, Clone, PartialEq, Debug)]
#[repr(C)]
pub enum TypeKind {
#[expect(dead_code)] // FP, see #85677
pub(crate) enum TypeKind {
Void = 0,
Half = 1,
Float = 2,
Expand Down Expand Up @@ -378,7 +384,7 @@ impl AtomicRmwBinOp {
#[derive(Copy, Clone)]
#[repr(C)]
pub enum AtomicOrdering {
#[allow(dead_code)]
#[expect(dead_code)]
NotAtomic = 0,
Unordered = 1,
Monotonic = 2,
Expand Down Expand Up @@ -418,16 +424,24 @@ pub enum FileType {
#[derive(Copy, Clone)]
#[repr(C)]
pub enum MetadataType {
#[expect(dead_code)]
MD_dbg = 0,
#[expect(dead_code)]
MD_tbaa = 1,
#[expect(dead_code)]
MD_prof = 2,
#[expect(dead_code)]
MD_fpmath = 3,
MD_range = 4,
#[expect(dead_code)]
MD_tbaa_struct = 5,
MD_invariant_load = 6,
#[expect(dead_code)]
MD_alias_scope = 7,
#[expect(dead_code)]
MD_noalias = 8,
MD_nontemporal = 9,
#[expect(dead_code)]
MD_mem_parallel_loop_access = 10,
MD_nonnull = 11,
MD_align = 17,
Expand Down Expand Up @@ -524,7 +538,7 @@ pub enum CodeModel {
/// LLVMRustDiagnosticKind
#[derive(Copy, Clone)]
#[repr(C)]
#[allow(dead_code)] // Variants constructed by C++.
#[expect(dead_code)] // Variants constructed by C++.
pub enum DiagnosticKind {
Other,
InlineAsm,
Expand All @@ -547,7 +561,6 @@ pub enum DiagnosticKind {
/// LLVMRustDiagnosticLevel
#[derive(Copy, Clone)]
#[repr(C)]
#[allow(dead_code)] // Variants constructed by C++.
pub enum DiagnosticLevel {
Error,
Warning,
Expand Down Expand Up @@ -598,6 +611,7 @@ pub enum ThreadLocalMode {
/// LLVMRustTailCallKind
#[derive(Copy, Clone)]
#[repr(C)]
#[expect(dead_code)]
pub enum TailCallKind {
None,
Tail,
Expand Down Expand Up @@ -662,9 +676,6 @@ extern "C" {
pub struct Builder<'a>(InvariantOpaque<'a>);
#[repr(C)]
pub struct PassManager<'a>(InvariantOpaque<'a>);
extern "C" {
pub type Pass;
}
extern "C" {
pub type TargetMachine;
}
Expand Down Expand Up @@ -696,7 +707,6 @@ extern "C" {
}

pub type DiagnosticHandlerTy = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
pub type InlineAsmDiagHandlerTy = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);

pub mod debuginfo {
use super::{InvariantOpaque, Metadata};
Expand Down Expand Up @@ -804,6 +814,7 @@ pub mod debuginfo {
#[repr(C)]
pub enum DebugNameTableKind {
Default,
#[expect(dead_code)]
Gnu,
None,
}
Expand Down Expand Up @@ -1563,6 +1574,8 @@ extern "C" {
Name: *const c_char,
NameLen: size_t,
) -> Option<&Value>;

#[expect(dead_code)]
pub fn LLVMRustSetTailCallKind(CallInst: &Value, TKC: TailCallKind);

// Operations on attributes
Expand Down
12 changes: 4 additions & 8 deletions compiler/rustc_codegen_llvm/src/llvm/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#![allow(non_snake_case)]

pub use self::AtomicRmwBinOp::*;
pub use self::CallConv::*;
pub use self::CodeGenOptSize::*;
pub use self::IntPredicate::*;
pub use self::Linkage::*;
pub use self::MetadataType::*;
pub use self::RealPredicate::*;
pub(crate) use self::CallConv::*;
pub(crate) use self::CodeGenOptSize::*;
pub(crate) use self::MetadataType::*;

use libc::c_uint;
use rustc_data_structures::small_c_str::SmallCStr;
Expand All @@ -21,7 +17,7 @@ pub mod archive_ro;
pub mod diagnostic;
mod ffi;

pub use self::ffi::*;
pub(crate) use self::ffi::*;

impl LLVMRustResult {
pub fn into_result(self) -> Result<(), ()> {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/type_.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub use crate::llvm::Type;
pub(crate) use crate::llvm::Type;

use crate::abi::{FnAbiLlvmExt, LlvmType};
use crate::common;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/value.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub use crate::llvm::Value;
pub(crate) use crate::llvm::Value;

use crate::llvm;

Expand Down
Loading