Skip to content

Commit aa3009d

Browse files
committed
Reorder hir fn stuff.
In `Fn`, put `ident` next to `generics` as is common in many other types. In `print_fn`, make the argument order match the printing order.
1 parent f8887aa commit aa3009d

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
467467
ItemKind::Delegation(box delegation) => {
468468
let delegation_results = self.lower_delegation(delegation, id, false);
469469
hir::ItemKind::Fn {
470-
ident: delegation_results.ident,
471470
sig: delegation_results.sig,
471+
ident: delegation_results.ident,
472472
generics: delegation_results.generics,
473473
body: delegation_results.body_id,
474474
has_body: true,

compiler/rustc_hir/src/hir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4283,8 +4283,8 @@ pub enum ItemKind<'hir> {
42834283
Const(Ident, &'hir Generics<'hir>, &'hir Ty<'hir>, BodyId),
42844284
/// A function declaration.
42854285
Fn {
4286-
ident: Ident,
42874286
sig: FnSig<'hir>,
4287+
ident: Ident,
42884288
generics: &'hir Generics<'hir>,
42894289
body: BodyId,
42904290
/// Whether this function actually has a body.

compiler/rustc_hir_pretty/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,10 @@ impl<'a> State<'a> {
477477
hir::ForeignItemKind::Fn(sig, arg_idents, generics) => {
478478
let (cb, ib) = self.head("");
479479
self.print_fn(
480-
sig.decl,
481480
sig.header,
482481
Some(item.ident.name),
483482
generics,
483+
sig.decl,
484484
arg_idents,
485485
None,
486486
);
@@ -626,7 +626,7 @@ impl<'a> State<'a> {
626626
}
627627
hir::ItemKind::Fn { ident, sig, generics, body, .. } => {
628628
let (cb, ib) = self.head("");
629-
self.print_fn(sig.decl, sig.header, Some(ident.name), generics, &[], Some(body));
629+
self.print_fn(sig.header, Some(ident.name), generics, sig.decl, &[], Some(body));
630630
self.word(" ");
631631
self.end(ib);
632632
self.end(cb);
@@ -902,7 +902,7 @@ impl<'a> State<'a> {
902902
arg_idents: &[Option<Ident>],
903903
body_id: Option<hir::BodyId>,
904904
) {
905-
self.print_fn(m.decl, m.header, Some(ident.name), generics, arg_idents, body_id);
905+
self.print_fn(m.header, Some(ident.name), generics, m.decl, arg_idents, body_id);
906906
}
907907

908908
fn print_trait_item(&mut self, ti: &hir::TraitItem<'_>) {
@@ -2141,10 +2141,10 @@ impl<'a> State<'a> {
21412141

21422142
fn print_fn(
21432143
&mut self,
2144-
decl: &hir::FnDecl<'_>,
21452144
header: hir::FnHeader,
21462145
name: Option<Symbol>,
21472146
generics: &hir::Generics<'_>,
2147+
decl: &hir::FnDecl<'_>,
21482148
arg_idents: &[Option<Ident>],
21492149
body_id: Option<hir::BodyId>,
21502150
) {
@@ -2483,7 +2483,6 @@ impl<'a> State<'a> {
24832483
self.print_formal_generic_params(generic_params);
24842484
let generics = hir::Generics::empty();
24852485
self.print_fn(
2486-
decl,
24872486
hir::FnHeader {
24882487
safety: safety.into(),
24892488
abi,
@@ -2492,6 +2491,7 @@ impl<'a> State<'a> {
24922491
},
24932492
name,
24942493
generics,
2494+
decl,
24952495
arg_idents,
24962496
None,
24972497
);

0 commit comments

Comments
 (0)