diff options
| author | bors <bors@rust-lang.org> | 2021-08-29 22:54:26 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-08-29 22:54:26 +0000 |
| commit | 9556d7a09a7e80e84430071b29d118f39dde8205 (patch) | |
| tree | 0573eff24dad76cec0aec88bc0af55c2213d9856 /compiler/rustc_mir_transform/src/coverage/mod.rs | |
| parent | 2f662b14033c4369b0a7b5c2656592ef08edf434 (diff) | |
| parent | 78778fc6aa87d6f9735b73b4136fb26043d84158 (diff) | |
| download | rust-9556d7a09a7e80e84430071b29d118f39dde8205.tar.gz rust-9556d7a09a7e80e84430071b29d118f39dde8205.zip | |
Auto merge of #88337 - eddyb:field-failure-is-not-an-option, r=nagisa
rustc_target: `TyAndLayout::field` should never error. This refactor (making `TyAndLayout::field` return `TyAndLayout` without any `Result` around it) is based on a simple observation, regarding `TyAndLayout::field`: If `cx.layout_of(ty)` succeeds (for some `cx` and `ty`), then `.field(cx, i)` on the resulting `TyAndLayout` should *always* succeed in computing `cx.layout_of(field_ty)` (where `field_ty` is the type of the `i`th field of `ty`). The reason for this is that no matter which field is chosen, `cx.layout_of(field_ty)` *will have already been computed*, as part of computing `cx.layout_of(ty)`, as we cannot determine the layout of *any* type without considering the layouts of *all* of its fields. And so it should be fine to turn any errors into ICEs, since they likely indicate a `cx` mismatch, or some other edge case that is due to a compiler bug (as opposed to ever being an user-facing error). <hr/> Each commit should probably be reviewed separately, though note that there's some `where` clauses (in `rustc_target::abi::call::*`) that change in most commits. cc `@nagisa` `@oli-obk`
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/mod.rs')
0 files changed, 0 insertions, 0 deletions
