Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/infer/path.rs')
-rw-r--r--crates/hir-ty/src/infer/path.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/hir-ty/src/infer/path.rs b/crates/hir-ty/src/infer/path.rs
index 1c3d93ae6e..0ec72edc3d 100644
--- a/crates/hir-ty/src/infer/path.rs
+++ b/crates/hir-ty/src/infer/path.rs
@@ -11,7 +11,7 @@ use rustc_type_ir::inherent::{SliceLike, Ty as _};
use stdx::never;
use crate::{
- InferenceDiagnostic, Span, ValueTyDefId,
+ ExplicitDropMethodUseKind, InferenceDiagnostic, Span, ValueTyDefId,
infer::{
InferenceTyLoweringVarsCtx, diagnostics::InferenceTyLoweringContext as TyLoweringContext,
},
@@ -33,6 +33,14 @@ impl<'db> InferenceContext<'_, 'db> {
) -> Option<(ValueNs, Ty<'db>)> {
let (value, self_subst) = self.resolve_value_path_inner(path, id, false)?;
+ if let ValueNs::FunctionId(f) = value
+ && self.lang_items.Drop_drop.is_some_and(|drop_fn| drop_fn == f)
+ {
+ self.push_diagnostic(InferenceDiagnostic::ExplicitDropMethodUse {
+ kind: ExplicitDropMethodUseKind::Path(id),
+ });
+ }
+
let (value_def, generic_def, substs) =
match self.resolve_value_path(path, id, value, self_subst)? {
ValuePathResolution::GenericDef(value_def, generic_def, substs) => {