Skip to content

Commit a0791d2

Browse files
committed
Add warn(unreachable_pub) to rustc_target.
1 parent 1c68b0a commit a0791d2

File tree

326 files changed

+345
-344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

326 files changed

+345
-344
lines changed

compiler/rustc_target/src/abi/call/aarch64.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::abi::{HasDataLayout, TyAbiInterface};
66
///
77
/// Corresponds to Clang's `AArch64ABIInfo::ABIKind`.
88
#[derive(Copy, Clone, PartialEq)]
9-
pub enum AbiKind {
9+
pub(crate) enum AbiKind {
1010
AAPCS,
1111
DarwinPCS,
1212
Win64,
@@ -109,7 +109,7 @@ where
109109
arg.make_indirect();
110110
}
111111

112-
pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, kind: AbiKind)
112+
pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, kind: AbiKind)
113113
where
114114
Ty: TyAbiInterface<'a, C> + Copy,
115115
C: HasDataLayout,

compiler/rustc_target/src/abi/call/amdgpu.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ where
1717
arg.extend_integer_width_to(32);
1818
}
1919

20-
pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
20+
pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
2121
where
2222
Ty: TyAbiInterface<'a, C> + Copy,
2323
C: HasDataLayout,

compiler/rustc_target/src/abi/call/arm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ where
8181
arg.cast_to(Uniform::consecutive(if align <= 4 { Reg::i32() } else { Reg::i64() }, total));
8282
}
8383

84-
pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
84+
pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
8585
where
8686
Ty: TyAbiInterface<'a, C> + Copy,
8787
C: HasDataLayout + HasTargetSpec,

compiler/rustc_target/src/abi/call/avr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn classify_arg_ty<Ty>(arg: &mut ArgAbi<'_, Ty>) {
4444
}
4545
}
4646

47-
pub fn compute_abi_info<Ty>(fty: &mut FnAbi<'_, Ty>) {
47+
pub(crate) fn compute_abi_info<Ty>(fty: &mut FnAbi<'_, Ty>) {
4848
if !fty.ret.is_ignore() {
4949
classify_ret_ty(&mut fty.ret);
5050
}

compiler/rustc_target/src/abi/call/bpf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn classify_arg<Ty>(arg: &mut ArgAbi<'_, Ty>) {
1717
}
1818
}
1919

20-
pub fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
20+
pub(crate) fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
2121
if !fn_abi.ret.is_ignore() {
2222
classify_ret(&mut fn_abi.ret);
2323
}

compiler/rustc_target/src/abi/call/csky.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn classify_arg<Ty>(arg: &mut ArgAbi<'_, Ty>) {
4747
}
4848
}
4949

50-
pub fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
50+
pub(crate) fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
5151
if !fn_abi.ret.is_ignore() {
5252
classify_ret(&mut fn_abi.ret);
5353
}

compiler/rustc_target/src/abi/call/hexagon.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn classify_arg<Ty>(arg: &mut ArgAbi<'_, Ty>) {
1616
}
1717
}
1818

19-
pub fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
19+
pub(crate) fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
2020
if !fn_abi.ret.is_ignore() {
2121
classify_ret(&mut fn_abi.ret);
2222
}

compiler/rustc_target/src/abi/call/loongarch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ fn extend_integer_width<Ty>(arg: &mut ArgAbi<'_, Ty>, xlen: u64) {
325325
arg.extend_integer_width_to(xlen);
326326
}
327327

328-
pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
328+
pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
329329
where
330330
Ty: TyAbiInterface<'a, C> + Copy,
331331
C: HasDataLayout + HasTargetSpec,

compiler/rustc_target/src/abi/call/m68k.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn classify_arg<Ty>(arg: &mut ArgAbi<'_, Ty>) {
2020
}
2121
}
2222

23-
pub fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
23+
pub(crate) fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
2424
if !fn_abi.ret.is_ignore() {
2525
classify_ret(&mut fn_abi.ret);
2626
}

compiler/rustc_target/src/abi/call/mips.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ where
3535
*offset = offset.align_to(align) + size.align_to(align);
3636
}
3737

