-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
$crate
-> $ident:ident
-> identity_proc_macro!($ident)
panics in the proc macro
#101211
Comments
Bisection shows it regressed in #92472 and got fixed in #98189. Looks like this issue wasn’t deliberately fixed, since #98189 doesn’t call out any issue being fixed. Also #92472 did involve minor breakage, as discussed in its thread, but I haven’t looked into it enough to tell whether those cases of breakage were similar to this issue or different. |
@rustbot label A-macros, A-proc-macros |
cc @petrochenkov (author of #92472) and @mystor (author of #98189) (read #101211 (comment) above to see how these PRs are relevant) |
Looking at the code changes from #92472 it makes sense that this regressed, as the call to In #98189, I changed the logic there to avoid going through that constructor when re-building the tokens internally, so we don't do the broken validation on that side anymore, and the problem wouldn't happen anymore. I don't think there's much more to be done here, as it's fixed already on beta, and isn't likely to regress with the new design. |
Thanks a lot for your insights! |
@rustbot label E-easy. (We only need a test to close this issue.) |
For someone wanting to add a test for this, you should be able to add the use code in You can see https://github.com/rust-lang/rust/blob/master/src/test/ui/proc-macro/dollar-crate-issue-62325.rs for an idea of what the test might look like. |
The bug is described in rust-lang/rust#101211 it affects Rust 1.61, 1.62, 1.63
The test check that the macros are correct, and ensure that they don't trigger rust-lang/rust#101211 Changed quasiconst docs to say that defaulted const parameters are supported.
@rustbot claim |
…llaumeGomez Rollup of 8 pull requests Successful merges: - rust-lang#100185 (Fix `ReErased` leaking into typeck due to `typeof(...)` recovery) - rust-lang#100291 (constify some `CStr` methods) - rust-lang#101677 (Add test for rust-lang#101211) - rust-lang#101723 (Impove diagnostic for `.await`ing non-futures) - rust-lang#101724 (Allow unauthenticated users to add the `const-hack` label) - rust-lang#101731 (rustdoc: improve rustdoc HTML suggestions handling of nested generics) - rust-lang#101732 (Feature gate the `rustdoc::missing_doc_code_examples` lint) - rust-lang#101735 (rustdoc: fix treatment of backslash-escaped HTML) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Code
I tried
cargo test
-ing this proc macro crate:I expected to see this happen: The test completes successfully
Instead, this happened:
The test fails compilation with this error:
Version it worked on
It most recently worked on:
Version with regression
rustc --version --verbose
:This also fails in 1.62 and 1.63.
Meta
This appears to be fixed in the beta channel, but I could not find a mention of this bug or a related one.
It's entirely possible that the bug will trigger again in future versions if this code isn't used in tests.
The text was updated successfully, but these errors were encountered: