about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-12-24 00:51:51 +0000
committerbors <bors@rust-lang.org>2024-12-24 00:51:51 +0000
commitb5fe6ec47b8bc543481bb6efe4fc2b2daaee3d6b (patch)
tree2f740df0ca480c969142774a8c2e92ef6681d792
parentc772140a1fc8cbb6a87db332ce021db7f42857bf (diff)
parent4d735d831e1144319b19d06d930e6c0d31f3cf30 (diff)
downloadrust-b5fe6ec47b8bc543481bb6efe4fc2b2daaee3d6b.tar.gz
rust-b5fe6ec47b8bc543481bb6efe4fc2b2daaee3d6b.zip
Auto merge of #134625 - compiler-errors:unsafe-binders-ty, r=oli-obk
Begin to implement type system layer of unsafe binders

Mostly TODOs, but there's a lot of match arms that are basically just noops so I wanted to split these out before I put up the MIR lowering/projection part of this logic.

r? oli-obk

Tracking:

- https://github.com/rust-lang/rust/issues/130516
-rw-r--r--clippy_lints/src/dereference.rs3
-rw-r--r--clippy_utils/src/visitors.rs4
2 files changed, 5 insertions, 2 deletions
diff --git a/clippy_lints/src/dereference.rs b/clippy_lints/src/dereference.rs
index e3959903fdd..821312a9e40 100644
--- a/clippy_lints/src/dereference.rs
+++ b/clippy_lints/src/dereference.rs
@@ -877,7 +877,8 @@ impl TyCoercionStability {
                 | ty::CoroutineClosure(..)
                 | ty::Never
                 | ty::Tuple(_)
-                | ty::Alias(ty::Projection, _) => Self::Deref,
+                | ty::Alias(ty::Projection, _)
+                | ty::UnsafeBinder(_) => Self::Deref,
             };
         }
     }
diff --git a/clippy_utils/src/visitors.rs b/clippy_utils/src/visitors.rs
index 71499b1293a..afceeec2272 100644
--- a/clippy_utils/src/visitors.rs
+++ b/clippy_utils/src/visitors.rs
@@ -677,6 +677,9 @@ pub fn for_each_unconsumed_temporary<'tcx, B>(
             ExprKind::Type(e, _) => {
                 helper(typeck, consume, e, f)?;
             },
+            ExprKind::UnsafeBinderCast(_, e, _) => {
+                helper(typeck, consume, e, f)?;
+            },
 
             // Either drops temporaries, jumps out of the current expression, or has no sub expression.
             ExprKind::DropTemps(_)
@@ -694,7 +697,6 @@ pub fn for_each_unconsumed_temporary<'tcx, B>(
             | ExprKind::Continue(_)
             | ExprKind::InlineAsm(_)
             | ExprKind::OffsetOf(..)
-            | ExprKind::UnsafeBinderCast(..)
             | ExprKind::Err(_) => (),
         }
         ControlFlow::Continue(())