Rollup merge of #114022 - oli-obk:tait_ice_alias_field_projection, r=cjgillot

Perform OpaqueCast field projection on HIR, too.

fixes #105819

This is necessary for closure captures in 2021 edition, as they capture individual fields, not the full mentioned variables. So it may try to capture a field of an opaque (because the hidden type is known to be something with a field).

See https://github.com/rust-lang/rust/pull/99806 for when and why we added OpaqueCast to MIR.
This commit is contained in:
Matthias Krüger 2023-08-04 09:18:58 +02:00 committed by GitHub
commit 1589759334

View file

@ -1011,6 +1011,8 @@ impl<'tcx> Delegate<'tcx> for DerefDelegate<'_, 'tcx> {
}, },
// note: unable to trigger `Subslice` kind in tests // note: unable to trigger `Subslice` kind in tests
ProjectionKind::Subslice => (), ProjectionKind::Subslice => (),
// Doesn't have surface syntax. Only occurs in patterns.
ProjectionKind::OpaqueCast => (),
ProjectionKind::Deref => { ProjectionKind::Deref => {
// Explicit derefs are typically handled later on, but // Explicit derefs are typically handled later on, but
// some items do not need explicit deref, such as array accesses, // some items do not need explicit deref, such as array accesses,