1
Fork 0

parse const closures

This commit is contained in:
Deadbeef 2022-12-20 16:15:55 +00:00
parent 56ee65aeb6
commit 4fb10c0ce4
16 changed files with 63 additions and 12 deletions

View file

@ -1464,6 +1464,7 @@ impl<'a> State<'a> {
}
hir::ExprKind::Closure(&hir::Closure {
binder,
constness,
capture_clause,
bound_generic_params,
fn_decl,
@ -1474,6 +1475,7 @@ impl<'a> State<'a> {
def_id: _,
}) => {
self.print_closure_binder(binder, bound_generic_params);
self.print_constness(constness);
self.print_capture_clause(capture_clause);
self.print_closure_params(fn_decl, body);
@ -2272,10 +2274,7 @@ impl<'a> State<'a> {
}
pub fn print_fn_header_info(&mut self, header: hir::FnHeader) {
match header.constness {
hir::Constness::NotConst => {}
hir::Constness::Const => self.word_nbsp("const"),
}
self.print_constness(header.constness);
match header.asyncness {
hir::IsAsync::NotAsync => {}
@ -2292,6 +2291,13 @@ impl<'a> State<'a> {
self.word("fn")
}
pub fn print_constness(&mut self, s: hir::Constness) {
match s {
hir::Constness::NotConst => {}
hir::Constness::Const => self.word_nbsp("const"),
}
}
pub fn print_unsafety(&mut self, s: hir::Unsafety) {
match s {
hir::Unsafety::Normal => {}