Skip to content

Commit 2f63394

Browse files
committed
Add deny(unreachable_pub) to rustc_arena.
1 parent ad96c2e commit 2f63394

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

compiler/rustc_arena/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#![feature(rustc_attrs)]
2222
#![cfg_attr(test, feature(test))]
2323
#![feature(strict_provenance)]
24+
#![deny(unreachable_pub)]
2425
#![deny(unsafe_op_in_unsafe_fn)]
2526
#![allow(internal_features)]
2627
#![allow(clippy::mut_from_ref)] // Arena allocators are one of the places where this pattern is fine.

compiler/rustc_arena/src/tests.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl<T> TypedArena<T> {
3030
}
3131

3232
#[test]
33-
pub fn test_unused() {
33+
fn test_unused() {
3434
let arena: TypedArena<Point> = TypedArena::default();
3535
assert!(arena.chunks.borrow().is_empty());
3636
}
@@ -73,7 +73,7 @@ fn test_arena_alloc_nested() {
7373
}
7474

7575
#[test]
76-
pub fn test_copy() {
76+
fn test_copy() {
7777
let arena = TypedArena::default();
7878
#[cfg(not(miri))]
7979
const N: usize = 100000;
@@ -85,13 +85,13 @@ pub fn test_copy() {
8585
}
8686

8787
#[bench]
88-
pub fn bench_copy(b: &mut Bencher) {
88+
fn bench_copy(b: &mut Bencher) {
8989
let arena = TypedArena::default();
9090
b.iter(|| arena.alloc(Point { x: 1, y: 2, z: 3 }))
9191
}
9292

9393
#[bench]
94-
pub fn bench_copy_nonarena(b: &mut Bencher) {
94+
fn bench_copy_nonarena(b: &mut Bencher) {
9595
b.iter(|| {
9696
let _: Box<_> = Box::new(Point { x: 1, y: 2, z: 3 });
9797
})
@@ -104,7 +104,7 @@ struct Noncopy {
104104
}
105105

106106
#[test]
107-
pub fn test_noncopy() {
107+
fn test_noncopy() {
108108
let arena = TypedArena::default();
109109
#[cfg(not(miri))]
110110
const N: usize = 100000;
@@ -116,7 +116,7 @@ pub fn test_noncopy() {
116116
}
117117

118118
#[test]
119-
pub fn test_typed_arena_zero_sized() {
119+
fn test_typed_arena_zero_sized() {
120120
let arena = TypedArena::default();
121121
#[cfg(not(miri))]
122122
const N: usize = 100000;
@@ -128,7 +128,7 @@ pub fn test_typed_arena_zero_sized() {
128128
}
129129

130130
#[test]
131-
pub fn test_typed_arena_clear() {
131+
fn test_typed_arena_clear() {
132132
let mut arena = TypedArena::default();
133133
for _ in 0..10 {
134134
arena.clear();
@@ -143,7 +143,7 @@ pub fn test_typed_arena_clear() {
143143
}
144144

145145
#[bench]
146-
pub fn bench_typed_arena_clear(b: &mut Bencher) {
146+
fn bench_typed_arena_clear(b: &mut Bencher) {
147147
let mut arena = TypedArena::default();
148148
b.iter(|| {
149149
arena.alloc(Point { x: 1, y: 2, z: 3 });
@@ -152,7 +152,7 @@ pub fn bench_typed_arena_clear(b: &mut Bencher) {
152152
}
153153

154154
#[bench]
155-
pub fn bench_typed_arena_clear_100(b: &mut Bencher) {
155+
fn bench_typed_arena_clear_100(b: &mut Bencher) {
156156
let mut arena = TypedArena::default();
157157
b.iter(|| {
158158
for _ in 0..100 {
@@ -228,15 +228,15 @@ fn test_typed_arena_drop_small_count() {
228228
}
229229

230230
#[bench]
231-
pub fn bench_noncopy(b: &mut Bencher) {
231+
fn bench_noncopy(b: &mut Bencher) {
232232
let arena = TypedArena::default();
233233
b.iter(|| {
234234
arena.alloc(Noncopy { string: "hello world".to_string(), array: vec![1, 2, 3, 4, 5] })
235235
})
236236
}
237237

238238
#[bench]
239-
pub fn bench_noncopy_nonarena(b: &mut Bencher) {
239+
fn bench_noncopy_nonarena(b: &mut Bencher) {
240240
b.iter(|| {
241241
let _: Box<_> =
242242
Box::new(Noncopy { string: "hello world".to_string(), array: vec![1, 2, 3, 4, 5] });

0 commit comments

Comments
 (0)