Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serde version after 1.0.157 report unexpected token with svgbobdoc::transform! #2413

Closed
CurryPseudo opened this issue Mar 21, 2023 · 3 comments

Comments

@CurryPseudo
Copy link

Minimal example:

Cargo.toml:

[package]
name = "playground"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
serde = { version = "=1.0.157", features = ["derive"] }
svgbobdoc = "0.3.0"

lib.rs:

use serde::Serialize;

// This compiles ok
#[doc = svgbobdoc::transform!(
/// Foo
)]
pub struct Foo0;

// This compiles failed
#[doc = svgbobdoc::transform!(
/// Foo
)]
#[derive(Serialize)]
pub struct Foo1;
playground on  main [!] via 🦀 v1.68.0 took 3s
➜ : cargo build
   Compiling playground v0.1.0 (C:\Dev\playground)
error: unexpected token
  --> src\lib.rs:10:29
   |
10 | #[doc = svgbobdoc::transform!(
   |                             ^

error: could not compile `playground` due to previous error
@CurryPseudo CurryPseudo changed the title serde version after 1.0.157 report unepxected token with svgbobdoc::transform! serde version after 1.0.157 report unexpected token with svgbobdoc::transform! Mar 21, 2023
@oli-obk
Copy link
Member

oli-obk commented Mar 21, 2023

This is probably a syn issue. Can you try using an older serde version that still works for you, but updating the syn version with cargo update -p syn?

@CurryPseudo
Copy link
Author

With serde version 1.0.156, cargo update -p syn seems doing nothing.
Here is the diff in Cargo.lock while switching serde from 1.0.156 to 1.0.157:

--- a/Cargo.lock
+++ b/Cargo.lock
@@ -36,22 +36,22 @@ dependencies = [
 
 [[package]]
 name = "serde"
-version = "1.0.156"
+version = "1.0.157"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "314b5b092c0ade17c00142951e50ced110ec27cea304b1037c6969246c2469a4"
+checksum = "707de5fcf5df2b5788fca98dd7eab490bc2fd9b7ef1404defc462833b83f25ca"
 dependencies = [
  "serde_derive",
 ]
 
 [[package]]
 name = "serde_derive"
-version = "1.0.156"
+version = "1.0.157"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d7e29c4601e36bcec74a223228dce795f4cd3616341a4af93520ca1a837c087d"
+checksum = "78997f4555c22a7971214540c4a661291970619afd56de19f77e0de86296e1e5"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn",
+ "syn 2.0.4",
 ]
 
 [[package]]
@@ -63,7 +63,7 @@ dependencies = [
  "base64",
  "proc-macro2",
  "quote",
- "syn",
+ "syn 1.0.109",
  "unicode-width",
 ]
 
@@ -78,6 +78,17 @@ dependencies = [
  "unicode-ident",
 ]
 
+[[package]]
+name = "syn"
+version = "2.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2c622ae390c9302e214c31013517c2061ecb2699935882c60a9b37f82f8625ae"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
 [[package]]
 name = "unicode-ident"
 version = "1.0.8"

There is a new syn version added, but svgbobdoc is still using syn 1.0.109:

[[package]]
name = "svgbobdoc"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2c04b93fc15d79b39c63218f15e3fdffaa4c227830686e3b7c5f41244eb3e50"
dependencies = [
 "base64",
 "proc-macro2",
 "quote",
 "syn 1.0.109",
 "unicode-width",
]

@CurryPseudo
Copy link
Author

This appears on every derive macro which uses syn 2.0, for example thiserror:

use thiserror::Error;

// This compiles ok
#[doc = svgbobdoc::transform!(
/// Foo
)]
pub struct Foo0;

// This compiles failed
#[doc = svgbobdoc::transform!(
/// Foo
)]
#[derive(Error)]
pub struct Foo1;

Close now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants