about summary refs log tree commit diff
path: root/clippy_utils
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-07-24 14:47:32 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-07-24 15:19:26 +0000
commitd94d85f3d8c64a216cee1c07f8c1c5384959984d (patch)
treed2bacbb26ff7ee48da290daf84e899205f40c63b /clippy_utils
parent5a6c4d7d43e6bacdfe1373e3d60452a2608d8d0b (diff)
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).
Diffstat (limited to 'clippy_utils')
-rw-r--r--clippy_utils/src/sugg.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/clippy_utils/src/sugg.rs b/clippy_utils/src/sugg.rs
index 5d7e1494fcf..a43a81bc63a 100644
--- a/clippy_utils/src/sugg.rs
+++ b/clippy_utils/src/sugg.rs
@@ -1011,6 +1011,8 @@ impl<'tcx> Delegate<'tcx> for DerefDelegate<'_, 'tcx> {
                         },
                         // note: unable to trigger `Subslice` kind in tests
                         ProjectionKind::Subslice => (),
+                        // Doesn't have surface syntax. Only occurs in patterns.
+                        ProjectionKind::OpaqueCast => (),
                         ProjectionKind::Deref => {
                             // Explicit derefs are typically handled later on, but
                             // some items do not need explicit deref, such as array accesses,