Skip to content

Commit d94d85f

Browse files
committed
Perform OpaqueCast field projection on HIR, too.
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).
1 parent 5a6c4d7 commit d94d85f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

clippy_utils/src/sugg.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,8 @@ impl<'tcx> Delegate<'tcx> for DerefDelegate<'_, 'tcx> {
10111011
},
10121012
// note: unable to trigger `Subslice` kind in tests
10131013
ProjectionKind::Subslice => (),
1014+
// Doesn't have surface syntax. Only occurs in patterns.
1015+
ProjectionKind::OpaqueCast => (),
10141016
ProjectionKind::Deref => {
10151017
// Explicit derefs are typically handled later on, but
10161018
// some items do not need explicit deref, such as array accesses,

0 commit comments

Comments
 (0)