Skip to content

Commit

Permalink
Move parse_quote private internals to __private module
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 14, 2023
1 parent 9b6fa52 commit 3c292f7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/export.rs
Expand Up @@ -19,6 +19,9 @@ pub use crate::group::{parse_braces, parse_brackets, parse_parens};

pub use crate::span::IntoSpans;

#[cfg(all(feature = "parsing", feature = "printing"))]
pub use crate::parse_quote::parse as parse_quote;

#[cfg(feature = "parsing")]
pub use crate::token::parsing::{peek_punct, punct as parse_punct};

Expand Down
4 changes: 1 addition & 3 deletions src/lib.rs
Expand Up @@ -429,10 +429,8 @@ pub mod parse;
#[doc(hidden)]
pub mod parse_macro_input;

// Not public API except the `parse_quote!` macro.
#[cfg(all(feature = "parsing", feature = "printing"))]
#[doc(hidden)]
pub mod parse_quote;
mod parse_quote;

#[cfg(feature = "full")]
mod pat;
Expand Down
6 changes: 2 additions & 4 deletions src/parse_quote.rs
Expand Up @@ -68,7 +68,7 @@
#[macro_export]
macro_rules! parse_quote {
($($tt:tt)*) => {
$crate::parse_quote::parse($crate::__private::quote::quote!($($tt)*))
$crate::__private::parse_quote($crate::__private::quote::quote!($($tt)*))
};
}

Expand Down Expand Up @@ -100,7 +100,7 @@ macro_rules! parse_quote {
#[macro_export]
macro_rules! parse_quote_spanned {
($span:expr=> $($tt:tt)*) => {
$crate::parse_quote::parse($crate::__private::quote::quote_spanned!($span=> $($tt)*))
$crate::__private::parse_quote($crate::__private::quote::quote_spanned!($span=> $($tt)*))
};
}

Expand All @@ -120,8 +120,6 @@ pub fn parse<T: ParseQuote>(token_stream: TokenStream) -> T {
}
}

// Not public API.
#[doc(hidden)]
pub trait ParseQuote: Sized {
fn parse(input: ParseStream) -> Result<Self>;
}
Expand Down

0 comments on commit 3c292f7

Please sign in to comment.