From df24161cca46c4c138e8c4175d82c33ba178f354 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Mon, 20 Apr 2026 17:59:25 -0400 Subject: [PATCH] Ensure new type is `repr(transparent)` The immediately following code performs a cast from the new type to the old type, which `repr(transparent)` guarantees the safety of. I'm not convinced this is _guaranteed_ to be safe with the default `repr(Rust)`. --- src/ast.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ast.rs b/src/ast.rs index c64d698..907d0d6 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -911,6 +911,7 @@ where macro_rules! reference_newtype { ( $newtype_name:ident , $oldtype:ty ) => { #[derive(Debug)] + #[repr(transparent)] struct $newtype_name($oldtype); impl $newtype_name {