mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Make printing define_opaque less goofy
This commit is contained in:
@@ -652,13 +652,7 @@ fn print_fn_full(
|
||||
) {
|
||||
let ast::Fn { defaultness, generics, sig, contract, body, define_opaque } = func;
|
||||
|
||||
if let Some(define_opaque) = define_opaque {
|
||||
for (_, path) in define_opaque {
|
||||
self.word("define opaques from ");
|
||||
self.print_path(path, false, 0);
|
||||
self.word(",");
|
||||
}
|
||||
}
|
||||
self.print_define_opaques(define_opaque);
|
||||
|
||||
if body.is_some() {
|
||||
self.head("");
|
||||
@@ -678,6 +672,24 @@ fn print_fn_full(
|
||||
}
|
||||
}
|
||||
|
||||
fn print_define_opaques(
|
||||
&mut self,
|
||||
define_opaque: Option<&[(ast::NodeId, ast::Path)]>,
|
||||
) {
|
||||
if let Some(define_opaque) = define_opaque {
|
||||
self.word("#[define_opaque(");
|
||||
for (i, (_, path)) in define_opaque.iter().enumerate() {
|
||||
if i != 0 {
|
||||
self.word_space(",");
|
||||
}
|
||||
|
||||
self.print_path(path, false, 0);
|
||||
}
|
||||
self.word(")]");
|
||||
}
|
||||
self.hardbreak_if_not_bol();
|
||||
}
|
||||
|
||||
fn print_contract(&mut self, contract: &ast::FnContract) {
|
||||
if let Some(pred) = &contract.requires {
|
||||
self.word("rustc_requires");
|
||||
|
||||
Reference in New Issue
Block a user