-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
fix usage of autodiff
macro with inner functions
#138314
base: master
Are you sure you want to change the base?
Conversation
Thank you for looking into this! Yes, adding a test to avoid regressions would be great. |
@bors delegate=ZuseZ4 |
@ZuseZ4 , thank you for providing more insights into this! The pretty printer tests do indeed sound like a good place for this. Also I've got to express how cool and insightful the docs are -- this is really not something to be taken as granted :D However, while looking into this I noticed that both It makes sense to open a separate PR fixing these issues before continuing with the inner function test, right? |
Yes I agree, I think one reason why I ended up being a rustc developer rather than working on other projects is the documentation. I don't have a pc this weekend, but my batching PR contains fixes for those. You can cherry pick them if you want, or I'll make a PR for that on Monday. I had hoped to get it done for the weekend, but unfortunately ran out of time. |
Okidoki! Don't stress, I'll just rebase when the changes are in master. |
Autodiff cleanups Splitting out some cleanups to reduce the size of my batching PR and simplify `@haenoe` 's [PR](rust-lang#138314). r? `@oli-obk` Tracking: - rust-lang#124509
Autodiff cleanups Splitting out some cleanups to reduce the size of my batching PR and simplify ``@haenoe`` 's [PR](rust-lang#138314). r? ``@oli-obk`` Tracking: - rust-lang#124509
Autodiff cleanups Splitting out some cleanups to reduce the size of my batching PR and simplify ```@haenoe``` 's [PR](rust-lang#138314). r? ```@oli-obk``` Tracking: - rust-lang#124509
Autodiff cleanups Splitting out some cleanups to reduce the size of my batching PR and simplify ````@haenoe```` 's [PR](rust-lang#138314). r? ````@oli-obk```` Tracking: - rust-lang#124509
Rollup merge of rust-lang#138627 - EnzymeAD:autodiff-cleanups, r=oli-obk Autodiff cleanups Splitting out some cleanups to reduce the size of my batching PR and simplify ``@haenoe`` 's [PR](rust-lang#138314). r? ``@oli-obk`` Tracking: - rust-lang#124509
☔ The latest upstream changes (presumably #138791) made this pull request unmergeable. Please resolve the merge conflicts. |
5024ae1
to
35812e2
Compare
Hey @ZuseZ4 |
looks good, but I will check again later when I'm on my computer. For the test I would just add a second autodiff macro with an in any way different config to the same function/test, to verify that even after future refactors we don't add inline or autodiff attributes multiple time to the source functions. |
☔ The latest upstream changes (presumably #138933) made this pull request unmergeable. Please resolve the merge conflicts. |
This PR adds additional handling into the expansion step of the
std::autodiff
macro (incompiler/rustc_builtin_macros/src/autodiff.rs
), which allows the macro to be applied to inner functions.Previously, the compiler didn't allow this due to only handling
Annotatable::Item
andAnnotatable::AssocItem
and missing the handling ofAnnotatable::Stmt
. This resulted in the rather generic errorThis issue was originally reported here.
Quick question: would it make sense to add a ui test to ensure there is no regression on this?
This is my first contribution, so I'm extra grateful for any piece of feedback!! :D
r? @oli-obk
Tracking issue for autodiff: #124509