From 89b48a2e22fe4b5f3289e349ae0af81c530f7630 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Tue, 31 Jan 2023 11:54:06 +0000 Subject: [PATCH 1/2] Thread pattern types through the HIR --- clippy_lints/src/dereference.rs | 1 + clippy_utils/src/hir_utils.rs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/clippy_lints/src/dereference.rs b/clippy_lints/src/dereference.rs index 560b2acc1c70..eb317c70926a 100644 --- a/clippy_lints/src/dereference.rs +++ b/clippy_lints/src/dereference.rs @@ -821,6 +821,7 @@ impl TyCoercionStability { | TyKind::Array(..) | TyKind::Ptr(_) | TyKind::BareFn(_) + | TyKind::Pat(..) | TyKind::Never | TyKind::Tup(_) | TyKind::Path(_) => Self::Deref, diff --git a/clippy_utils/src/hir_utils.rs b/clippy_utils/src/hir_utils.rs index f8bbe9977748..6c3d93299322 100644 --- a/clippy_utils/src/hir_utils.rs +++ b/clippy_utils/src/hir_utils.rs @@ -1068,6 +1068,10 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> { self.hash_ty(ty); self.hash_array_length(len); }, + TyKind::Pat(ty, pat) => { + self.hash_ty(ty); + self.hash_pat(pat); + }, TyKind::Ptr(ref mut_ty) => { self.hash_ty(mut_ty.ty); mut_ty.mutbl.hash(&mut self.s); From c8388033f3e5dba47531be66d3b80b45eecee46a Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 2 Feb 2023 13:57:36 +0000 Subject: [PATCH 2/2] Actually create ranged int types in the type system. --- clippy_lints/src/dereference.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/clippy_lints/src/dereference.rs b/clippy_lints/src/dereference.rs index eb317c70926a..f83fb1b90198 100644 --- a/clippy_lints/src/dereference.rs +++ b/clippy_lints/src/dereference.rs @@ -870,6 +870,7 @@ impl TyCoercionStability { | ty::Int(_) | ty::Uint(_) | ty::Array(..) + | ty::Pat(..) | ty::Float(_) | ty::RawPtr(..) | ty::FnPtr(_)