38-
pub fn compute_abi_info<Ty, C>(cx: &C, fn_abi: &mut FnAbi<'_, Ty>)
38+
pub(crate) fn compute_abi_info<Ty, C>(cx: &C, fn_abi: &mut FnAbi<'_, Ty>)
3939
where
4040
C: HasDataLayout,
4141
{

compiler/rustc_target/src/abi/call/mips64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ where
149149
});
150150
}
151151

152-
pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
152+
pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
153153
where
154154
Ty: TyAbiInterface<'a, C> + Copy,
155155
C: HasDataLayout,

compiler/rustc_target/src/abi/call/msp430.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn classify_arg<Ty>(arg: &mut ArgAbi<'_, Ty>) {
2525
}
2626
}
2727

28-
pub fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
28+
pub(crate) fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
2929
if !fn_abi.ret.is_ignore() {
3030
classify_ret(&mut fn_abi.ret);
3131
}

compiler/rustc_target/src/abi/call/nvptx64.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ where
7171
}
7272
}
7373

74-
pub fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
74+
pub(crate) fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
7575
if !fn_abi.ret.is_ignore() {
7676
classify_ret(&mut fn_abi.ret);
7777
}
@@ -84,7 +84,7 @@ pub fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
8484
}
8585
}
8686

87-
pub fn compute_ptx_kernel_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
87+
pub(crate) fn compute_ptx_kernel_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
8888
where
8989
Ty: TyAbiInterface<'a, C> + Copy,
9090
C: HasDataLayout,

compiler/rustc_target/src/abi/call/powerpc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn classify_arg<Ty>(cx: &impl HasTargetSpec, arg: &mut ArgAbi<'_, Ty>) {
2727
}
2828
}
2929

30-
pub fn compute_abi_info<Ty>(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'_, Ty>) {
30+
pub(crate) fn compute_abi_info<Ty>(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'_, Ty>) {
3131
if !fn_abi.ret.is_ignore() {
3232
classify_ret(&mut fn_abi.ret);
3333
}

compiler/rustc_target/src/abi/call/powerpc64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ where
8686
};
8787
}
8888

89-
pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
89+
pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
9090
where
9191
Ty: TyAbiInterface<'a, C> + Copy,
9292
C: HasDataLayout + HasTargetSpec,

compiler/rustc_target/src/abi/call/riscv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ fn extend_integer_width<Ty>(arg: &mut ArgAbi<'_, Ty>, xlen: u64) {
331331
arg.extend_integer_width_to(xlen);
332332
}
333333

334-
pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
334+
pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
335335
where
336336
Ty: TyAbiInterface<'a, C> + Copy,
337337
C: HasDataLayout + HasTargetSpec,

compiler/rustc_target/src/abi/call/s390x.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ where
5454
}
5555
}
5656

57-
pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
57+
pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
5858
where
5959
Ty: TyAbiInterface<'a, C> + Copy,
6060
C: HasDataLayout + HasTargetSpec,

compiler/rustc_target/src/abi/call/sparc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ where
3535
*offset = offset.align_to(align) + size.align_to(align);
3636
}
3737

