Make it harder to call by accident

This commit is contained in:
Gwilym Kuiper 2022-01-16 21:50:18 +00:00
parent 040ff2eb0c
commit 6d8d72077f
2 changed files with 3 additions and 9 deletions

View file

@ -77,7 +77,7 @@ pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream {
#[export_name = "main"] #[export_name = "main"]
#(#attrs)* #(#attrs)*
pub fn #fn_name() -> ! { pub fn #fn_name() -> ! {
let #mutable #argument_name = #argument_type ::new(); let #mutable #argument_name = unsafe { #argument_type ::new_in_entry() };
#(#stmts)* #(#stmts)*
} }

View file

@ -210,8 +210,8 @@ pub struct Gba {
impl Gba { impl Gba {
#[doc(hidden)] #[doc(hidden)]
pub fn new() -> Self { pub unsafe fn new_in_entry() -> Self {
unsafe { GBASINGLE.take() } GBASINGLE.take()
} }
const unsafe fn single_new() -> Self { const unsafe fn single_new() -> Self {
@ -224,12 +224,6 @@ impl Gba {
} }
} }
impl Default for Gba {
fn default() -> Self {
Self::new()
}
}
#[doc(hidden)] #[doc(hidden)]
pub trait Testable { pub trait Testable {
fn run(&self, gba: &mut Gba); fn run(&self, gba: &mut Gba);