@@ -1950,25 +1950,25 @@ impl InferenceContext<'_> {
1950
1950
} ;
1951
1951
1952
1952
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 {
1954
1954
return Default :: default ( ) ;
1955
- }
1955
+ } ;
1956
1956
1957
1957
// 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 ( ) {
1959
1959
if args. len ( ) <= data. params . len ( ) {
1960
1960
return Default :: default ( ) ;
1961
1961
} else {
1962
1962
// there are more parameters than there should be without legacy
1963
1963
// 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 ( ) ;
1965
1965
indices. sort ( ) ;
1966
1966
return indices;
1967
1967
}
1968
1968
}
1969
1969
1970
1970
// 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 ( ) {
1972
1972
let arg = match subst. at ( Interner , subst_idx) . constant ( Interner ) {
1973
1973
Some ( c) => c,
1974
1974
None => continue , // not a const parameter?
@@ -1981,7 +1981,7 @@ impl InferenceContext<'_> {
1981
1981
self . infer_expr ( args[ arg_idx as usize ] , & expected) ;
1982
1982
// FIXME: evaluate and unify with the const
1983
1983
}
1984
- let mut indices = data . legacy_const_generics_indices . clone ( ) ;
1984
+ let mut indices = legacy_const_generics_indices. as_ref ( ) . clone ( ) ;
1985
1985
indices. sort ( ) ;
1986
1986
indices
1987
1987
}
0 commit comments