mbrobbel commented on issue #14796: URL: https://github.com/apache/datafusion/issues/14796#issuecomment-2672262000
> > I looked at this briefly, but couldn't make inner attributes work with a proc macro. > > HI [@mbrobbel](https://github.com/mbrobbel) do you mean proc macros cannot be applied on underlying objects? afaik it is a limited set of object proc macros can be applied on like structs, enums, etc My first attempt was to use a [function-like proc macro](https://doc.rust-lang.org/reference/procedural-macros.html#function-like-procedural-macros): ```rust #[proc_macro] pub fn doc_cfg(_input: TokenStream) -> TokenStream { quote! { #![doc( html_logo_url="https://raw.githubusercontent.com/apache/datafusion/19fe44cf2f30cbdd63d4a4f52c74055163c6cc38/docs/logos/standalone_logo/logo_original.svg", html_favicon_url="https://raw.githubusercontent.com/apache/datafusion/19fe44cf2f30cbdd63d4a4f52c74055163c6cc38/docs/logos/standalone_logo/logo_original.svg" )] #![cfg_attr(docsrs, feature(doc_auto_cfg))] } .into() } ``` This results in: ``` error: an inner attribute is not permitted in this context --> datafusion/core/src/lib.rs:19:1 | 19 | datafusion_macros::doc_cfg!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files = note: outer attributes, like `#[test]`, annotate the item following them = note: this error originates in the macro `datafusion_macros::doc_cfg` (in Nightly builds, run with -Z macro-backtrace for more info) For more information about this error, try `rustc --explain E0753`. ``` The other attempt was to use an [attribute macro](https://doc.rust-lang.org/reference/procedural-macros.html#attribute-macros), but I don't think attaching this attribute to the `lib.rs` `File` item is supported. Maybe we can use a normal `macro_rules`, but we would need another crate to export those. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org