Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e33ed93

Browse files
borsgitbot
authored and
gitbot
committedMar 11, 2025
Auto merge of rust-lang#135959 - matthiaskrgr:rollup-0jenyfw, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#135366 (Enable `unreachable_pub` lint in `test` and `proc_macro` crates) - rust-lang#135638 (Make it possible to build GCC on CI) - rust-lang#135648 (support wasm inline assembly in `naked_asm!`) - rust-lang#135827 (CI: free disk with in-tree script instead of GitHub Action) - rust-lang#135855 (Only assert the `Parser` size on specific arches) - rust-lang#135878 (ci: use 8 core arm runner for dist-aarch64-linux) - rust-lang#135905 (Enable kernel sanitizers for aarch64-unknown-none-softfloat) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 49413a0 + 14692cb commit e33ed93

21 files changed

+88
-86
lines changed
 

‎proc_macro/src/bridge/closure.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::marker::PhantomData;
44

55
#[repr(C)]
6-
pub struct Closure<'a, A, R> {
6+
pub(super) struct Closure<'a, A, R> {
77
call: unsafe extern "C" fn(*mut Env, A) -> R,
88
env: *mut Env,
99
// Prevent Send and Sync impls. `!Send`/`!Sync` is the usual way of doing
@@ -26,7 +26,7 @@ impl<'a, A, R, F: FnMut(A) -> R> From<&'a mut F> for Closure<'a, A, R> {
2626
}
2727

