Skip to content

Commit

Permalink
Revert "Work around doc breakage in generate-link-to-definition mode"
Browse files Browse the repository at this point in the history
This reverts commit 7bfef4b.
  • Loading branch information
dtolnay committed Sep 25, 2023
1 parent 92fd50e commit 3876ae7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 47 deletions.
11 changes: 5 additions & 6 deletions src/ident.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ use crate::lookahead;
pub use proc_macro2::Ident;

#[cfg(feature = "parsing")]
pub_if_not_doc! {
#[doc(hidden)]
#[allow(non_snake_case)]
pub fn Ident(marker: lookahead::TokenMarker) -> Ident {
match marker {}
}
#[cfg(not(doc))] // Rustdoc bug: does not respect the doc(hidden)
#[doc(hidden)]
#[allow(non_snake_case)]
pub fn Ident(marker: lookahead::TokenMarker) -> Ident {
match marker {}
}

macro_rules! ident_from_token {
Expand Down
11 changes: 5 additions & 6 deletions src/lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,11 @@ impl Hash for Lifetime {
}

#[cfg(feature = "parsing")]
pub_if_not_doc! {
#[doc(hidden)]
#[allow(non_snake_case)]
pub fn Lifetime(marker: lookahead::TokenMarker) -> Lifetime {
match marker {}
}
#[cfg(not(doc))] // Rustdoc bug: does not respect the doc(hidden)
#[doc(hidden)]
#[allow(non_snake_case)]
pub fn Lifetime(marker: lookahead::TokenMarker) -> Lifetime {
match marker {}
}

#[cfg(feature = "parsing")]
Expand Down
33 changes: 15 additions & 18 deletions src/lit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,12 +758,11 @@ macro_rules! lit_extra_traits {
}

#[cfg(feature = "parsing")]
pub_if_not_doc! {
#[doc(hidden)]
#[allow(non_snake_case)]
pub fn $ty(marker: lookahead::TokenMarker) -> $ty {
match marker {}
}
#[cfg(not(doc))] // Rustdoc bug: does not respect the doc(hidden)
#[doc(hidden)]
#[allow(non_snake_case)]
pub fn $ty(marker: lookahead::TokenMarker) -> $ty {
match marker {}
}
};
}
Expand All @@ -776,12 +775,11 @@ lit_extra_traits!(LitInt);
lit_extra_traits!(LitFloat);

#[cfg(feature = "parsing")]
pub_if_not_doc! {
#[doc(hidden)]
#[allow(non_snake_case)]
pub fn LitBool(marker: lookahead::TokenMarker) -> LitBool {
match marker {}
}
#[cfg(not(doc))] // Rustdoc bug: does not respect the doc(hidden)
#[doc(hidden)]
#[allow(non_snake_case)]
pub fn LitBool(marker: lookahead::TokenMarker) -> LitBool {
match marker {}
}

ast_enum! {
Expand All @@ -798,12 +796,11 @@ ast_enum! {
}

#[cfg(feature = "parsing")]
pub_if_not_doc! {
#[doc(hidden)]
#[allow(non_snake_case)]
pub fn Lit(marker: lookahead::TokenMarker) -> Lit {
match marker {}
}
#[cfg(not(doc))] // Rustdoc bug: does not respect the doc(hidden)
#[doc(hidden)]
#[allow(non_snake_case)]
pub fn Lit(marker: lookahead::TokenMarker) -> Lit {
match marker {}
}

#[cfg(feature = "parsing")]
Expand Down
17 changes: 0 additions & 17 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,20 +166,3 @@ macro_rules! check_keyword_matches {
(enum enum) => {};
(pub pub) => {};
}

// Rustdoc bug: does not respect the doc(hidden) on some items.
#[cfg(all(doc, feature = "parsing"))]
macro_rules! pub_if_not_doc {
($(#[$m:meta])* pub $($item:tt)*) => {
$(#[$m])*
pub(crate) $($item)*
};
}

#[cfg(all(not(doc), feature = "parsing"))]
macro_rules! pub_if_not_doc {
($(#[$m:meta])* pub $($item:tt)*) => {
$(#[$m])*
pub $($item)*
};
}

0 comments on commit 3876ae7

Please sign in to comment.