Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/method_resolution/confirm.rs')
-rw-r--r--crates/hir-ty/src/method_resolution/confirm.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/crates/hir-ty/src/method_resolution/confirm.rs b/crates/hir-ty/src/method_resolution/confirm.rs
index 9e8791edde..570dd63a50 100644
--- a/crates/hir-ty/src/method_resolution/confirm.rs
+++ b/crates/hir-ty/src/method_resolution/confirm.rs
@@ -5,7 +5,6 @@ use hir_def::{
FunctionId, GenericDefId, GenericParamId, ItemContainerId, TraitId,
expr_store::path::{GenericArg as HirGenericArg, GenericArgs as HirGenericArgs},
hir::{ExprId, generics::GenericParamDataRef},
- lang_item::LangItem,
};
use rustc_type_ir::{
TypeFoldable,
@@ -481,7 +480,7 @@ impl<'a, 'b, 'db> ConfirmContext<'a, 'b, 'db> {
}
Err(_) => {
if self.ctx.unstable_features.arbitrary_self_types {
- self.ctx.result.type_mismatches.insert(
+ self.ctx.result.type_mismatches.get_or_insert_default().insert(
self.expr.into(),
TypeMismatch { expected: method_self_ty, actual: self_ty },
);
@@ -550,9 +549,7 @@ impl<'a, 'b, 'db> ConfirmContext<'a, 'b, 'db> {
&self,
predicates: impl Iterator<Item = Clause<'db>>,
) -> bool {
- let Some(sized_def_id) =
- LangItem::Sized.resolve_trait(self.db(), self.ctx.resolver.krate())
- else {
+ let Some(sized_def_id) = self.ctx.lang_items.Sized else {
return false;
};
@@ -570,9 +567,7 @@ impl<'a, 'b, 'db> ConfirmContext<'a, 'b, 'db> {
fn check_for_illegal_method_calls(&self) {
// Disallow calls to the method `drop` defined in the `Drop` trait.
if let ItemContainerId::TraitId(trait_def_id) = self.candidate.loc(self.db()).container
- && LangItem::Drop
- .resolve_trait(self.db(), self.ctx.resolver.krate())
- .is_some_and(|drop_trait| drop_trait == trait_def_id)
+ && self.ctx.lang_items.Drop.is_some_and(|drop_trait| drop_trait == trait_def_id)
{
// FIXME: Report an error.
}