Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Hygiene breaks add_one! macro #15

Closed
dtolnay opened this issue Dec 3, 2017 · 3 comments
Closed

Hygiene breaks add_one! macro #15

dtolnay opened this issue Dec 3, 2017 · 3 comments

Comments

@dtolnay
Copy link
Owner

dtolnay commented Dec 3, 2017

The add_one! example from the readme works with nightly-2017-12-02 but not nightly-2017-12-03.

   Compiling example v0.0.0
error[E0425]: cannot find value `x` in this scope
 --> src/main.rs:8:16
  |
8 |     let nine = add_one!(x) + add_one!(2 + 3);
  |                ^^^^^^^^^^^ not found in this scope
  |
@rushmorem
Copy link
Contributor

Is there a workaround for this?

@tcr
Copy link

tcr commented Apr 29, 2018

@rushmorem No workaround exists. As a result of rust-lang/rust#46478 it was decided that the fix for macro hygiene will stay, disallowing the use of local variables as macro input to proc-macro-hack.

As of 727987f add_one() in the README no longer references local variables anymore.

@dtolnay
Copy link
Owner Author

dtolnay commented Oct 31, 2018

Fixed in 0.5.0.

@dtolnay dtolnay closed this as completed Oct 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants