Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/infer/expr.rs')
-rw-r--r--crates/hir-ty/src/infer/expr.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/hir-ty/src/infer/expr.rs b/crates/hir-ty/src/infer/expr.rs
index a1d99a4528..efb7244ff6 100644
--- a/crates/hir-ty/src/infer/expr.rs
+++ b/crates/hir-ty/src/infer/expr.rs
@@ -2365,11 +2365,9 @@ impl<'db> InferenceContext<'_, 'db> {
};
let data = self.db.function_signature(func);
- let Some(legacy_const_generics_indices) = data.legacy_const_generics_indices(self.db, func)
- else {
+ let Some(legacy_const_generics_indices) = &data.legacy_const_generics_indices else {
return Default::default();
};
- let mut legacy_const_generics_indices = Box::<[u32]>::from(legacy_const_generics_indices);
// only use legacy const generics if the param count matches with them
if data.params.len() + legacy_const_generics_indices.len() != args.len() {
@@ -2378,8 +2376,9 @@ impl<'db> InferenceContext<'_, 'db> {
} else {
// there are more parameters than there should be without legacy
// const params; use them
- legacy_const_generics_indices.sort_unstable();
- return legacy_const_generics_indices;
+ let mut indices = legacy_const_generics_indices.as_ref().clone();
+ indices.sort();
+ return indices;
}
}
@@ -2392,8 +2391,9 @@ impl<'db> InferenceContext<'_, 'db> {
self.infer_expr(args[arg_idx as usize], &expected, ExprIsRead::Yes);
// FIXME: evaluate and unify with the const
}
- legacy_const_generics_indices.sort_unstable();
- legacy_const_generics_indices
+ let mut indices = legacy_const_generics_indices.as_ref().clone();
+ indices.sort();
+ indices
}
/// Dereferences a single level of immutable referencing.