about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-08-04 09:18:58 +0200
committerGitHub <noreply@github.com>2023-08-04 09:18:58 +0200
commit576bf82702d5312209355975fc79cb8f13b3161a (patch)
tree3333004868e26c1dfe245bd1356ee9ba9860c752 /src
parent098c1db7e55e7229a520a2ec8e460e1e300e109b (diff)
parente390dc9c36448ca033aad48a6e7fd5ecc3f038d2 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/tools/clippy/clippy_utils/src/sugg.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/tools/clippy/clippy_utils/src/sugg.rs b/src/tools/clippy/clippy_utils/src/sugg.rs
index 5d7e1494fcf..a43a81bc63a 100644
--- a/src/tools/clippy/clippy_utils/src/sugg.rs
+++ b/src/tools/clippy/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,