Make printing define_opaque less goofy
This commit is contained in:
parent
48994b1674
commit
2bf0c2df14
1 changed files with 19 additions and 7 deletions
|
@ -652,13 +652,7 @@ impl<'a> State<'a> {
|
||||||
) {
|
) {
|
||||||
let ast::Fn { defaultness, generics, sig, contract, body, define_opaque } = func;
|
let ast::Fn { defaultness, generics, sig, contract, body, define_opaque } = func;
|
||||||
|
|
||||||
if let Some(define_opaque) = define_opaque {
|
self.print_define_opaques(define_opaque);
|
||||||
for (_, path) in define_opaque {
|
|
||||||
self.word("define opaques from ");
|
|
||||||
self.print_path(path, false, 0);
|
|
||||||
self.word(",");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if body.is_some() {
|
if body.is_some() {
|
||||||
self.head("");
|
self.head("");
|
||||||
|
@ -678,6 +672,24 @@ impl<'a> State<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
fn print_contract(&mut self, contract: &ast::FnContract) {
|
||||||
if let Some(pred) = &contract.requires {
|
if let Some(pred) = &contract.requires {
|
||||||
self.word("rustc_requires");
|
self.word("rustc_requires");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue