Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
entry/exception/interrupt: reachability restriction is 1.30-only
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
japaric committed Oct 26, 2018
1 parent 6f77afa commit 641950e
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ use proc_macro::TokenStream;

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

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

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

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

0 comments on commit 641950e

Please sign in to comment.