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.rs | 14 |
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 200b3d71f8..3d4d6cecef 100644 --- a/crates/hir-ty/src/infer/expr.rs +++ b/crates/hir-ty/src/infer/expr.rs @@ -2188,9 +2188,11 @@ impl<'db> InferenceContext<'_, 'db> { }; let data = self.db.function_signature(func); - let Some(legacy_const_generics_indices) = &data.legacy_const_generics_indices else { + let Some(legacy_const_generics_indices) = data.legacy_const_generics_indices(self.db, func) + 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() { @@ -2199,9 +2201,8 @@ impl<'db> InferenceContext<'_, 'db> { } else { // there are more parameters than there should be without legacy // const params; use them - let mut indices = legacy_const_generics_indices.as_ref().clone(); - indices.sort(); - return indices; + legacy_const_generics_indices.sort_unstable(); + return legacy_const_generics_indices; } } @@ -2214,9 +2215,8 @@ impl<'db> InferenceContext<'_, 'db> { self.infer_expr(args[arg_idx as usize], &expected, ExprIsRead::Yes); // FIXME: evaluate and unify with the const } - let mut indices = legacy_const_generics_indices.as_ref().clone(); - indices.sort(); - indices + legacy_const_generics_indices.sort_unstable(); + legacy_const_generics_indices } pub(super) fn with_breakable_ctx<T>( |