Rework precise capturing syntax
This commit is contained in:
parent
68bd001c00
commit
b1efe1ab5d
54 changed files with 406 additions and 350 deletions
|
@ -13,7 +13,7 @@ use rustc_ast_pretty::pprust::{Comments, PrintState};
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::{
|
||||
BindingMode, ByRef, GenericArg, GenericBound, GenericParam, GenericParamKind, HirId,
|
||||
LifetimeParamKind, Node, PatKind, RangeEnd, Term, TraitBoundModifier,
|
||||
LifetimeParamKind, Node, PatKind, PreciseCapturingArg, RangeEnd, Term, TraitBoundModifier,
|
||||
};
|
||||
use rustc_span::source_map::SourceMap;
|
||||
use rustc_span::symbol::{kw, Ident, Symbol};
|
||||
|
@ -2100,10 +2100,24 @@ impl<'a> State<'a> {
|
|||
GenericBound::Outlives(lt) => {
|
||||
self.print_lifetime(lt);
|
||||
}
|
||||
GenericBound::Use(args, _) => {
|
||||
self.word("use <");
|
||||
|
||||
self.commasep(Inconsistent, args, |s, arg| s.print_precise_capturing_arg(*arg));
|
||||
|
||||
self.word(">");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn print_precise_capturing_arg(&mut self, arg: PreciseCapturingArg<'_>) {
|
||||
match arg {
|
||||
PreciseCapturingArg::Lifetime(lt) => self.print_lifetime(lt),
|
||||
PreciseCapturingArg::Param(arg) => self.print_ident(arg.ident),
|
||||
}
|
||||
}
|
||||
|
||||
fn print_generic_params(&mut self, generic_params: &[GenericParam<'_>]) {
|
||||
if !generic_params.is_empty() {
|
||||
self.word("<");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue