diff options
| author | David Tolnay <dtolnay@gmail.com> | 2021-12-23 12:31:37 -0800 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2021-12-28 12:56:55 -0800 |
| commit | ad29c177f463f1c4af5bc0dfc36d0bd262198067 (patch) | |
| tree | 2dc36e75e5ff9a6e6a420f5d3423035e1e001b72 | |
| parent | 83b15bfe1c15f325bc186ebfe3691b729ed59f2b (diff) | |
Print space after formal generic params in fn type
| -rw-r--r-- | compiler/rustc_ast_pretty/src/pprust/state.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_hir_pretty/src/lib.rs | 5 | ||||
| -rw-r--r-- | src/test/ui/macros/stringify.rs | 2 |
3 files changed, 3 insertions, 9 deletions
diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index 6c5b38bc4bb..7e71492a221 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -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 { diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index 2f5f158856f..334fa6f4e5c 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -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 }, diff --git a/src/test/ui/macros/stringify.rs b/src/test/ui/macros/stringify.rs index fcf6a9278d8..2a722202fef 100644 --- a/src/test/ui/macros/stringify.rs +++ b/src/test/ui/macros/stringify.rs @@ -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!(!), "!"); |
