-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: macro recompile trigger #1061
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome engineering, LGTM! Maybe we should open a related issue for removing this later. Doesn't seem like rust-lang/rust#99515 will land any time soon, though. :)
Made an issue here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Left an optional nit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool. Hacky, yes, but very cool 🤠
closes: #1060
The solution (until Rust has an official way of doing it) is to call
include_bytes
inside your macro. This is detected by the compiler and it will watch the path for changes.I've assigned it to a
const _: &[u8] = include_bytes!(...)
and it seems it gets optimized away.Couldn't find a trace of the JSON file in the resulting executable (even under debug build).
So we might have gotten away with a no-downsides hack.
Tested via a separate e2e suite. Didn't include it in the PR since it would require compiling the whole SDK twice during testing.
Checklist