2828
impl<'a, A, R> Closure<'a, A, R> {
29-
pub fn call(&mut self, arg: A) -> R {
29+
pub(super) fn call(&mut self, arg: A) -> R {
3030
unsafe { (self.call)(self.env, arg) }
3131
}
3232
}

‎proc_macro/src/bridge/fxhash.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::hash::{BuildHasherDefault, Hasher};
99
use std::ops::BitXor;
1010

1111
/// Type alias for a hashmap using the `fx` hash algorithm.
12-
pub type FxHashMap<K, V> = HashMap<K, V, BuildHasherDefault<FxHasher>>;
12+
pub(super) type FxHashMap<K, V> = HashMap<K, V, BuildHasherDefault<FxHasher>>;
1313

1414
/// A speedy hash algorithm for use within rustc. The hashmap in alloc by
1515
/// default uses SipHash which isn't quite as speedy as we want. In the compiler
@@ -23,7 +23,7 @@ pub type FxHashMap<K, V> = HashMap<K, V, BuildHasherDefault<FxHasher>>;
2323
/// similar or slightly worse than FNV, but the speed of the hash function
2424
/// itself is much higher because it works on up to 8 bytes at a time.
2525
#[derive(Default)]
26-
pub struct FxHasher {
26+
pub(super) struct FxHasher {
2727
hash: usize,
2828
}
2929

‎proc_macro/src/bridge/rpc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ macro_rules! rpc_encode_decode {
6767
mod tag {
6868
#[repr(u8)] enum Tag { $($variant),* }
6969

70-
$(pub const $variant: u8 = Tag::$variant as u8;)*
70+
$(pub(crate) const $variant: u8 = Tag::$variant as u8;)*
7171
}
7272

7373
match self {
@@ -89,7 +89,7 @@ macro_rules! rpc_encode_decode {
8989
mod tag {
9090
#[repr(u8)] enum Tag { $($variant),* }
9191

92-
$(pub const $variant: u8 = Tag::$variant as u8;)*
92+
$(pub(crate) const $variant: u8 = Tag::$variant as u8;)*
9393
}
9494

9595
match u8::decode(r, s) {

‎proc_macro/src/bridge/selfless_reify.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ macro_rules! define_reify_functions {
4444
fn $name:ident $(<$($param:ident),*>)?
4545
for $(extern $abi:tt)? fn($($arg:ident: $arg_ty:ty),*) -> $ret_ty:ty;
4646
)+) => {
47-
$(pub const fn $name<
47+
$(pub(super) const fn $name<
4848
$($($param,)*)?
4949
F: Fn($($arg_ty),*) -> $ret_ty + Copy
5050
>(f: F) -> $(extern $abi)? fn($($arg_ty),*) -> $ret_ty {

‎proc_macro/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#![allow(internal_features)]
3333
#![deny(ffi_unwind_calls)]
3434
#![warn(rustdoc::unescaped_backticks)]
35+
#![warn(unreachable_pub)]
3536

3637
#[unstable(feature = "proc_macro_internals", issue = "27812")]
3738
#[doc(hidden)]

‎test/src/cli.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl TestOpts {
4444
}
4545

4646
/// Result of parsing the options.
47-
pub type OptRes = Result<TestOpts, String>;
47+
pub(crate) type OptRes = Result<TestOpts, String>;
4848
/// Result of parsing the option part.
4949
type OptPartRes<T> = Result<T, String>;
5050

‎test/src/console.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use super::types::{NamePadding, TestDesc, TestDescAndFn};
2020
use super::{filter_tests, run_tests, term};
2121

2222
/// Generic wrapper over stdout.
23-
pub enum OutputLocation<T> {
23+
pub(crate) enum OutputLocation<T> {
2424
Pretty(Box<term::StdoutTerminal>),
2525
Raw(T),
2626
}
@@ -41,15 +41,15 @@ impl<T: Write> Write for OutputLocation<T> {
4141
}
4242
}
4343

44-
pub struct ConsoleTestDiscoveryState {
44+
pub(crate) struct ConsoleTestDiscoveryState {
4545
pub log_out: Option<File>,
4646
pub tests: usize,
4747
pub benchmarks: usize,
4848
pub ignored: usize,
4949
}
5050

5151
impl ConsoleTestDiscoveryState {
52-
pub fn new(opts: &TestOpts) -> io::Result<ConsoleTestDiscoveryState> {
52+
pub(crate) fn new(opts: &TestOpts) -> io::Result<ConsoleTestDiscoveryState> {
5353
let log_out = match opts.logfile {
5454
Some(ref path) => Some(File::create(path)?),
5555
None => None,
@@ -58,7 +58,7 @@ impl ConsoleTestDiscoveryState {
5858
Ok(ConsoleTestDiscoveryState { log_out, tests: 0, benchmarks: 0, ignored: 0 })
5959
}
6060

61-
pub fn write_log<F, S>(&mut self, msg: F) -> io::Result<()>
61+
pub(crate) fn write_log<F, S>(&mut self, msg: F) -> io::Result<()>
6262
where
6363
S: AsRef<str>,
6464
F: FnOnce() -> S,
@@ -74,7 +74,7 @@ impl ConsoleTestDiscoveryState {
7474
}
7575
}
7676

77-
pub struct ConsoleTestState {
77+
pub(crate) struct ConsoleTestState {
7878
pub log_out: Option<File>,
7979
pub total: usize,
8080
pub passed: usize,
@@ -92,7 +92,7 @@ pub struct ConsoleTestState {
9292
}
9393

9494
impl ConsoleTestState {
95-
pub fn new(opts: &TestOpts) -> io::Result<ConsoleTestState> {
95+
pub(crate) fn new(opts: &TestOpts) -> io::Result<ConsoleTestState> {
9696
let log_out = match opts.logfile {
9797
Some(ref path) => Some(File::create(path)?),
9898
None => None,
@@ -116,7 +116,7 @@ impl ConsoleTestState {
116116
})
117117
}
118118

119-
pub fn write_log<F, S>(&mut self, msg: F) -> io::Result<()>
119+
pub(crate) fn write_log<F, S>(&mut self, msg: F) -> io::Result<()>
120120
where
121121
S: AsRef<str>,
122122
F: FnOnce() -> S,
@@ -131,7 +131,7 @@ impl ConsoleTestState {
131131
}
132132
}
133133

134-
pub fn write_log_result(
134+
pub(crate) fn write_log_result(
135135
&mut self,
136136
test: &TestDesc,
137137
result: &TestResult,
@@ -170,7 +170,7 @@ impl ConsoleTestState {
170170
}
171171

172172
// List the tests to console, and optionally to logfile. Filters are honored.
173-
pub fn list_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Result<()> {
173+
pub(crate) fn list_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Result<()> {
174174
let output = match term::stdout() {
175175
None => OutputLocation::Raw(io::stdout().lock()),
176176
Some(t) => OutputLocation::Pretty(t),

‎test/src/formatters/json.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub(crate) struct JsonFormatter<T> {
1313
}
1414

1515
impl<T: Write> JsonFormatter<T> {
16-
pub fn new(out: OutputLocation<T>) -> Self {
16+
pub(crate) fn new(out: OutputLocation<T>) -> Self {
1717
Self { out }
1818
}
1919

‎test/src/formatters/junit.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ use crate::test_result::TestResult;
88
use crate::time;
99
use crate::types::{TestDesc, TestType};
1010

11-
pub struct JunitFormatter<T> {
11+
pub(crate) struct JunitFormatter<T> {
1212
out: OutputLocation<T>,
1313
results: Vec<(TestDesc, TestResult, Duration, Vec<u8>)>,
1414
}
1515

1616
impl<T: Write> JunitFormatter<T> {
17-
pub fn new(out: OutputLocation<T>) -> Self {
17+
pub(crate) fn new(out: OutputLocation<T>) -> Self {
1818
Self { out, results: Vec::new() }
1919
}
2020

‎test/src/formatters/pretty.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub(crate) struct PrettyFormatter<T> {
2020
}
2121

2222
impl<T: Write> PrettyFormatter<T> {
23-
pub fn new(
23+
pub(crate) fn new(
2424
out: OutputLocation<T>,
2525
use_color: bool,
2626
max_name_len: usize,
@@ -31,43 +31,43 @@ impl<T: Write> PrettyFormatter<T> {
3131
}
3232

3333
#[cfg(test)]
34-
pub fn output_location(&self) -> &OutputLocation<T> {
34+
pub(crate) fn output_location(&self) -> &OutputLocation<T> {
3535
&self.out
3636
}
3737

38-
pub fn write_ok(&mut self) -> io::Result<()> {
38+
pub(crate) fn write_ok(&mut self) -> io::Result<()> {
3939
self.write_short_result("ok", term::color::GREEN)
4040
}
4141

42-
pub fn write_failed(&mut self) -> io::Result<()> {
42+
pub(crate) fn write_failed(&mut self) -> io::Result<()> {
4343
self.write_short_result("FAILED", term::color::RED)
4444
}
4545

46-
pub fn write_ignored(&mut self, message: Option<&'static str>) -> io::Result<()> {
46+
pub(crate) fn write_ignored(&mut self, message: Option<&'static str>) -> io::Result<()> {
4747
if let Some(message) = message {
4848
self.write_short_result(&format!("ignored, {message}"), term::color::YELLOW)
4949
} else {
5050
self.write_short_result("ignored", term::color::YELLOW)
5151
}
5252
}
5353

54-
pub fn write_time_failed(&mut self) -> io::Result<()> {
54+
pub(crate) fn write_time_failed(&mut self) -> io::Result<()> {
5555
self.write_short_result("FAILED (time limit exceeded)", term::color::RED)
5656
}
5757

58-
pub fn write_bench(&mut self) -> io::Result<()> {
58+
pub(crate) fn write_bench(&mut self) -> io::Result<()> {
5959
self.write_pretty("bench", term::color::CYAN)
6060
}
6161

62-
pub fn write_short_result(
62+
pub(crate) fn write_short_result(
6363
&mut self,
6464
result: &str,
6565
color: term::color::Color,
6666
) -> io::Result<()> {
6767
self.write_pretty(result, color)
6868
}
6969

70-
pub fn write_pretty(&mut self, word: &str, color: term::color::Color) -> io::Result<()> {
70+
pub(crate) fn write_pretty(&mut self, word: &str, color: term::color::Color) -> io::Result<()> {
7171
match self.out {
7272
OutputLocation::Pretty(ref mut term) => {
7373
if self.use_color {
@@ -86,7 +86,7 @@ impl<T: Write> PrettyFormatter<T> {
8686
}
8787
}
8888

89-
pub fn write_plain<S: AsRef<str>>(&mut self, s: S) -> io::Result<()> {
89+
pub(crate) fn write_plain<S: AsRef<str>>(&mut self, s: S) -> io::Result<()> {
9090
let s = s.as_ref();
9191
self.out.write_all(s.as_bytes())?;
9292
self.out.flush()
@@ -154,15 +154,15 @@ impl<T: Write> PrettyFormatter<T> {
154154
Ok(())
155155
}
156156

157-
pub fn write_successes(&mut self, state: &ConsoleTestState) -> io::Result<()> {
157+
pub(crate) fn write_successes(&mut self, state: &ConsoleTestState) -> io::Result<()> {
158158
self.write_results(&state.not_failures, "successes")
159159
}
160160

161-
pub fn write_failures(&mut self, state: &ConsoleTestState) -> io::Result<()> {
161+
pub(crate) fn write_failures(&mut self, state: &ConsoleTestState) -> io::Result<()> {
162162
self.write_results(&state.failures, "failures")
163163
}
164164

165-
pub fn write_time_failures(&mut self, state: &ConsoleTestState) -> io::Result<()> {
165+
pub(crate) fn write_time_failures(&mut self, state: &ConsoleTestState) -> io::Result<()> {
166166
self.write_results(&state.time_failures, "failures (time limit exceeded)")
167167
}
168168

‎test/src/formatters/terse.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub(crate) struct TerseFormatter<T> {
2525
}
2626

2727
impl<T: Write> TerseFormatter<T> {
28-
pub fn new(
28+
pub(crate) fn new(
2929
out: OutputLocation<T>,
3030
use_color: bool,
3131
max_name_len: usize,
@@ -42,11 +42,11 @@ impl<T: Write> TerseFormatter<T> {
4242
}
4343
}
4444

45-
pub fn write_ok(&mut self) -> io::Result<()> {
45+
pub(crate) fn write_ok(&mut self) -> io::Result<()> {
4646
self.write_short_result(".", term::color::GREEN)
4747
}
4848

49-
pub fn write_failed(&mut self, name: &str) -> io::Result<()> {
49+
pub(crate) fn write_failed(&mut self, name: &str) -> io::Result<()> {
5050
// Put failed tests on their own line and include the test name, so that it's faster
5151
// to see which test failed without having to wait for them all to run.
5252

@@ -62,15 +62,15 @@ impl<T: Write> TerseFormatter<T> {
6262
self.write_plain("\n")
6363
}
6464

65-
pub fn write_ignored(&mut self) -> io::Result<()> {
65+
pub(crate) fn write_ignored(&mut self) -> io::Result<()> {
6666
self.write_short_result("i", term::color::YELLOW)
6767
}
6868

69-
pub fn write_bench(&mut self) -> io::Result<()> {
69+
pub(crate) fn write_bench(&mut self) -> io::Result<()> {
7070
self.write_pretty("bench", term::color::CYAN)
7171
}
7272

73-
pub fn write_short_result(
73+
pub(crate) fn write_short_result(
7474
&mut self,
7575
result: &str,
7676
color: term::color::Color,
@@ -95,7 +95,7 @@ impl<T: Write> TerseFormatter<T> {
9595
Ok(())
9696
}
9797

98-
pub fn write_pretty(&mut self, word: &str, color: term::color::Color) -> io::Result<()> {
98+
pub(crate) fn write_pretty(&mut self, word: &str, color: term::color::Color) -> io::Result<()> {
9999
match self.out {
100100
OutputLocation::Pretty(ref mut term) => {
101101
if self.use_color {
@@ -114,13 +114,13 @@ impl<T: Write> TerseFormatter<T> {
114114
}
115115
}
116116

117-
pub fn write_plain<S: AsRef<str>>(&mut self, s: S) -> io::Result<()> {
117+
pub(crate) fn write_plain<S: AsRef<str>>(&mut self, s: S) -> io::Result<()> {
118118
let s = s.as_ref();
119119
self.out.write_all(s.as_bytes())?;
120120
self.out.flush()
121121
}
122122

123-
pub fn write_outputs(&mut self, state: &ConsoleTestState) -> io::Result<()> {
123+
pub(crate) fn write_outputs(&mut self, state: &ConsoleTestState) -> io::Result<()> {
124124
self.write_plain("\nsuccesses:\n")?;
125125
let mut successes = Vec::new();
126126
let mut stdouts = String::new();
@@ -146,7 +146,7 @@ impl<T: Write> TerseFormatter<T> {
146146
Ok(())
147147
}
148148

149-
pub fn write_failures(&mut self, state: &ConsoleTestState) -> io::Result<()> {
149+
pub(crate) fn write_failures(&mut self, state: &ConsoleTestState) -> io::Result<()> {
150150
self.write_plain("\nfailures:\n")?;
151151
let mut failures = Vec::new();
152152
let mut fail_out = String::new();

‎test/src/helpers/concurrency.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use std::num::NonZero;
55
use std::{env, thread};
66

7-
pub fn get_concurrency() -> usize {
7+
pub(crate) fn get_concurrency() -> usize {
88
if let Ok(value) = env::var("RUST_TEST_THREADS") {
99
match value.parse::<NonZero<usize>>().ok() {
1010
Some(n) => n.get(),

‎test/src/helpers/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Module with common helpers not directly related to tests
22
//! but used in `libtest`.
33
4-
pub mod concurrency;
5-
pub mod metrics;
6-
pub mod shuffle;
4+
pub(crate) mod concurrency;
5+
pub(crate) mod metrics;
6+
pub(crate) mod shuffle;

‎test/src/helpers/shuffle.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::time::{SystemTime, UNIX_EPOCH};
44
use crate::cli::TestOpts;
55
use crate::types::{TestDescAndFn, TestId, TestName};
66

7-
pub fn get_shuffle_seed(opts: &TestOpts) -> Option<u64> {
7+
pub(crate) fn get_shuffle_seed(opts: &TestOpts) -> Option<u64> {
88
opts.shuffle_seed.or_else(|| {
99
if opts.shuffle {
1010
Some(
@@ -19,7 +19,7 @@ pub fn get_shuffle_seed(opts: &TestOpts) -> Option<u64> {
1919
})
2020
}
2121

22-
pub fn shuffle_tests(shuffle_seed: u64, tests: &mut [(TestId, TestDescAndFn)]) {
22+
pub(crate) fn shuffle_tests(shuffle_seed: u64, tests: &mut [(TestId, TestDescAndFn)]) {
2323
let test_names: Vec<&TestName> = tests.iter().map(|test| &test.1.desc.name).collect();
2424
let test_names_hash = calculate_hash(&test_names);
2525
let mut rng = Rng::new(shuffle_seed, test_names_hash);

‎test/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#![feature(thread_spawn_hook)]
2828
#![allow(internal_features)]
2929
#![warn(rustdoc::unescaped_backticks)]
30+
#![warn(unreachable_pub)]
3031

3132
pub use cli::TestOpts;
3233

There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.