forked from sammhicks/face-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass
value_changed
to macro_rules!
macros
In Rust, variable identifiers in a `macro_rules!` body are resolved in the scope of tht body - they cannot see through to the caller's body. For example, the following code errors: `rust macro_rules! weird_ident { () => { my_ident; } } fn main() { let my_ident = 1; weird_ident!(); } ` However, due to a compiler bug (rust-lang/rust#43081), this kind of code current compiles when a procedural macro is invoked by a `macro_rules!` macro. Eventually, this will cause a compilation error. In the `color!` and `slider!` macro, you're currently writing an expression involving `value_changed`, and passing it to a procedural macro (`html!`). However, `value_changed` comes from the body of the caller of `color!`/`slider!`, so this code will stop compiling once the compiler bug is fixed. Fortunately, the identifier of `value_changed` can be passed into `color!` and `slider!`. This modified code will with the current version of Rust, as well as future version that causes the old code into an error. I also ran `cargo update` to bump the dependencies in your Cargo.lock. This will allow your crate to continue to compile when the compiler bug is fixed, as you are depending on some crates (e.g. `syn`) that have released updates to address the issue. Feel free to ask me about any questions you may have. For more details, see rust-lang/rust#72622
- Loading branch information
Showing
8 changed files
with
78 additions
and
78 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters