This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
compiler/rustc_ast_pretty/src/pprust Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -627,6 +627,13 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
627627
628628 fn print_attr_item ( & mut self , item : & ast:: AttrItem , span : Span ) {
629629 self . ibox ( 0 ) ;
630+ match item. unsafety {
631+ ast:: Safety :: Unsafe ( _) => {
632+ self . word ( "unsafe" ) ;
633+ self . popen ( ) ;
634+ }
635+ ast:: Safety :: Default | ast:: Safety :: Safe ( _) => { }
636+ }
630637 match & item. args {
631638 AttrArgs :: Delimited ( DelimArgs { dspan : _, delim, tokens } ) => self . print_mac_common (
632639 Some ( MacHeader :: Path ( & item. path ) ) ,
@@ -655,6 +662,10 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
655662 self . word ( token_str) ;
656663 }
657664 }
665+ match item. unsafety {
666+ ast:: Safety :: Unsafe ( _) => self . pclose ( ) ,
667+ ast:: Safety :: Default | ast:: Safety :: Safe ( _) => { }
668+ }
658669 self . end ( ) ;
659670 }
660671
Original file line number Diff line number Diff line change 44#[no_mangle]
55extern "C" fn foo() {}
66
7- #[no_mangle]
7+ #[unsafe( no_mangle) ]
88extern "C" fn bar() {}
99
1010#[cfg_attr(FALSE, unsafe(no_mangle))]
You can’t perform that action at this time.
0 commit comments