Skip to content

Commit 00c4ef0

Browse files
committed
rustc_codegen_llvm: Mark items as pub(crate) outside of the llvm module
1 parent a9e7b30 commit 00c4ef0

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

compiler/rustc_codegen_llvm/src/abi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ impl<'tcx> AbiBuilderMethods<'tcx> for Builder<'_, '_, 'tcx> {
657657
}
658658

659659
impl llvm::CallConv {
660-
pub fn from_conv(conv: Conv, arch: &str) -> Self {
660+
pub(crate) fn from_conv(conv: Conv, arch: &str) -> Self {
661661
match conv {
662662
Conv::C
663663
| Conv::Rust

compiler/rustc_codegen_llvm/src/back/lto.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ unsafe impl Send for ModuleBuffer {}
621621
unsafe impl Sync for ModuleBuffer {}
622622

623623
impl ModuleBuffer {
624-
pub fn new(m: &llvm::Module) -> ModuleBuffer {
624+
pub(crate) fn new(m: &llvm::Module) -> ModuleBuffer {
625625
ModuleBuffer(unsafe { llvm::LLVMRustModuleBufferCreate(m) })
626626
}
627627
}
@@ -663,7 +663,7 @@ unsafe impl Send for ThinBuffer {}
663663
unsafe impl Sync for ThinBuffer {}
664664

665665
impl ThinBuffer {
666-
pub fn new(m: &llvm::Module, is_thin: bool, emit_summary: bool) -> ThinBuffer {
666+
pub(crate) fn new(m: &llvm::Module, is_thin: bool, emit_summary: bool) -> ThinBuffer {
667667
unsafe {
668668
let buffer = llvm::LLVMRustThinLTOBufferCreate(m, is_thin, emit_summary);
669669
ThinBuffer(buffer)

compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub struct OwnedTargetMachine {
1717
}
1818

1919
impl OwnedTargetMachine {
20-
pub fn new(
20+
pub(crate) fn new(
2121
triple: &CStr,
2222
cpu: &CStr,
2323
features: &CStr,

compiler/rustc_codegen_llvm/src/lib.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use std::mem::ManuallyDrop;
2929
use back::owned_target_machine::OwnedTargetMachine;
3030
use back::write::{create_informational_target_machine, create_target_machine};
3131
use errors::{AutoDiffWithoutLTO, ParseTargetMachineConfig};
32-
pub use llvm_util::target_features_cfg;
32+
pub(crate) use llvm_util::target_features_cfg;
3333
use rustc_ast::expand::allocator::AllocatorKind;
3434
use rustc_ast::expand::autodiff_attrs::AutoDiffItem;
3535
use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};
@@ -71,9 +71,7 @@ mod debuginfo;
7171
mod declare;
7272
mod errors;
7373
mod intrinsic;
74-
// FIXME(Zalathar): Fix all the unreachable-pub warnings that would occur if
75-
// this isn't pub, then make it not pub.
76-
pub mod llvm;
74+
mod llvm;
7775
mod llvm_util;
7876
mod mono_item;
7977
mod type_;

compiler/rustc_codegen_llvm/src/llvm/mod.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#![allow(non_snake_case)]
2+
#![expect(dead_code)]
3+
#![expect(unreachable_pub)]
24

35
use std::ffi::{CStr, CString};
46
use std::ops::Deref;
@@ -10,18 +12,18 @@ use libc::c_uint;
1012
use rustc_abi::{Align, Size, WrappingRange};
1113
use rustc_llvm::RustString;
1214

13-
pub use self::CallConv::*;
14-
pub use self::CodeGenOptSize::*;
15-
pub use self::MetadataType::*;
16-
pub use self::ffi::*;
15+
pub(crate) use self::CallConv::*;
16+
pub(crate) use self::CodeGenOptSize::*;
17+
pub(crate) use self::MetadataType::*;
18+
pub(crate) use self::ffi::*;
1719
use crate::common::AsCCharPtr;
1820

19-
pub mod archive_ro;
20-
pub mod diagnostic;
21-
pub mod enzyme_ffi;
21+
pub(crate) mod archive_ro;
22+
pub(crate) mod diagnostic;
23+
pub(crate) mod enzyme_ffi;
2224
mod ffi;
2325

24-
pub use self::enzyme_ffi::*;
26+
pub(crate) use self::enzyme_ffi::*;
2527

2628
impl LLVMRustResult {
2729
pub fn into_result(self) -> Result<(), ()> {

compiler/rustc_codegen_llvm/src/llvm_util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
303303
/// Must express features in the way Rust understands them.
304304
///
305305
/// We do not have to worry about RUSTC_SPECIFIC_FEATURES here, those are handled outside codegen.
306-
pub fn target_features_cfg(sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
306+
pub(crate) fn target_features_cfg(sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
307307
let mut features: FxHashSet<Symbol> = Default::default();
308308

309309
// Add base features for the target.

compiler/rustc_codegen_llvm/src/type_.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,11 @@ impl<'ll, 'tcx> BaseTypeCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
237237

238238
impl Type {
239239
/// Creates an integer type with the given number of bits, e.g., i24
240-
pub fn ix_llcx(llcx: &llvm::Context, num_bits: u64) -> &Type {
240+
pub(crate) fn ix_llcx(llcx: &llvm::Context, num_bits: u64) -> &Type {
241241
unsafe { llvm::LLVMIntTypeInContext(llcx, num_bits as c_uint) }
242242
}
243243

244-
pub fn ptr_llcx(llcx: &llvm::Context) -> &Type {
244+
pub(crate) fn ptr_llcx(llcx: &llvm::Context) -> &Type {
245245
unsafe { llvm::LLVMPointerTypeInContext(llcx, AddressSpace::DATA.0) }
246246
}
247247
}

0 commit comments

Comments
 (0)