We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
&'static mut
#[entry]
1 parent d5fce0d commit f6729dbCopy full SHA for f6729db
cortex-m-rt/macros/src/lib.rs
@@ -115,8 +115,13 @@ pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream {
115
let ident = &statik.ident;
116
let ty = &statik.ty;
117
let attrs = &statik.attrs;
118
- syn::parse::<FnArg>(quote!(#[allow(non_snake_case)] #(#attrs)* #ident: &mut #ty).into())
119
- .unwrap()
+
+ // Note that we use an explicit `'static` lifetime for the entry point arguments. This makes
120
+ // it more flexible, and is sound here, since the entry will not be called again, ever.
121
+ syn::parse::<FnArg>(
122
+ quote!(#[allow(non_snake_case)] #(#attrs)* #ident: &'static mut #ty).into(),
123
+ )
124
+ .unwrap()
125
}));
126
f.block.stmts = stmts;
127
0 commit comments