rust/src/librustc_typeck
Mazdak Farrokhzad 833dada106
Rollup merge of #62585 - pnkfelix:issue-60431-make-struct-tail-normalize-when-possible, r=eddyb
Make struct_tail normalize when possible

As noted in commit message: this replaces the existing methods to extract the struct tail(s) with new entry points that make the handling of normalization explicit.

Most of the places that call `struct_tail` are during codegen, post type-checking, and therefore they can get away with using `tcx.normalize_erasing_regions` (this is the entry point `struct_tail_erasing_lifetimes`)

For other cases that may arise, one can use the core method, which is parameterized over the normalization `Ty -> Ty` closure (`struct_tail_with_normalize`).

Or one can use the trivial entry point that does not normalization (`struct_tail_without_normalization`)

----

I spent a little while trying to make a test that exposed the bug via `impl Trait` rather than a projection, but I failed to find something that tripped up the current nightly `rustc`.
 * I have *not* spent any time trying to make tests that trip up the other places where `struct_tail` was previously being called. While I do think the task of making such tests could be worthwhile, I am simply running out of time. (Its also possible that the layout code is always the first point called, and thus it may be pointless to try to come up with such tests.)

I also spent a little time discussing with @eddyb where this code should live. They suggested moving `struct_tail` and its sibling `struct_lockstep_tails` to the `LayoutCx`.  But in the interest of time, I have left that refactoring (which may be questionable at this point) to a follow-up task.

----

Fix #60431
2019-07-13 16:18:37 +02:00
..
check Rollup merge of #62585 - pnkfelix:issue-60431-make-struct-tail-normalize-when-possible, r=eddyb 2019-07-13 16:18:37 +02:00
coherence rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-04 12:53:12 +02:00
outlives rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-04 12:53:12 +02:00
variance normalize use of backticks in compiler messages for librustc_typecheck 2019-07-07 18:27:21 +02:00
astconv.rs name the trait in ambiguous-associated-items fully qualified suggestion 2019-07-06 16:47:43 -07:00
Cargo.toml rustc: Remove dylib crate type from most rustc crates 2019-07-07 03:23:00 +02:00
check_unused.rs rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-04 12:53:12 +02:00
collect.rs normalize use of backticks in compiler messages for librustc_typecheck 2019-07-07 18:27:21 +02:00
constrained_generic_params.rs Unify all uses of 'gcx and 'tcx. 2019-06-14 18:58:23 +03:00
error_codes.rs normalize use of backticks in compiler messages for librustc_typecheck 2019-07-07 18:27:21 +02:00
impl_wf_check.rs rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-04 12:53:12 +02:00
lib.rs Rollup merge of #62168 - ljedrz:the_culmination_of_hiridification, r=Zoxc 2019-07-05 20:26:56 +02:00
namespace.rs Rename "Associated*" to "Assoc*" 2019-05-26 17:49:02 +08:00
README.md rustc-guide has moved 2018-11-26 15:03:13 -06:00
structured_errors.rs Rollup merge of #57856 - lzutao:fix-old-first-edition, r=steveklabnik 2019-02-14 02:41:16 +01:00

For high-level intro to how type checking works in rustc, see the type checking chapter of the rustc guide.