File tree 2 files changed +12
-1
lines changed
compiler/rustc_ast_pretty/src/pprust
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
627
627
628
628
fn print_attr_item ( & mut self , item : & ast:: AttrItem , span : Span ) {
629
629
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
+ }
630
637
match & item. args {
631
638
AttrArgs :: Delimited ( DelimArgs { dspan : _, delim, tokens } ) => self . print_mac_common (
632
639
Some ( MacHeader :: Path ( & item. path ) ) ,
@@ -655,6 +662,10 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
655
662
self . word ( token_str) ;
656
663
}
657
664
}
665
+ match item. unsafety {
666
+ ast:: Safety :: Unsafe ( _) => self . pclose ( ) ,
667
+ ast:: Safety :: Default | ast:: Safety :: Safe ( _) => { }
668
+ }
658
669
self . end ( ) ;
659
670
}
660
671
Original file line number Diff line number Diff line change 4
4
#[no_mangle]
5
5
extern "C" fn foo() {}
6
6
7
- #[no_mangle]
7
+ #[unsafe( no_mangle) ]
8
8
extern "C" fn bar() {}
9
9
10
10
#[cfg_attr(FALSE, unsafe(no_mangle))]
You can’t perform that action at this time.
0 commit comments