38-
pub fn compute_abi_info<Ty, C>(cx: &C, fn_abi: &mut FnAbi<'_, Ty>)
38+
pub(crate) fn compute_abi_info<Ty, C>(cx: &C, fn_abi: &mut FnAbi<'_, Ty>)
3939
where
4040
C: HasDataLayout,
4141
{

compiler/rustc_target/src/abi/call/sparc64.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::abi::{self, HasDataLayout, Scalar, Size, TyAbiInterface, TyAndLayout}
77
use crate::spec::HasTargetSpec;
88

99
#[derive(Clone, Debug)]
10-
pub struct Sdata {
10+
struct Sdata {
1111
pub prefix: [Option<Reg>; 8],
1212
pub prefix_index: usize,
1313
pub last_offset: Size,
@@ -209,7 +209,7 @@ where
209209
arg.cast_to(Uniform::new(Reg::i64(), total));
210210
}
211211

212-
pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
212+
pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
213213
where
214214
Ty: TyAbiInterface<'a, C> + Copy,
215215
C: HasDataLayout + HasTargetSpec,

compiler/rustc_target/src/abi/call/wasm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ where
4545
}
4646

4747
/// The purpose of this ABI is to match the C ABI (aka clang) exactly.
48-
pub fn compute_c_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
48+
pub(crate) fn compute_c_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
4949
where
5050
Ty: TyAbiInterface<'a, C> + Copy,
5151
C: HasDataLayout,
@@ -69,7 +69,7 @@ where
6969
/// This ABI is *bad*! It uses `PassMode::Direct` for `abi::Aggregate` types, which leaks LLVM
7070
/// implementation details into the ABI. It's just hard to fix because ABIs are hard to change.
7171
/// Also see <https://github.com/rust-lang/rust/issues/115666>.
72-
pub fn compute_wasm_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
72+
pub(crate) fn compute_wasm_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
7373
if !fn_abi.ret.is_ignore() {
7474
classify_ret_wasm_abi(&mut fn_abi.ret);
7575
}

compiler/rustc_target/src/abi/call/x86.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ use crate::abi::{Abi, Align, HasDataLayout, TyAbiInterface, TyAndLayout};
33
use crate::spec::HasTargetSpec;
44

55
#[derive(PartialEq)]
6-
pub enum Flavor {
6+
pub(crate) enum Flavor {
77
General,
88
FastcallOrVectorcall,
99
}
1010

11-
pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, flavor: Flavor)
11+
pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, flavor: Flavor)
1212
where
1313
Ty: TyAbiInterface<'a, C> + Copy,
1414
C: HasDataLayout + HasTargetSpec,

compiler/rustc_target/src/abi/call/x86_64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ fn cast_target(cls: &[Option<Class>], size: Size) -> CastTarget {
170170
const MAX_INT_REGS: usize = 6; // RDI, RSI, RDX, RCX, R8, R9
171171
const MAX_SSE_REGS: usize = 8; // XMM0-7
172172

173-
pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
173+
pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
174174
where
175175
Ty: TyAbiInterface<'a, C> + Copy,
176176
C: HasDataLayout,

compiler/rustc_target/src/abi/call/x86_win64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::spec::HasTargetSpec;
44

55
// Win64 ABI: https://docs.microsoft.com/en-us/cpp/build/parameter-passing
66

7-
pub fn compute_abi_info<Ty>(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'_, Ty>) {
7+
pub(crate) fn compute_abi_info<Ty>(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'_, Ty>) {
88
let fixup = |a: &mut ArgAbi<'_, Ty>| {
99
match a.layout.abi {
1010
Abi::Uninhabited | Abi::Aggregate { sized: false } => {}

compiler/rustc_target/src/abi/call/xtensa.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ where
9696
}
9797
}
9898

99-
pub fn compute_abi_info<'a, Ty, C>(_cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
99+
pub(crate) fn compute_abi_info<'a, Ty, C>(_cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
100100
where
101101
Ty: TyAbiInterface<'a, C> + Copy,
102102
C: HasDataLayout + HasTargetSpec,

compiler/rustc_target/src/asm/aarch64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl AArch64InlineAsmRegClass {
7070
}
7171
}
7272

73-
pub fn target_reserves_x18(target: &Target) -> bool {
73+
pub(crate) fn target_reserves_x18(target: &Target) -> bool {
7474
target.os == "android" || target.os == "fuchsia" || target.is_like_osx || target.is_like_windows
7575
}
7676

compiler/rustc_target/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#![feature(let_chains)]
1818
#![feature(rustc_attrs)]
1919
#![feature(rustdoc_internals)]
20+
#![warn(unreachable_pub)]
2021
// tidy-alphabetical-end
2122

2223
use std::path::{Path, PathBuf};

compiler/rustc_target/src/spec/base/aix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::abi::Endian;
22
use crate::spec::{crt_objects, cvs, Cc, CodeModel, LinkOutputKind, LinkerFlavor, TargetOptions};
33

4-
pub fn opts() -> TargetOptions {
4+
pub(crate) fn opts() -> TargetOptions {
55
TargetOptions {
66
abi: "vec-extabi".into(),
77
code_model: Some(CodeModel::Small),

compiler/rustc_target/src/spec/base/android.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::spec::{base, SanitizerSet, TargetOptions, TlsModel};
22

3-
pub fn opts() -> TargetOptions {
3+
pub(crate) fn opts() -> TargetOptions {
44
let mut base = base::linux::opts();
55
base.os = "android".into();
66
base.is_like_android = true;

0 commit comments

Comments
 (0)