1
Fork 0

Auto merge of #89024 - oli-obk:lazy_tait_is_not_limited_to_being_used_in_return_position, r=nikomatsakis

Lazy TAIT preparation cleanups

Check that TAIT generics are fully generic in mir typeck instead of wf-check, as wf-check can by definition only check TAIT in return position and not account for TAITs defined in the body of the function

r? `@spastorino` `@nikomatsakis`
This commit is contained in:
bors 2021-09-23 19:38:30 +00:00
commit 2b862bed98
33 changed files with 433 additions and 272 deletions

View file

@ -1062,11 +1062,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
/// Here, `def_id` is the `LocalDefId` of the defining use of the opaque type (e.g., `f1` or `f2`),
/// and `opaque_hir_id` is the `HirId` of the definition of the opaque type `Baz`.
/// For the above example, this function returns `true` for `f1` and `false` for `f2`.
pub fn may_define_opaque_type(
tcx: TyCtxt<'_>,
def_id: LocalDefId,
opaque_hir_id: hir::HirId,
) -> bool {
fn may_define_opaque_type(tcx: TyCtxt<'_>, def_id: LocalDefId, opaque_hir_id: hir::HirId) -> bool {
let mut hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
// Named opaque types can be defined by any siblings or children of siblings.