Skip to content

Commit da1627e

Browse files
Urgaugitbot
authored and
gitbot
committed
proc_macro: add #![warn(unreachable_pub)]
1 parent 3eb05f3 commit da1627e

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
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)]

0 commit comments

Comments
 (0)