-
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
Quote/splice discard syntactic context #15750
Comments
I think this is due to Unfortunately the only way around this for now is to never use |
@pnkfelix Is going to look into this a bit to see what our options are. |
(Oh, rereading the issue, I see my comment was essentially just rephrasing it...) |
But I think the one from rust-lang#15750 will be fine.
Different Identifiers and Names can have identical textual representations, but different internal representations, due to the macro hygiene machinery (syntax contexts and gensyms). This provides a way to see these internals by compiling with `--pretty expanded,hygiene`. This is useful for debugging & hacking on macros (e.g. diagnosing #15750 likely would've been faster with this functionality). E.g. ```rust #![feature(macro_rules)] // minimal junk #![no_std] macro_rules! foo { ($x: ident) => { y + $x } } fn bar() { foo!(x) } ``` ```rust #![feature(macro_rules)] // minimal junk #![no_std] fn bar /* 61#0 */() { y /* 60#2 */ + x /* 58#3 */ } ```
This breaks even hygienic references to the environment at the macro use site. This has broken my
match_token
macro now that hygiene forself
is enforced.I think the right solution would involve a general overhaul of quote/splice, which currently works by pretty-printing and re-parsing the code :/
Example to reproduce the bug:
plugin.rs
test.rs
Result:
The text was updated successfully, but these errors were encountered: