@@ -1950,25 +1950,25 @@ impl InferenceContext<'_> {
19501950 } ;
19511951
19521952 let data = self . db . function_data ( func) ;
1953- if data. legacy_const_generics_indices . is_empty ( ) {
1953+ let Some ( legacy_const_generics_indices ) = & data. legacy_const_generics_indices else {
19541954 return Default :: default ( ) ;
1955- }
1955+ } ;
19561956
19571957 // only use legacy const generics if the param count matches with them
1958- if data. params . len ( ) + data . legacy_const_generics_indices . len ( ) != args. len ( ) {
1958+ if data. params . len ( ) + legacy_const_generics_indices. len ( ) != args. len ( ) {
19591959 if args. len ( ) <= data. params . len ( ) {
19601960 return Default :: default ( ) ;
19611961 } else {
19621962 // there are more parameters than there should be without legacy
19631963 // const params; use them
1964- let mut indices = data . legacy_const_generics_indices . clone ( ) ;
1964+ let mut indices = legacy_const_generics_indices. as_ref ( ) . clone ( ) ;
19651965 indices. sort ( ) ;
19661966 return indices;
19671967 }
19681968 }
19691969
19701970 // check legacy const parameters
1971- for ( subst_idx, arg_idx) in data . legacy_const_generics_indices . iter ( ) . copied ( ) . enumerate ( ) {
1971+ for ( subst_idx, arg_idx) in legacy_const_generics_indices. iter ( ) . copied ( ) . enumerate ( ) {
19721972 let arg = match subst. at ( Interner , subst_idx) . constant ( Interner ) {
19731973 Some ( c) => c,
19741974 None => continue , // not a const parameter?
@@ -1981,7 +1981,7 @@ impl InferenceContext<'_> {
19811981 self . infer_expr ( args[ arg_idx as usize ] , & expected) ;
19821982 // FIXME: evaluate and unify with the const
19831983 }
1984- let mut indices = data . legacy_const_generics_indices . clone ( ) ;
1984+ let mut indices = legacy_const_generics_indices. as_ref ( ) . clone ( ) ;
19851985 indices. sort ( ) ;
19861986 indices
19871987 }
0 commit comments