diff --git a/agb-macros/src/lib.rs b/agb-macros/src/lib.rs index b20b52f7..486e8e9a 100644 --- a/agb-macros/src/lib.rs +++ b/agb-macros/src/lib.rs @@ -77,7 +77,7 @@ pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream { #[export_name = "main"] #(#attrs)* pub fn #fn_name() -> ! { - let #mutable #argument_name = #argument_type ::new(); + let #mutable #argument_name = unsafe { #argument_type ::new_in_entry() }; #(#stmts)* } diff --git a/agb/src/lib.rs b/agb/src/lib.rs index cdbc9959..f5cb0f62 100644 --- a/agb/src/lib.rs +++ b/agb/src/lib.rs @@ -210,8 +210,8 @@ pub struct Gba { impl Gba { #[doc(hidden)] - pub fn new() -> Self { - unsafe { GBASINGLE.take() } + pub unsafe fn new_in_entry() -> Self { + GBASINGLE.take() } const unsafe fn single_new() -> Self { @@ -224,12 +224,6 @@ impl Gba { } } -impl Default for Gba { - fn default() -> Self { - Self::new() - } -} - #[doc(hidden)] pub trait Testable { fn run(&self, gba: &mut Gba);