summary refs log tree commit diff
path: root/compiler/rustc_abi/src/layout.rs
AgeCommit message (Collapse)AuthorLines
2023-06-24disable some layout optimizations for unsizable structsThe 8472-42/+48
2023-06-24Make struct layout not depend on unsizeable tailLukas Markeffsky-2/+6
2023-05-16Avoid `&format("...")` calls in error message code.Nicholas Nethercote-2/+2
Error message all end up passing into a function as an `impl Into<{D,Subd}iagnosticMessage>`. If an error message is creatd as `&format("...")` that means we allocate a string (in the `format!` call), then take a reference, and then clone (allocating again) the reference to produce the `{D,Subd}iagnosticMessage`, which is silly. This commit removes the leading `&` from a lot of these cases. This means the original `String` is moved into the `{D,Subd}iagnosticMessage`, avoiding the double allocations. This requires changing some function argument types from `&str` to `String` (when all arguments are `String`) or `impl Into<{D,Subd}iagnosticMessage>` (when some arguments are `String` and some are `&str`).
2023-05-05Reorder to keep duplicate checks in sync.Luqman Aden-7/+12
2023-05-05Review feedbackLuqman Aden-13/+22
2023-05-05Incorporate review feedback from 103926.Luqman Aden-38/+33
2023-05-05Do not use scalar layout if there are ZSTs with alignment > 1Oli Scherer-20/+42
2023-04-28layout-alignment-promotion logic should depend on the niche-biasThe 8472-7/+22
For start-biased layout we want to avoid overpromoting so that the niche doesn't get pushed back. For end-biased layout we want to avoid promoting fields that may contain one of the niches of interest.
2023-04-28[review] add comments, turn flag into enumThe 8472-23/+44
2023-04-27add tracing for layout optimizationsThe 8472-0/+44
2023-04-27don't promote large fields to higher alignments if that would affect niche ↵The 8472-13/+24
placement
2023-04-27try two different niche-placement strategies when layouting univariant structsThe 8472-6/+70
2023-04-27refactor: extract functionThe 8472-214/+220
2023-04-18Store hashes in special types so they aren't accidentally encoded as numbersBen Kimock-1/+2
2023-04-16Various minor Idx-related tweaksScott McMurray-4/+3
Nothing particularly exciting here, but a couple of things I noticed as I was looking for more index conversions to simplify.
2023-04-04Use `FieldIdx` in `FieldsShape`Scott McMurray-40/+35
Finally got to the main motivating example from the MCP :)
2023-04-02Use `&IndexSlice` instead of `&IndexVec` where possibleScott McMurray-2/+2
All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*.
2023-03-25Refactor: `VariantIdx::from_u32(0)` -> `FIRST_VARIANT`Scott McMurray-9/+9
Since structs are always `VariantIdx(0)`, there's a bunch of files where the only reason they had `VariantIdx` or `vec::Idx` imported at all was to get the first variant. So this uses a constant for that, and adds some doc-comments to `VariantIdx` while I'm there, since it doesn't have any today.
2023-01-21Remove some superfluous type parameters from layout.rs.Michael Benfield-75/+71
Specifically remove V, which can always be VariantIdx, and F, which can always be Layout.
2022-12-01Remove useless borrows and derefsMaybe Waffle-5/+5
2022-11-25Simplify and document range layout computationOli Scherer-13/+11
2022-11-24move things from rustc_target::abi to rustc_abihkalbasi-0/+947