You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
v0.6.3 does not touch this code, v0.7.1 removes only the first instance of #[no_mangle]
The following is a reduced test case that silently (no compile error) broke the kernel. Original file here.
Input
#![crate_name = "sam4l"]#![crate_type = "rlib"]#![feature(asm,core_intrinsics,concat_idents,const_fn)]#![no_std]#[link_section=".vectors"]#[no_mangle]// Ensures that the symbol is kept until the final binary#[cfg_attr(rustfmt, rustfmt_skip)]pubstaticBASE_VECTORS:[unsafeexternfn();16] = [
_estack, reset_handler,/* NMI */ unhandled_interrupt,/* Hard Fault */ hard_fault_handler,];#[link_section=".vectors"]#[no_mangle]// Ensures that the symbol is kept until the final binarypubstaticIRQS:[unsafeextern"C"fn();80] = [generic_isr;80];#[no_mangle]#[cfg_attr(rustfmt, rustfmt_skip)]pubstaticINTERRUPT_TABLE:[Option<unsafeexternfn()>;80] = [/* HFLASHC */Option::Some(flashcalw::flash_handler),/* PDCA0 */Option::Some(dma::pdca0_handler),/* PDCA1 */Option::Some(dma::pdca1_handler),];
Output
#![crate_name = "sam4l"]#![crate_type = "rlib"]#![feature(asm,core_intrinsics,concat_idents,const_fn)]#![no_std]#[link_section=".vectors"]// Ensures that the symbol is kept until the final binary#[cfg_attr(rustfmt, rustfmt_skip)]pubstaticBASE_VECTORS:[unsafeexternfn();16] = [
_estack, reset_handler,/* NMI */ unhandled_interrupt,/* Hard Fault */ hard_fault_handler,];#[link_section=".vectors"]#[no_mangle]// Ensures that the symbol is kept until the final binarypubstaticIRQS:[unsafeextern"C"fn();80] = [generic_isr;80];#[no_mangle]#[cfg_attr(rustfmt, rustfmt_skip)]pubstaticINTERRUPT_TABLE:[Option<unsafeexternfn()>;80] = [/* HFLASHC */Option::Some(flashcalw::flash_handler),/* PDCA0 */Option::Some(dma::pdca0_handler),/* PDCA1 */Option::Some(dma::pdca1_handler),];
While the exact line #[no_mangle] // Ensures that the symbol is kept until the final binary appears twice, in the first case it is followed by #[cfg_attr(rustfmt, rustfmt_skip)]. Removing that cfg causes rustfmt to leave the no_mangle alone. Interestingly, the third case also has the skip cfg, but no comment after the no_mangle and is unaffected. Deleting the comment after the first no_mangle also fixes this issue.
The text was updated successfully, but these errors were encountered:
v0.6.3 does not touch this code, v0.7.1 removes only the first instance of
#[no_mangle]
The following is a reduced test case that silently (no compile error) broke the kernel. Original file here.
Input
Output
While the exact line
#[no_mangle] // Ensures that the symbol is kept until the final binary
appears twice, in the first case it is followed by#[cfg_attr(rustfmt, rustfmt_skip)]
. Removing that cfg causes rustfmt to leave the no_mangle alone. Interestingly, the third case also has the skip cfg, but no comment after the no_mangle and is unaffected. Deleting the comment after the first no_mangle also fixes this issue.The text was updated successfully, but these errors were encountered: