-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-proc-macrosArea: Procedural macrosArea: Procedural macrosC-bugCategory: This is a bug.Category: This is a bug.WG-macrosWorking group: MacrosWorking group: Macros
Description
...that's all I've got, tbh.
it's mentioned as a limitation but I have no idea why. I genuinely looked for an issue about this but couldn't find one? maybe my issue-finding-fu is just weakened by this late hour. this makes me feel obligated to open a bug.
Compiling pgrx-macros v0.12.0-alpha.1 (/home/jubilee/pgrx/pgrx-macros)
error: functions tagged with `#[proc_macro_attribute]` must currently reside in the root of the crate
--> pgrx-macros/src/operators.rs:20:1
|
20 | pub fn opname(_attr: TokenStream, item: TokenStream) -> TokenStream {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: could not compile `pgrx-macros` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `pgrx-macros` (lib) due to 1 previous error
why this?
I have a macro crate with 1200 lines in its lib.rs already! and it's only 1200 because half of the macros have poor-to-zero documentation!
Meta
rustc --version --verbose
:
rustc 1.77.2 (25ef9e3d8 2024-04-09)
binary: rustc
commit-hash: 25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04
commit-date: 2024-04-09
host: x86_64-unknown-linux-gnu
release: 1.77.2
LLVM version: 17.0.6
Metadata
Metadata
Assignees
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-proc-macrosArea: Procedural macrosArea: Procedural macrosC-bugCategory: This is a bug.Category: This is a bug.WG-macrosWorking group: MacrosWorking group: Macros
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
ChayimFriedman2 commentedon Apr 17, 2024
The usual workaround is to put only the macro declarations in lib.rs and the implementation in modules.
workingjubilee commentedon Apr 17, 2024
@ChayimFriedman2 I'm aware there are workarounds, of course! What I'm asking about is why I am forced to use this software architecture?