Add warn(unreachable_pub)
to rustc_arena
.
This commit is contained in:
parent
194489473d
commit
f839309c74
2 changed files with 12 additions and 11 deletions
|
@ -25,6 +25,7 @@
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
#![feature(rustdoc_internals)]
|
#![feature(rustdoc_internals)]
|
||||||
#![feature(strict_provenance)]
|
#![feature(strict_provenance)]
|
||||||
|
#![warn(unreachable_pub)]
|
||||||
// tidy-alphabetical-end
|
// tidy-alphabetical-end
|
||||||
|
|
||||||
use std::alloc::Layout;
|
use std::alloc::Layout;
|
||||||
|
|
|
@ -32,7 +32,7 @@ impl<T> TypedArena<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_unused() {
|
fn test_unused() {
|
||||||
let arena: TypedArena<Point> = TypedArena::default();
|
let arena: TypedArena<Point> = TypedArena::default();
|
||||||
assert!(arena.chunks.borrow().is_empty());
|
assert!(arena.chunks.borrow().is_empty());
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ fn test_arena_alloc_nested() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_copy() {
|
fn test_copy() {
|
||||||
let arena = TypedArena::default();
|
let arena = TypedArena::default();
|
||||||
#[cfg(not(miri))]
|
#[cfg(not(miri))]
|
||||||
const N: usize = 100000;
|
const N: usize = 100000;
|
||||||
|
@ -87,13 +87,13 @@ pub fn test_copy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
pub fn bench_copy(b: &mut Bencher) {
|
fn bench_copy(b: &mut Bencher) {
|
||||||
let arena = TypedArena::default();
|
let arena = TypedArena::default();
|
||||||
b.iter(|| arena.alloc(Point { x: 1, y: 2, z: 3 }))
|
b.iter(|| arena.alloc(Point { x: 1, y: 2, z: 3 }))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
pub fn bench_copy_nonarena(b: &mut Bencher) {
|
fn bench_copy_nonarena(b: &mut Bencher) {
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
let _: Box<_> = Box::new(Point { x: 1, y: 2, z: 3 });
|
let _: Box<_> = Box::new(Point { x: 1, y: 2, z: 3 });
|
||||||
})
|
})
|
||||||
|
@ -106,7 +106,7 @@ struct Noncopy {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_noncopy() {
|
fn test_noncopy() {
|
||||||
let arena = TypedArena::default();
|
let arena = TypedArena::default();
|
||||||
#[cfg(not(miri))]
|
#[cfg(not(miri))]
|
||||||
const N: usize = 100000;
|
const N: usize = 100000;
|
||||||
|
@ -118,7 +118,7 @@ pub fn test_noncopy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_typed_arena_zero_sized() {
|
fn test_typed_arena_zero_sized() {
|
||||||
let arena = TypedArena::default();
|
let arena = TypedArena::default();
|
||||||
#[cfg(not(miri))]
|
#[cfg(not(miri))]
|
||||||
const N: usize = 100000;
|
const N: usize = 100000;
|
||||||
|
@ -130,7 +130,7 @@ pub fn test_typed_arena_zero_sized() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_typed_arena_clear() {
|
fn test_typed_arena_clear() {
|
||||||
let mut arena = TypedArena::default();
|
let mut arena = TypedArena::default();
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
arena.clear();
|
arena.clear();
|
||||||
|
@ -145,7 +145,7 @@ pub fn test_typed_arena_clear() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
pub fn bench_typed_arena_clear(b: &mut Bencher) {
|
fn bench_typed_arena_clear(b: &mut Bencher) {
|
||||||
let mut arena = TypedArena::default();
|
let mut arena = TypedArena::default();
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
arena.alloc(Point { x: 1, y: 2, z: 3 });
|
arena.alloc(Point { x: 1, y: 2, z: 3 });
|
||||||
|
@ -154,7 +154,7 @@ pub fn bench_typed_arena_clear(b: &mut Bencher) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
pub fn bench_typed_arena_clear_100(b: &mut Bencher) {
|
fn bench_typed_arena_clear_100(b: &mut Bencher) {
|
||||||
let mut arena = TypedArena::default();
|
let mut arena = TypedArena::default();
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
for _ in 0..100 {
|
for _ in 0..100 {
|
||||||
|
@ -230,7 +230,7 @@ fn test_typed_arena_drop_small_count() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
pub fn bench_noncopy(b: &mut Bencher) {
|
fn bench_noncopy(b: &mut Bencher) {
|
||||||
let arena = TypedArena::default();
|
let arena = TypedArena::default();
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
arena.alloc(Noncopy { string: "hello world".to_string(), array: vec![1, 2, 3, 4, 5] })
|
arena.alloc(Noncopy { string: "hello world".to_string(), array: vec![1, 2, 3, 4, 5] })
|
||||||
|
@ -238,7 +238,7 @@ pub fn bench_noncopy(b: &mut Bencher) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
pub fn bench_noncopy_nonarena(b: &mut Bencher) {
|
fn bench_noncopy_nonarena(b: &mut Bencher) {
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
let _: Box<_> =
|
let _: Box<_> =
|
||||||
Box::new(Noncopy { string: "hello world".to_string(), array: vec![1, 2, 3, 4, 5] });
|
Box::new(Noncopy { string: "hello world".to_string(), array: vec![1, 2, 3, 4, 5] });
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue