-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
stable
release channel for RISC-V targets
- Loading branch information
1 parent
4ce9862
commit 1c5ce35
Showing
4 changed files
with
22 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,20 @@ | ||
#![no_std] | ||
|
||
/// Convert a `T` to a `&'static mut T`. | ||
/// | ||
/// The macro declares a `static StaticCell` and then initializes it when run, | ||
/// returning the `&'static mut`. Therefore, each instance can only be run once. | ||
/// Next runs will panic. The `static` can additionally be decorated with | ||
/// attributes, such as `#[link_section]`, `#[used]`, et al. | ||
#[macro_export] | ||
macro_rules! make_static { | ||
( $t:ty, $val:expr) => ($crate::make_static!($t, $val, )); | ||
( $t:ty, $val:expr, $(#[$m:meta])* ) => {{ | ||
$(#[$m])* | ||
static STATIC_CELL: ::static_cell::StaticCell<$t> = ::static_cell::StaticCell::new(); | ||
#[deny(unused_attributes)] | ||
let x = STATIC_CELL.uninit().write(($val)); | ||
|
||
x | ||
}}; | ||
} |