rust/compiler/rustc_middle/src
bors 9556d7a09a 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`
2021-08-29 22:54:26 +00:00
..
dep_graph Update DepNode's size 2021-07-10 21:46:31 +08:00
hir Remove obsolete MacroDef variant of OwnerNode 2021-08-28 00:24:30 -07:00
ich rename assert_matches module 2021-07-16 09:18:14 -07:00
infer Miscellaneous inlining improvements 2021-06-02 08:49:58 +02:00
middle Auto merge of #87739 - Aaron1011:remove-used-attrs, r=wesleywiser 2021-08-24 03:58:22 +00:00
mir Auto merge of #87280 - lcnr:lazy-anon-const-default-substs, r=nikomatsakis 2021-08-26 22:26:23 +00:00
query Auto merge of #87280 - lcnr:lazy-anon-const-default-substs, r=nikomatsakis 2021-08-26 22:26:23 +00:00
traits Add ty::BoundConstness 2021-08-27 06:49:18 +00:00
ty Auto merge of #88337 - eddyb:field-failure-is-not-an-option, r=nagisa 2021-08-29 22:54:26 +00:00
util Make panic/assert calls in rustc compatible with Rust 2021. 2021-02-03 22:42:53 +01:00
arena.rs Make THIR building a stealable query 2021-05-22 14:36:22 +02:00
lib.rs Use if-let guards in the codebase 2021-08-25 20:24:35 +02:00
lint.rs Rename force-warns to force-warn 2021-07-21 15:41:10 +02:00
macros.rs Auto merge of #78779 - LeSeulArtichaut:ty-visitor-return, r=oli-obk 2020-11-17 12:24:34 +00:00
tests.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
thir.rs Various pattern cleanups 2021-08-25 20:24:39 +02:00