Commit 6f109d8
committed
Auto merge of #155223 - teor2345:fndef-refactor, r=mati865
Refactor FnDecl and FnSig non-type fields into a new wrapper type
#### Why this Refactor?
This PR is part of an initial cleanup for the [arg splat experiment](#153629), but it's a useful refactor by itself.
It refactors the non-type fields of `FnDecl`, `FnSig`, and `FnHeader` into a new packed wrapper types, based on this comment in the `splat` experiment PR:
#153697 (comment)
It also refactors some common `FnSig` creation settings into their own methods. I did this instead of creating a struct with defaults.
#### Relationship to `splat` Experiment
I don't think we can use functional struct updates (`..default()`) to create `FnDecl` and `FnSig`, because we need the bit-packing for the `splat` experiment.
Bit-packing will avoid breaking "type is small" assertions for commonly used types when `splat` is added.
This PR packs these types:
- ExternAbi: enum + `unwind` variants (38) -> 6 bits
- ImplicitSelfKind: enum variants (5) -> 3 bits
- lifetime_elision_allowed, safety, c_variadic: bool -> 1 bit
#### Minor Changes
Fixes some typos, and applies rustfmt to clippy files that got skipped somehow.97 files changed
Lines changed: 758 additions & 544 deletions
File tree
- compiler
- rustc_abi/src
- rustc_ast_lowering/src
- rustc_borrowck/src
- diagnostics
- type_check
- rustc_codegen_cranelift/src
- rustc_codegen_gcc/src/intrinsic
- rustc_codegen_llvm/src
- rustc_codegen_ssa/src/debuginfo
- rustc_const_eval/src
- const_eval
- interpret
- rustc_hir_analysis/src
- check
- errors
- hir_ty_lowering
- rustc_hir_pretty/src
- rustc_hir_typeck/src
- fn_ctxt
- method
- rustc_hir/src
- rustc_lint/src
- types
- rustc_middle/src
- hir
- ty
- context
- print
- rustc_mir_build/src
- builder
- thir/cx
- rustc_mir_transform/src
- shim
- rustc_passes/src
- rustc_public/src/unstable/convert
- stable
- rustc_query_impl
- src
- rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi
- rustc_symbol_mangling/src
- rustc_trait_selection/src
- error_reporting
- infer
- nice_region_error
- traits
- traits
- rustc_ty_utils/src
- rustc_type_ir/src
- ty_kind
- library/stdarch/crates/stdarch-gen-arm/src
- src
- librustdoc/clean
- tools
- clippy
- clippy_lints/src
- functions
- methods
- clippy_utils/src
- miri/src
- bin
- shims
- rust-analyzer/crates/hir-ty/src
- infer
- next_solver
- tests/ui/symbol-names
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4579 | 4579 | | |
4580 | 4580 | | |
4581 | 4581 | | |
4582 | | - | |
4583 | 4582 | | |
4584 | 4583 | | |
4585 | 4584 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
134 | 157 | | |
135 | 158 | | |
136 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | 49 | | |
51 | 50 | | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
| 274 | + | |
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
313 | | - | |
314 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
| 334 | + | |
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
338 | | - | |
| 338 | + | |
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
| |||
603 | 603 | | |
604 | 604 | | |
605 | 605 | | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | | - | |
| 606 | + | |
613 | 607 | | |
614 | 608 | | |
615 | 609 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
755 | 755 | | |
756 | 756 | | |
757 | 757 | | |
758 | | - | |
759 | | - | |
760 | | - | |
| 758 | + | |
761 | 759 | | |
762 | 760 | | |
763 | 761 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1849 | 1849 | | |
1850 | 1850 | | |
1851 | 1851 | | |
1852 | | - | |
| 1852 | + | |
1853 | 1853 | | |
1854 | 1854 | | |
1855 | 1855 | | |
| |||
1912 | 1912 | | |
1913 | 1913 | | |
1914 | 1914 | | |
1915 | | - | |
1916 | | - | |
1917 | | - | |
1918 | | - | |
1919 | | - | |
1920 | | - | |
| 1915 | + | |
| 1916 | + | |
1921 | 1917 | | |
1922 | 1918 | | |
1923 | 1919 | | |
| |||
1939 | 1935 | | |
1940 | 1936 | | |
1941 | 1937 | | |
1942 | | - | |
1943 | | - | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
1944 | 1943 | | |
1945 | 1944 | | |
1946 | 1945 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
496 | | - | |
| 496 | + | |
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
| |||
810 | 810 | | |
811 | 811 | | |
812 | 812 | | |
813 | | - | |
| 813 | + | |
814 | 814 | | |
815 | 815 | | |
816 | 816 | | |
| |||
1147 | 1147 | | |
1148 | 1148 | | |
1149 | 1149 | | |
1150 | | - | |
| 1150 | + | |
1151 | 1151 | | |
1152 | 1152 | | |
1153 | 1153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
1083 | 1084 | | |
1084 | 1085 | | |
1085 | 1086 | | |
| 1087 | + | |
| 1088 | + | |
1086 | 1089 | | |
1087 | 1090 | | |
1088 | 1091 | | |
1089 | 1092 | | |
1090 | 1093 | | |
1091 | | - | |
1092 | | - | |
1093 | | - | |
| 1094 | + | |
1094 | 1095 | | |
1095 | 1096 | | |
1096 | 1097 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | | - | |
108 | | - | |
| 106 | + | |
109 | 107 | | |
110 | 108 | | |
111 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1015 | 1015 | | |
1016 | 1016 | | |
1017 | 1017 | | |
1018 | | - | |
| 1018 | + | |
1019 | 1019 | | |
1020 | 1020 | | |
1021 | 1021 | | |
| |||
1971 | 1971 | | |
1972 | 1972 | | |
1973 | 1973 | | |
1974 | | - | |
| 1974 | + | |
| 1975 | + | |
1975 | 1976 | | |
1976 | 1977 | | |
1977 | 1978 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
870 | 870 | | |
871 | 871 | | |
872 | 872 | | |
873 | | - | |
874 | | - | |
875 | | - | |
876 | | - | |
877 | | - | |
878 | | - | |
| 873 | + | |
879 | 874 | | |
880 | 875 | | |
881 | | - | |
882 | | - | |
883 | | - | |
884 | | - | |
885 | | - | |
886 | | - | |
| 876 | + | |
887 | 877 | | |
888 | 878 | | |
889 | 879 | | |
| |||
894 | 884 | | |
895 | 885 | | |
896 | 886 | | |
897 | | - | |
898 | | - | |
899 | | - | |
900 | | - | |
901 | | - | |
902 | | - | |
903 | | - | |
904 | | - | |
905 | | - | |
906 | | - | |
907 | | - | |
| 887 | + | |
908 | 888 | | |
909 | 889 | | |
910 | 890 | | |
| |||
0 commit comments