mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Print unsafety of attribute in AST unpretty
This commit is contained in:
parent
f249fdd962
commit
f5b6f938ce
@ -627,6 +627,13 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
|
|||||||
|
|
||||||
fn print_attr_item(&mut self, item: &ast::AttrItem, span: Span) {
|
fn print_attr_item(&mut self, item: &ast::AttrItem, span: Span) {
|
||||||
self.ibox(0);
|
self.ibox(0);
|
||||||
|
match item.unsafety {
|
||||||
|
ast::Safety::Unsafe(_) => {
|
||||||
|
self.word("unsafe");
|
||||||
|
self.popen();
|
||||||
|
}
|
||||||
|
ast::Safety::Default | ast::Safety::Safe(_) => {}
|
||||||
|
}
|
||||||
match &item.args {
|
match &item.args {
|
||||||
AttrArgs::Delimited(DelimArgs { dspan: _, delim, tokens }) => self.print_mac_common(
|
AttrArgs::Delimited(DelimArgs { dspan: _, delim, tokens }) => self.print_mac_common(
|
||||||
Some(MacHeader::Path(&item.path)),
|
Some(MacHeader::Path(&item.path)),
|
||||||
@ -655,6 +662,10 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
|
|||||||
self.word(token_str);
|
self.word(token_str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
match item.unsafety {
|
||||||
|
ast::Safety::Unsafe(_) => self.pclose(),
|
||||||
|
ast::Safety::Default | ast::Safety::Safe(_) => {}
|
||||||
|
}
|
||||||
self.end();
|
self.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
extern "C" fn foo() {}
|
extern "C" fn foo() {}
|
||||||
|
|
||||||
#[no_mangle]
|
#[unsafe(no_mangle)]
|
||||||
extern "C" fn bar() {}
|
extern "C" fn bar() {}
|
||||||
|
|
||||||
#[cfg_attr(FALSE, unsafe(no_mangle))]
|
#[cfg_attr(FALSE, unsafe(no_mangle))]
|
||||||
|
Loading…
Reference in New Issue
Block a user