-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Module path attribute override with nested macros doesnt work #87681
Comments
I can confirm this doesn't work, and is a bit unfortunate it slipped through (I admit I didn't test it). From what I can tell, the extended I don't think there is any true support for eager expansion, so I don't think there is any existing support for something like this. At a bare minimum, the I think we should maybe update the release post, since it is misleading. |
@ehuss do you think adding support for this eager expansion is feasible / welcome? I'd be interested in hacking on it if it's not terribly difficult. I also really want this feature for another project I maintain. |
Unfortunately I think it might be difficult to support. |
cc @petrochenkov @jyn514 -- I would have expected this to work based on discussions when landing this feature, so I'm a little surprised that it doesn't. |
Internally "
+1 |
Note: It doesn't work at all, even if the macros aren't nested. For example There is also the issue #48250 which is pretty much the same as this. Also the
|
This works around the go to definition feature of rust-analyzer, which otherwise just goes to the `include!` line. When `#[path = concat!(env!(...), ...)]` works (issue rust-lang/rust#87681), we should switch to that.
Posted #88057 to update the RELEASES, thanks for catching that! |
…imulacrum Update RELEASES to clarify attribute macro values. As noted in rust-lang#87681, macros do not work with the `#[path]` attribute. Since the places where macros *can* be used is very limited, I have changed this to just focus on `#[doc]` which is the only attribute where this is really useful.
…imulacrum Update RELEASES to clarify attribute macro values. As noted in rust-lang#87681, macros do not work with the `#[path]` attribute. Since the places where macros *can* be used is very limited, I have changed this to just focus on `#[doc]` which is the only attribute where this is really useful.
Posted #88680 to add errors when attempting to use macros with |
…enkov Validate builtin attributes for macro args. This adds some validation for `path`, `crate_type`, and `recursion_limit` attributes so that they will now return an error if you attempt to pass a macro into them (such as `#[path = foo!()]`). Previously, the attribute would be completely ignored. These attributes are special because their values need to be known before/during expansion. cc rust-lang#87681
Rust 1.54 release notes should be updated to say that this doesn't work. It currently says |
Should we consider this issue resolved then? |
I think it should work, imo it's a bug that it doesn't. |
Current example error message for searchability:
|
I tried this code:
Repository with the reproduction
I expected to see this happen:
The code should compile without errors, because this feature was advertised in Rust 1.54 announcement and in #83366.
Instead, this happened:
Compile error
file not found for module generated
was issuedMore info in README.md of the reproduction repo
Meta
rustc --version --verbose
:cc @jyn514
The text was updated successfully, but these errors were encountered: