-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
regression: failed to parse proc-macro input #61470
Comments
This is due to 1.36 passing literals in macro input differently than previous releases, and the repo in the crater report pinning an old version of syn (September 2016) that does not parse the new syntax. |
Minimized: #!/bin/bash
cargo new repro
echo >>repro/Cargo.toml '
[lib]
proc-macro = true
'
echo >repro/src/lib.rs '
extern crate proc_macro;
use proc_macro::TokenStream;
#[proc_macro_derive(D)]
pub fn m(input: TokenStream) -> TokenStream {
assert_eq!(input.to_string(), "pub enum E { V = 0, }");
TokenStream::new()
}
'
echo >repro/src/main.rs '
#[derive(repro::D)]
pub enum E { V = 0x0 }
fn main() {}
'
set -x
cargo +stable check --manifest-path repro/Cargo.toml
cargo +beta check --manifest-path repro/Cargo.toml Created binary (application) `repro` package
+ cargo +stable check --manifest-path repro/Cargo.toml
Compiling repro v0.1.0 (/git/repro/repro)
Finished dev [unoptimized + debuginfo] target(s) in 0.44s
+ cargo +beta check --manifest-path repro/Cargo.toml
Compiling repro v0.1.0 (/git/repro/repro)
error: proc-macro derive panicked
--> src/main.rs:2:10
|
2 | #[derive(repro::D)]
| ^^^^^^^^
|
= help: message: assertion failed: `(left == right)`
left: `"pub enum E { V = 0x0, }"`,
right: `"pub enum E { V = 0, }"`
error: aborting due to previous error |
The change is expected and was introduced in #60679. Literals, for example hexadecimal literals like Proc macros should be ready to deal with hexadecimal literals because they could previously get them from tokens not going through "token -> AST -> token" conversion (e.g. from fn-like macros). |
triage: Based on @petrochenkov 's analysis above, and the fact that |
cc @dtolnay -- possibly related to syn?
root is termfest, cc @agatan
The text was updated successfully, but these errors were encountered: