Skip to content

Commit

Permalink
Print space after formal generic params in fn type
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Dec 28, 2021
1 parent 83b15bf commit ad29c17
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
5 changes: 1 addition & 4 deletions compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2908,10 +2908,7 @@ impl<'a> State<'a> {
generic_params: &[ast::GenericParam],
) {
self.ibox(INDENT_UNIT);
if !generic_params.is_empty() {
self.word("for");
self.print_generic_params(generic_params);
}
self.print_formal_generic_params(generic_params);
let generics = ast::Generics {
params: Vec::new(),
where_clause: ast::WhereClause {
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_hir_pretty/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2327,10 +2327,7 @@ impl<'a> State<'a> {
arg_names: &[Ident],
) {
self.ibox(INDENT_UNIT);
if !generic_params.is_empty() {
self.word("for");
self.print_generic_params(generic_params);
}
self.print_formal_generic_params(generic_params);
let generics = hir::Generics {
params: &[],
where_clause: hir::WhereClause { predicates: &[], span: rustc_span::DUMMY_SP },
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/macros/stringify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ fn test_ty() {
assert_eq!(stringify_ty!(fn(x: u8)), "fn(x: u8)");
#[rustfmt::skip]
assert_eq!(stringify_ty!(for<> fn()), "fn()");
assert_eq!(stringify_ty!(for<'a> fn()), "for<'a>fn()"); // FIXME
assert_eq!(stringify_ty!(for<'a> fn()), "for<'a> fn()");

// TyKind::Never
assert_eq!(stringify_ty!(!), "!");
Expand Down

0 comments on commit ad29c17

Please sign in to comment.