Skip to content

Commit 43d43bd

Browse files
committed
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.
1 parent af3ee92 commit 43d43bd

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream {
173173
/// # Syntax
174174
///
175175
/// ```
176-
/// # use cortex_m_rt_macros::exception;
176+
/// # use cortex_m_rt::exception;
177177
/// #[exception]
178178
/// fn SysTick() {
179179
/// // ..
@@ -449,10 +449,8 @@ pub fn exception(args: TokenStream, input: TokenStream) -> TokenStream {
449449
}));
450450
f.block.stmts = iter::once(
451451
syn::parse2(quote! {{
452-
extern crate cortex_m_rt;
453-
454452
// check that this exception actually exists
455-
cortex_m_rt::Exception::#ident;
453+
exception::#ident;
456454
}})
457455
.unwrap(),
458456
)
@@ -619,8 +617,6 @@ pub fn interrupt(args: TokenStream, input: TokenStream) -> TokenStream {
619617
}));
620618
f.block.stmts = iter::once(
621619
syn::parse2(quote! {{
622-
extern crate cortex_m_rt;
623-
624620
// Check that this interrupt actually exists
625621
interrupt::#ident;
626622
}})

cortex-m-rt/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,8 @@ pub enum Exception {
599599
SysTick,
600600
}
601601

602+
pub use self::Exception as exception;
603+
602604
extern "C" {
603605
fn NonMaskableInt();
604606

0 commit comments

Comments
 (0)