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

regresion: parsing failure in derive expansion? #115775

Closed
Mark-Simulacrum opened this issue Sep 12, 2023 · 7 comments
Closed

regresion: parsing failure in derive expansion? #115775

Mark-Simulacrum opened this issue Sep 12, 2023 · 7 comments
Labels
A-proc-macros Area: Procedural macros regression-from-stable-to-beta Performance or correctness regression from stable to beta. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@Mark-Simulacrum
Copy link
Member

[INFO] [stdout] error: expected one of: `for`, parentheses, `fn`, `unsafe`, `extern`, identifier, `::`, `<`, square brackets, `*`, `&`, `!`, `impl`, `_`, lifetime
[INFO] [stdout]  --> tests/happy.rs:9:13
[INFO] [stdout]   |
[INFO] [stdout] 9 |     thing: &'static str,
[INFO] [stdout]   |             ^^^^^^^
[INFO] [stdout] 
[INFO] [stdout] 
[INFO] [stdout] error: expected one of `>`, a const expression, lifetime, or type, found `'`
[INFO] [stdout]  --> examples/simple.rs:3:17
[INFO] [stdout]   |
[INFO] [stdout] 3 | #[derive(Debug, Display)]
[INFO] [stdout]   |                 ^^^^^^^
[INFO] [stdout]   |                 |
[INFO] [stdout]   |                 expected one of `>`, a const expression, lifetime, or type
[INFO] [stdout]   |                 while parsing this item list starting here
[INFO] [stdout]   |                 the item list ends here
[INFO] [stdout]   |
[INFO] [stdout]   = note: this error originates in the derive macro `Display` (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stdout] 
[INFO] [stdout] 
[INFO] [stdout] error: aborting due to previous error

https://crater-reports.s3.amazonaws.com/beta-1.73-1.2/beta-2023-09-10/reg/displaydoc-watt-0.1.0/log.txt

@Mark-Simulacrum Mark-Simulacrum added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Sep 12, 2023
@Mark-Simulacrum Mark-Simulacrum added this to the 1.73.0 milestone Sep 12, 2023
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Sep 12, 2023
@Mark-Simulacrum
Copy link
Member Author

Possibly related (if not, let's file a new issue for it):

@Mark-Simulacrum Mark-Simulacrum removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 12, 2023
@lukas-code
Copy link
Member

lukas-code commented Sep 12, 2023

Regression in #114617, where the order of the variants of proc_macro::Spacing got changed.

MCVE: (playground)

extern crate proc_macro;

fn main() {
    assert_eq!(proc_macro::Spacing::Alone as u8, 0);
}

The watt crate is relying on the discriminant values for serialization here:

https://github.com/dtolnay/watt/blob/8dc8981c6c5c2a3e0ff6c9ec3830133538c78870/src/encode.rs#L108-L112

https://github.com/dtolnay/watt/blob/8dc8981c6c5c2a3e0ff6c9ec3830133538c78870/src/decode.rs#L117-L124

@rustbot label -E-needs-bisection -E-needs-mcve +S-has-mcve +A-proc-macros

@rustbot rustbot added A-proc-macros Area: Procedural macros S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Sep 12, 2023
@apiraino
Copy link
Contributor

apiraino commented Sep 13, 2023

Just to understand the context: will this be considered a breaking change (in some form)? If yes, is something users should be aware of in the release notes?

@Mark-Simulacrum
Copy link
Member Author

I think flipping the order wasn't necessary for rustc, so we should probably undo that and backport.

Cc @dtolnay as well since you might want to stop depending on this unstable (imo) detail

@dtolnay
Copy link
Member

dtolnay commented Sep 13, 2023

Yeah this is a watt bug. I don't think the rustc change needs to be reverted.

@dtolnay
Copy link
Member

dtolnay commented Sep 13, 2023

I published fixes in watt 0.3.1 and 0.4.6.

@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Sep 13, 2023
@Mark-Simulacrum
Copy link
Member Author

Closing since the watt fixes are out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-proc-macros Area: Procedural macros regression-from-stable-to-beta Performance or correctness regression from stable to beta. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants