Skip to content

Commit 3d43614

Browse files
bors[bot]japaric
andcommitted
Merge #141
141: entry/exception/interrupt: reachability restriction is 1.30-only r=therealprof a=japaric Thanks to rust-lang/rust#54451, which will be available in 1.31, these attributes will work regardless of the visibility and reachability of the items. Co-authored-by: Jorge Aparicio <[email protected]>
2 parents c5d24f8 + 0f7ee4c commit 3d43614

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

cortex-m-rt/macros/src/lib.rs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ use proc_macro::TokenStream;
2222

2323
/// Attribute to declare the entry point of the program
2424
///
25-
/// **IMPORTANT**: This attribute must be used once in the dependency graph and must be used on a
26-
/// reachable item (i.e. there must be no private modules between the item and the root of the
27-
/// crate). If the item is in the root of the crate you'll be fine.
25+
/// **IMPORTANT**: This attribute must appear exactly *once* in the dependency graph. Also, if you
26+
/// are using Rust 1.30 the attribute must be used on a reachable item (i.e. there must be no
27+
/// private modules between the item and the root of the crate); if the item is in the root of the
28+
/// crate you'll be fine. This reachability restriction doesn't apply to Rust 1.31 and newer releases.
2829
///
2930
/// The specified function will be called by the reset handler *after* RAM has been initialized. In
3031
/// the case of the `thumbv7em-none-eabihf` target the FPU will also be enabled before the function
@@ -142,9 +143,10 @@ pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream {
142143

143144
/// Attribute to declare an exception handler
144145
///
145-
/// **IMPORTANT**: This attribute must be used on reachable items (i.e. there must be no private
146-
/// modules between the item and the root of the crate). If the item is in the root of the crate
147-
/// you'll be fine.
146+
/// **IMPORTANT**: If you are using Rust 1.30 this attribute must be used on reachable items (i.e.
147+
/// there must be no private modules between the item and the root of the crate); if the item is in
148+
/// the root of the crate you'll be fine. This reachability restriction doesn't apply to Rust 1.31
149+
/// and newer releases.
148150
///
149151
/// # Syntax
150152
///
@@ -436,9 +438,10 @@ pub fn exception(args: TokenStream, input: TokenStream) -> TokenStream {
436438

437439
/// Attribute to declare an interrupt (AKA device-specific exception) handler
438440
///
439-
/// **IMPORTANT**: This attribute must be used on reachable items (i.e. there must be no private
440-
/// modules between the item and the root of the crate). If the item is in the root of the crate
441-
/// you'll be fine.
441+
/// **IMPORTANT**: If you are using Rust 1.30 this attribute must be used on reachable items (i.e.
442+
/// there must be no private modules between the item and the root of the crate); if the item is in
443+
/// the root of the crate you'll be fine. This reachability restriction doesn't apply to Rust 1.31
444+
/// and newer releases.
442445
///
443446
/// **NOTE**: This attribute is exposed by `cortex-m-rt` only when the `device` feature is enabled.
444447
/// However, that export is not meant to be used directly -- using it will result in a compilation
@@ -575,9 +578,11 @@ pub fn interrupt(args: TokenStream, input: TokenStream) -> TokenStream {
575578

576579
/// Attribute to mark which function will be called at the beginning of the reset handler.
577580
///
578-
/// **IMPORTANT**: This attribute must be used once in the dependency graph and must be used on a
579-
/// reachable item (i.e. there must be no private modules between the item and the root of the
580-
/// crate). If the item is in the root of the crate you'll be fine.
581+
/// **IMPORTANT**: This attribute can appear at most *once* in the dependency graph. Also, if you
582+
/// are using Rust 1.30 the attribute must be used on a reachable item (i.e. there must be no
583+
/// private modules between the item and the root of the crate); if the item is in the root of the
584+
/// crate you'll be fine. This reachability restriction doesn't apply to Rust 1.31 and newer
585+
/// releases.
581586
///
582587
/// The function must have the signature of `unsafe fn()`.
583588
///

0 commit comments

Comments
 (0)