comphead commented on code in PR #13684:
URL: https://github.com/apache/datafusion/pull/13684#discussion_r1874552141


##########
datafusion/macros/src/lib.rs:
##########
@@ -235,27 +248,23 @@ pub fn user_doc(args: TokenStream, input: TokenStream) -> 
TokenStream {
         }
     });
 
-    let lock_name: proc_macro2::TokenStream =
-        format!("{name}_DOCUMENTATION").parse().unwrap();
-
     let generated = quote! {
         #input
 
-        static #lock_name: OnceLock<Documentation> = OnceLock::new();
-
         impl #name {
-
-                fn doc(&self) -> Option<&Documentation> {
-                    Some(#lock_name.get_or_init(|| {
-                        Documentation::builder(DocSection { include: 
#doc_section_include, label: #doc_section_lbl, description: 
#doc_section_description },
+            fn doc(&self) -> Option<&datafusion_doc::Documentation> {
+                static DOCUMENTATION: 
std::sync::LazyLock<datafusion_doc::Documentation> =

Review Comment:
   thats interesting, I tried doing the same with `OnceLock`, to move it inside 
the `doc` method but it didn't work. Surprisingly it works with LazyLock



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to