Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ proc-macro = ["proc-macro2/proc-macro", "quote/proc-macro"]
test = ["syn-test-suite/all-features"]

[dependencies]
proc-macro2 = { version = "1.0.55", default-features = false }
quote = { version = "1.0.25", optional = true, default-features = false }
proc-macro2 = { version = "1.0.59", default-features = false }
quote = { version = "1.0.28", optional = true, default-features = false }
unicode-ident = "1"

[dev-dependencies]
Expand Down
10 changes: 2 additions & 8 deletions src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
// Syn, and caution should be used when editing it. The public-facing interface
// is 100% safe but the implementation is fragile internally.

#[cfg(all(
not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
feature = "proc-macro"
))]
#[cfg(feature = "proc-macro")]
use crate::proc_macro as pm;
use crate::Lifetime;
use proc_macro2::extra::DelimSpan;
Expand Down Expand Up @@ -60,10 +57,7 @@ impl TokenBuffer {

/// Creates a `TokenBuffer` containing all the tokens from the input
/// `proc_macro::TokenStream`.
#[cfg(all(
not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
feature = "proc-macro"
))]
#[cfg(feature = "proc-macro")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "proc-macro")))]
pub fn new(stream: pm::TokenStream) -> Self {
Self::new2(stream.into())
Expand Down
5 changes: 1 addition & 4 deletions src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ pub use crate::token::parsing::{peek_punct, punct as parse_punct};
#[cfg(feature = "printing")]
pub use crate::token::printing::punct as print_punct;

#[cfg(all(
not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
feature = "proc-macro"
))]
#[cfg(feature = "proc-macro")]
pub use proc_macro::TokenStream;

#[cfg(feature = "printing")]
Expand Down
17 changes: 3 additions & 14 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,7 @@
clippy::wildcard_imports,
)]

#[cfg(all(
not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
feature = "proc-macro"
))]
#[cfg(feature = "proc-macro")]
extern crate proc_macro;

#[macro_use]
Expand Down Expand Up @@ -422,11 +419,7 @@ pub use crate::op::{BinOp, UnOp};
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
pub mod parse;

#[cfg(all(
not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
feature = "parsing",
feature = "proc-macro"
))]
#[cfg(all(feature = "parsing", feature = "proc-macro"))]
mod parse_macro_input;

#[cfg(all(feature = "parsing", feature = "printing"))]
Expand Down Expand Up @@ -860,11 +853,7 @@ pub mod __private;
/// expanded.into()
/// }
/// ```
#[cfg(all(
not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
feature = "parsing",
feature = "proc-macro"
))]
#[cfg(all(feature = "parsing", feature = "proc-macro"))]
#[cfg_attr(doc_cfg, doc(cfg(all(feature = "parsing", feature = "proc-macro"))))]
pub fn parse<T: parse::Parse>(tokens: proc_macro::TokenStream) -> Result<T> {
parse::Parser::parse(T::parse, tokens)
Expand Down
10 changes: 2 additions & 8 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,7 @@ pub mod discouraged;
use crate::buffer::{Cursor, TokenBuffer};
use crate::error;
use crate::lookahead;
#[cfg(all(
not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
feature = "proc-macro"
))]
#[cfg(feature = "proc-macro")]
use crate::proc_macro;
use crate::punctuated::Punctuated;
use crate::token::Token;
Expand Down Expand Up @@ -1198,10 +1195,7 @@ pub trait Parser: Sized {
///
/// This function will check that the input is fully parsed. If there are
/// any unparsed tokens at the end of the stream, an error is returned.
#[cfg(all(
not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
feature = "proc-macro"
))]
#[cfg(feature = "proc-macro")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "proc-macro")))]
fn parse(self, tokens: proc_macro::TokenStream) -> Result<Self::Output> {
self.parse2(proc_macro2::TokenStream::from(tokens))
Expand Down