Browse Source

add voltaile read inside of asset fn

Jonathan Kelley 1 week ago
parent
commit
d8fc65a204

+ 1 - 1
packages/manganis/manganis-core/src/asset.rs

@@ -120,7 +120,7 @@ impl Asset {
     #[doc(hidden)]
     /// This should only be called from the macro
     /// Create a new asset from the bundled form of the asset and the link section
-    pub const fn new(bundled: fn() -> &'static [u8]) -> Self {
+    pub const fn new(bundled: extern "Rust" fn() -> &'static [u8]) -> Self {
         Self { bundled }
     }
 

+ 3 - 3
packages/manganis/manganis-macro/src/asset.rs

@@ -120,9 +120,9 @@ impl ToTokens for AssetParser {
 
                 static __REFERENCE_TO_LINK_SECTION: &'static [u8] = &__LINK_SECTION;
 
-                manganis::Asset::new(
-                    || __REFERENCE_TO_LINK_SECTION
-                )
+
+
+                manganis::Asset::new(|| unsafe { std::ptr::read_volatile(&__REFERENCE_TO_LINK_SECTION) })
             }
         })
     }