Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/infer/op.rs')
-rw-r--r--crates/hir-ty/src/infer/op.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/crates/hir-ty/src/infer/op.rs b/crates/hir-ty/src/infer/op.rs
index 88319a8b1a..8236de167f 100644
--- a/crates/hir-ty/src/infer/op.rs
+++ b/crates/hir-ty/src/infer/op.rs
@@ -2,7 +2,7 @@
use std::collections::hash_map;
-use hir_def::{GenericParamId, TraitId, hir::ExprId, lang_item::LangItem};
+use hir_def::{GenericParamId, TraitId, hir::ExprId};
use intern::{Symbol, sym};
use rustc_ast_ir::Mutability;
use rustc_type_ir::inherent::{IntoKind, Ty as _};
@@ -343,7 +343,7 @@ impl<'a, 'db> InferenceContext<'a, 'db> {
let obligation = Obligation::new(
self.interner(),
cause,
- self.table.trait_env.env,
+ self.table.param_env,
TraitRef::new_from_args(self.interner(), trait_did.into(), args),
);
let mut ocx = ObligationCtxt::new(self.infcx());
@@ -355,17 +355,18 @@ impl<'a, 'db> InferenceContext<'a, 'db> {
fn lang_item_for_bin_op(&self, op: BinaryOp) -> (Symbol, Option<TraitId>) {
let (method_name, trait_lang_item) =
- crate::lang_items::lang_items_for_bin_op(op).expect("invalid operator provided");
- (method_name, trait_lang_item.resolve_trait(self.db, self.krate()))
+ crate::lang_items::lang_items_for_bin_op(self.lang_items, op)
+ .expect("invalid operator provided");
+ (method_name, trait_lang_item)
}
fn lang_item_for_unop(&self, op: UnaryOp) -> (Symbol, Option<TraitId>) {
let (method_name, trait_lang_item) = match op {
- UnaryOp::Not => (sym::not, LangItem::Not),
- UnaryOp::Neg => (sym::neg, LangItem::Neg),
+ UnaryOp::Not => (sym::not, self.lang_items.Not),
+ UnaryOp::Neg => (sym::neg, self.lang_items.Neg),
UnaryOp::Deref => panic!("Deref is not overloadable"),
};
- (method_name, trait_lang_item.resolve_trait(self.db, self.krate()))
+ (method_name, trait_lang_item)
}
}