rust/compiler/rustc_passes/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
..
liveness Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
check_attr.rs Treat macros as HIR items 2021-08-28 00:16:34 -07:00
check_const.rs Introduce hir::ExprKind::Let - Take 2 2021-08-15 16:18:26 -03:00
dead.rs Fix dead code warning when inline const is used in pattern 2021-08-14 22:58:04 +01:00
diagnostic_items.rs Treat macros as HIR items 2021-08-28 00:16:34 -07:00
entry.rs Auto merge of #87449 - matthiaskrgr:clippyy_v2, r=nagisa 2021-08-01 09:15:15 +00:00
hir_id_validator.rs GenericParam does not need to be a HIR owner. 2021-03-23 22:47:22 +01:00
hir_stats.rs Treat macros as HIR items 2021-08-28 00:16:34 -07:00
intrinsicck.rs Forbid ! from being used in asm! output 2021-08-12 20:28:35 +01:00
lang_items.rs Auto merge of #87875 - asquared31415:generic-lang-items, r=cjgillot 2021-08-25 08:12:16 +00:00
layout_test.rs rustc_target: add lifetime parameter to LayoutOf. 2021-08-27 13:09:32 +03:00
lib_features.rs Treat macros as HIR items 2021-08-28 00:16:34 -07:00
lib.rs Remove Session.used_attrs and move logic to CheckAttrVisitor 2021-08-21 13:27:27 -05:00
liveness.rs Auto merge of #84333 - tmiasko:liveness-yield, r=tmandry 2021-08-25 05:31:26 +00:00
loops.rs Do not suggest using a break label when one is already present 2021-01-21 21:43:29 -08:00
naked_functions.rs Introduce hir::ExprKind::Let - Take 2 2021-08-15 16:18:26 -03:00
reachable.rs Remove obsolete MacroDef variant of OwnerNode 2021-08-28 00:24:30 -07:00
region.rs Use correct drop scopes for if expressions 2021-08-15 16:05:25 -03:00
stability.rs Treat macros as HIR items 2021-08-28 00:16:34 -07:00
upvars.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
weak_lang_items.rs Remove Session.used_attrs and move logic to CheckAttrVisitor 2021-08-21 13:27:27 -05:00