diff options
author | 2019-11-21 22:25:28 +0100 | |
---|---|---|
committer | 2019-11-21 22:27:44 +0100 | |
commit | f6729db2e7004954606a020d8fb67a7589e679e5 (patch) | |
tree | 29f5ec6b053db3719296fdae1866a69094674a1d | |
parent | d5fce0daaef5c02ab18cd084611cf6f82351f79d (diff) | |
download | cortex-m-f6729db2e7004954606a020d8fb67a7589e679e5.tar.gz cortex-m-f6729db2e7004954606a020d8fb67a7589e679e5.tar.zst cortex-m-f6729db2e7004954606a020d8fb67a7589e679e5.zip |
Re-allow `&'static mut` resources for `#[entry]`
-rw-r--r-- | cortex-m-rt/macros/src/lib.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cortex-m-rt/macros/src/lib.rs b/cortex-m-rt/macros/src/lib.rs index 052b075..b6b0fe4 100644 --- a/cortex-m-rt/macros/src/lib.rs +++ b/cortex-m-rt/macros/src/lib.rs @@ -115,8 +115,13 @@ pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream { let ident = &statik.ident; let ty = &statik.ty; let attrs = &statik.attrs; - syn::parse::<FnArg>(quote!(#[allow(non_snake_case)] #(#attrs)* #ident: &mut #ty).into()) - .unwrap() + + // Note that we use an explicit `'static` lifetime for the entry point arguments. This makes + // it more flexible, and is sound here, since the entry will not be called again, ever. + syn::parse::<FnArg>( + quote!(#[allow(non_snake_case)] #(#attrs)* #ident: &'static mut #ty).into(), + ) + .unwrap() })); f.block.stmts = stmts; |