File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,9 @@ use syn::{
90
90
/// interrupts are enabled and possibly pass its return value into the entry function, allowing
91
91
/// pre-interrupt initialization to be done.
92
92
///
93
+ /// Note that a function marked with the entry attribute is allowed to take no input parameters
94
+ /// even if `init` returns a value, due to implementation details.
95
+ ///
93
96
/// ## Examples
94
97
///
95
98
/// - Enable interrupts before entry
@@ -141,6 +144,12 @@ use syn::{
141
144
/// loop {}
142
145
/// }
143
146
/// ```
147
+ ///
148
+ /// ## Note
149
+ ///
150
+ /// The `CriticalSection`s passed into the entry and the pre-interrupt functions have their
151
+ /// lifetimes restrained to their respective functions. Attempting to pass the `CriticalSection`
152
+ /// outside its scope fails with a `borrowed value does not live long enough` error.
144
153
#[ proc_macro_attribute]
145
154
pub fn entry ( args : TokenStream , input : TokenStream ) -> TokenStream {
146
155
let interrupt_enable = if args. is_empty ( ) {
@@ -394,6 +403,12 @@ impl EntryInterruptEnable {
394
403
/// println!("{}", COUNT);
395
404
/// }
396
405
/// ```
406
+ ///
407
+ /// ## Note
408
+ ///
409
+ /// The `CriticalSection` passed into the interrupt function has its lifetime restrained to the
410
+ /// function scope. Attempting to pass the `CriticalSection` outside its scope fails with a
411
+ /// `borrowed value does not live long enough` error.
397
412
#[ proc_macro_attribute]
398
413
pub fn interrupt ( args : TokenStream , input : TokenStream ) -> TokenStream {
399
414
let f: ItemFn = syn:: parse ( input) . expect ( "`#[interrupt]` must be applied to a function" ) ;
Original file line number Diff line number Diff line change 208
208
//!
209
209
//! // expands into
210
210
//!
211
- //! #[export_name = "main" ]
212
- //! extern "C" fn randomly_generated_string () -> ! {
211
+ //! #[no_mangle ]
212
+ //! extern "C" fn main () -> ! {
213
213
//! /* user code */
214
214
//! }
215
215
//! ```
You can’t perform that action at this time.
0 commit comments