Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/infer/pat.rs')
| -rw-r--r-- | crates/hir-ty/src/infer/pat.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/crates/hir-ty/src/infer/pat.rs b/crates/hir-ty/src/infer/pat.rs index d0fe00eceb..db93116f10 100644 --- a/crates/hir-ty/src/infer/pat.rs +++ b/crates/hir-ty/src/infer/pat.rs @@ -565,16 +565,9 @@ impl InferenceContext<'_> { | Pat::Slice { .. } => true, Pat::Or(pats) => pats.iter().all(|p| self.is_non_ref_pat(body, *p)), Pat::Path(path) => { - // A const is a reference pattern, but other value ns things aren't (see #16131). We don't need more than - // the hir-def resolver for this, because if there are segments left, this can only be an (associated) const. - // - // Do not use `TyLoweringContext`'s resolution, we want to ignore errors here (they'll be reported elsewhere). - let resolution = self.resolver.resolve_path_in_value_ns_fully( - self.db.upcast(), - path, - body.pat_path_hygiene(pat), - ); - resolution.is_some_and(|it| !matches!(it, hir_def::resolver::ValueNs::ConstId(_))) + // A const is a reference pattern, but other value ns things aren't (see #16131). + let resolved = self.resolve_value_path_inner(path, pat.into(), true); + resolved.is_some_and(|it| !matches!(it.0, hir_def::resolver::ValueNs::ConstId(_))) } Pat::ConstBlock(..) => false, Pat::Lit(expr) => !matches!( |