aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ian McIntyre <ianpmcintyre@gmail.com> 2019-12-09 20:24:44 -0500
committerGravatar Ian McIntyre <ianpmcintyre@gmail.com> 2019-12-10 07:47:24 -0500
commit43d43bd5c84631fc183f42bc9651e0a076a06f65 (patch)
tree8b5247bb3ba7a7e7e8deb1575012fbf77dde0fe3
parentaf3ee92cb7f9b76a7ebe9a64aa15d5d2c39e377a (diff)
downloadcortex-m-43d43bd5c84631fc183f42bc9651e0a076a06f65.tar.gz
cortex-m-43d43bd5c84631fc183f42bc9651e0a076a06f65.tar.zst
cortex-m-43d43bd5c84631fc183f42bc9651e0a076a06f65.zip
Remove 'extern crate cortex_m_rt' from macros
See justification on 519d46a. Using 'extern crate cortex_m_rt' inside of the macros limits our ability to use the macros crate in other contexts. As long as another crate publicly exports an enumeration of `interrupt` and an enumeration of `exception`, the macros crate may be used in other cortex-m-rt-like systems.
-rw-r--r--cortex-m-rt/macros/src/lib.rs8
-rw-r--r--cortex-m-rt/src/lib.rs2
2 files changed, 4 insertions, 6 deletions
diff --git a/cortex-m-rt/macros/src/lib.rs b/cortex-m-rt/macros/src/lib.rs
index 543130c..a844305 100644
--- a/cortex-m-rt/macros/src/lib.rs
+++ b/cortex-m-rt/macros/src/lib.rs
@@ -173,7 +173,7 @@ pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream {
/// # Syntax
///
/// ```
-/// # use cortex_m_rt_macros::exception;
+/// # use cortex_m_rt::exception;
/// #[exception]
/// fn SysTick() {
/// // ..
@@ -449,10 +449,8 @@ pub fn exception(args: TokenStream, input: TokenStream) -> TokenStream {
}));
f.block.stmts = iter::once(
syn::parse2(quote! {{
- extern crate cortex_m_rt;
-
// check that this exception actually exists
- cortex_m_rt::Exception::#ident;
+ exception::#ident;
}})
.unwrap(),
)
@@ -619,8 +617,6 @@ pub fn interrupt(args: TokenStream, input: TokenStream) -> TokenStream {
}));
f.block.stmts = iter::once(
syn::parse2(quote! {{
- extern crate cortex_m_rt;
-
// Check that this interrupt actually exists
interrupt::#ident;
}})
diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs
index 85d9496..8bfdd69 100644
--- a/cortex-m-rt/src/lib.rs
+++ b/cortex-m-rt/src/lib.rs
@@ -599,6 +599,8 @@ pub enum Exception {
SysTick,
}
+pub use self::Exception as exception;
+
extern "C" {
fn NonMaskableInt();