Skip to content

Commit

Permalink
Rollup merge of rust-lang#119012 - workingjubilee:extract-enum-layout…
Browse files Browse the repository at this point in the history
…-fn, r=b-naber

Extract `layout_of_{struct,enum}` fn

While writing rust-lang#118974 I noticed it was annoying to navigate a huge, several hundred line function, which handles many subcases, and make confident declarations about what part of the flow of execution the compiler would be in. To help with that, this breaks out `layout_of_struct_or_enum`'s fundamental logic into a pair of functions, one for each case. It changes essentially none of that logic, merely moves it around.

Because "the layout of an ADT" feels like a somewhat nebulous subject, I chose to deliberately avoid any expansions to LayoutCalculator's public API, though such does feel like a possible logical next step. There are, indeed, many logical next steps. I'm not taking any of them here, yet, because this comparatively tiny refactor is a prerequisite for all of them.
  • Loading branch information
compiler-errors authored Dec 23, 2023
2 parents 495203b + 8facfb2 commit aaff415
Showing 1 changed file with 634 additions and 584 deletions.
Loading

0 comments on commit aaff415

Please sign in to comment.