361361//! reserved: usize,
362362//! }
363363//!
364- //! extern "C" {
364+ //! unsafe extern "C" {
365365//! fn Foo();
366366//! fn Bar();
367367//! }
368368//!
369- //! #[link_section = ".vector_table.interrupts"]
370- //! #[no_mangle]
369+ //! #[unsafe( link_section = ".vector_table.interrupts") ]
370+ //! #[unsafe( no_mangle) ]
371371//! pub static __INTERRUPTS: [Vector; 5] = [
372372//! // 0-1: Reserved
373373//! Vector { reserved: 0 },
440440//!
441441//! [`MaybeUninit`]: https://doc.rust-lang.org/core/mem/union.MaybeUninit.html
442442//!
443- //! ```no_run,edition2018
443+ //! ```no_run
444444//! # extern crate core;
445445//! use core::mem::MaybeUninit;
446446//!
447447//! const STACK_SIZE: usize = 8 * 1024;
448448//! const NTHREADS: usize = 4;
449449//!
450- //! #[link_section = ".uninit.STACKS"]
450+ //! #[unsafe( link_section = ".uninit.STACKS") ]
451451//! static mut STACKS: MaybeUninit<[[u8; STACK_SIZE]; NTHREADS]> = MaybeUninit::uninit();
452452//! ```
453453//!
483483//!
484484//! You can then use something like this to place a variable into this specific section of memory:
485485//!
486- //! ```no_run,edition2018
486+ //! ```no_run
487487//! # extern crate core;
488488//! # use core::mem::MaybeUninit;
489- //! #[link_section=".ccmram.BUFFERS"]
489+ //! #[unsafe( link_section=".ccmram.BUFFERS") ]
490490//! static mut BUF: MaybeUninit<[u8; 1024]> = MaybeUninit::uninit();
491491//! ```
492492//!
@@ -937,7 +937,7 @@ pub use macros::pre_init;
937937// two copies of cortex-m-rt together, linking will fail. We also declare a links key in
938938// Cargo.toml which is the more modern way to solve the same problem, but we have to keep
939939// __ONCE__ around to prevent linking with versions before the links key was added.
940- #[ export_name = "error: cortex-m-rt appears more than once in the dependency graph" ]
940+ #[ unsafe ( export_name = "error: cortex-m-rt appears more than once in the dependency graph" ) ]
941941#[ doc( hidden) ]
942942pub static __ONCE__: ( ) = ( ) ;
943943
@@ -1120,7 +1120,7 @@ impl fmt::Debug for ExceptionFrame {
11201120/// The returned pointer is guaranteed to be 4-byte aligned.
11211121#[ inline]
11221122pub fn heap_start ( ) -> * mut u32 {
1123- extern "C" {
1123+ unsafe extern "C" {
11241124 static mut __sheap: u32 ;
11251125 }
11261126
@@ -1132,27 +1132,27 @@ pub fn heap_start() -> *mut u32 {
11321132
11331133// Entry point is Reset.
11341134#[ doc( hidden) ]
1135- #[ cfg_attr( cortex_m, link_section = ".vector_table.reset_vector" ) ]
1136- #[ no_mangle]
1135+ #[ cfg_attr( cortex_m, unsafe ( link_section = ".vector_table.reset_vector" ) ) ]
1136+ #[ unsafe ( no_mangle) ]
11371137pub static __RESET_VECTOR: unsafe extern "C" fn ( ) -> ! = Reset ;
11381138
11391139#[ doc( hidden) ]
1140- #[ cfg_attr( cortex_m, link_section = ".HardFault.default" ) ]
1141- #[ no_mangle]
1140+ #[ cfg_attr( cortex_m, unsafe ( link_section = ".HardFault.default" ) ) ]
1141+ #[ unsafe ( no_mangle) ]
11421142pub unsafe extern "C" fn HardFault_ ( ) -> ! {
11431143 #[ allow( clippy:: empty_loop) ]
11441144 loop { }
11451145}
11461146
11471147#[ doc( hidden) ]
1148- #[ no_mangle]
1148+ #[ unsafe ( no_mangle) ]
11491149pub unsafe extern "C" fn DefaultHandler_ ( ) -> ! {
11501150 #[ allow( clippy:: empty_loop) ]
11511151 loop { }
11521152}
11531153
11541154#[ doc( hidden) ]
1155- #[ no_mangle]
1155+ #[ unsafe ( no_mangle) ]
11561156pub unsafe extern "C" fn DefaultPreInit ( ) { }
11571157
11581158/* Exceptions */
@@ -1187,7 +1187,7 @@ pub enum Exception {
11871187#[ doc( hidden) ]
11881188pub use self :: Exception as exception;
11891189
1190- extern "C" {
1190+ unsafe extern "C" {
11911191 fn Reset ( ) -> !;
11921192
11931193 fn NonMaskableInt ( ) ;
@@ -1224,8 +1224,8 @@ pub union Vector {
12241224}
12251225
12261226#[ doc( hidden) ]
1227- #[ cfg_attr( cortex_m, link_section = ".vector_table.exceptions" ) ]
1228- #[ no_mangle]
1227+ #[ cfg_attr( cortex_m, unsafe ( link_section = ".vector_table.exceptions" ) ) ]
1228+ #[ unsafe ( no_mangle) ]
12291229pub static __EXCEPTIONS: [ Vector ; 14 ] = [
12301230 // Exception 2: Non Maskable Interrupt.
12311231 Vector {
@@ -1284,10 +1284,10 @@ pub static __EXCEPTIONS: [Vector; 14] = [
12841284// to the default handler
12851285#[ cfg( all( any( not( feature = "device" ) , test) , not( armv6m) , not( armv8m_main) ) ) ]
12861286#[ doc( hidden) ]
1287- #[ cfg_attr( cortex_m, link_section = ".vector_table.interrupts" ) ]
1288- #[ no_mangle]
1287+ #[ cfg_attr( cortex_m, unsafe ( link_section = ".vector_table.interrupts" ) ) ]
1288+ #[ unsafe ( no_mangle) ]
12891289pub static __INTERRUPTS: [ unsafe extern "C" fn ( ) ; 240 ] = [ {
1290- extern "C" {
1290+ unsafe extern "C" {
12911291 fn DefaultHandler ( ) ;
12921292 }
12931293
@@ -1297,10 +1297,10 @@ pub static __INTERRUPTS: [unsafe extern "C" fn(); 240] = [{
12971297// ARMv8-M Mainline can have up to 480 device specific interrupts
12981298#[ cfg( all( not( feature = "device" ) , armv8m_main) ) ]
12991299#[ doc( hidden) ]
1300- #[ cfg_attr( cortex_m, link_section = ".vector_table.interrupts" ) ]
1301- #[ no_mangle]
1300+ #[ cfg_attr( cortex_m, unsafe ( link_section = ".vector_table.interrupts" ) ) ]
1301+ #[ unsafe ( no_mangle) ]
13021302pub static __INTERRUPTS: [ unsafe extern "C" fn ( ) ; 480 ] = [ {
1303- extern "C" {
1303+ unsafe extern "C" {
13041304 fn DefaultHandler ( ) ;
13051305 }
13061306
@@ -1310,10 +1310,10 @@ pub static __INTERRUPTS: [unsafe extern "C" fn(); 480] = [{
13101310// ARMv6-M can only have a maximum of 32 device specific interrupts
13111311#[ cfg( all( not( feature = "device" ) , armv6m) ) ]
13121312#[ doc( hidden) ]
1313- #[ link_section = ".vector_table.interrupts" ]
1314- #[ no_mangle]
1313+ #[ unsafe ( link_section = ".vector_table.interrupts" ) ]
1314+ #[ unsafe ( no_mangle) ]
13151315pub static __INTERRUPTS: [ unsafe extern "C" fn ( ) ; 32 ] = [ {
1316- extern "C" {
1316+ unsafe extern "C" {
13171317 fn DefaultHandler ( ) ;
13181318 }
13191319
0 commit comments