Use statics + clone instead of const until const can access statics

This commit is contained in:
Lukas Wirth 2024-07-14 12:19:19 +02:00
parent dd626e78c7
commit f2d51073d2
49 changed files with 389 additions and 362 deletions

View file

@ -650,7 +650,7 @@ impl InferenceContext<'_> {
if let Some(deref_fn) = self
.db
.trait_data(deref_trait)
.method_by_name(&Name::new_symbol_root(sym::deref))
.method_by_name(&Name::new_symbol_root(sym::deref.clone()))
{
// FIXME: this is wrong in multiple ways, subst is empty, and we emit it even for builtin deref (note that
// the mutability is not wrong, and will be fixed in `self.infer_mut`).
@ -791,7 +791,7 @@ impl InferenceContext<'_> {
if let Some(func) = self
.db
.trait_data(index_trait)
.method_by_name(&Name::new_symbol_root(sym::index))
.method_by_name(&Name::new_symbol_root(sym::index.clone()))
{
let substs = TyBuilder::subst_for_def(self.db, index_trait, None)
.push(self_ty.clone())