Remove legacy_const_generics_indices from CallableSig

I want to remove CallableSig anyway, and it's not needed anymore.
This commit is contained in:
Florian Diebold 2022-03-27 19:12:00 +02:00
parent 2be7e26d7d
commit c2a31bfbb8
2 changed files with 3 additions and 20 deletions

View File

@ -217,7 +217,6 @@ pub fn make_canonical<T: HasInterner<Interner = Interner>>(
pub struct CallableSig {
params_and_return: Arc<[Ty]>,
is_varargs: bool,
legacy_const_generics_indices: Arc<[u32]>,
}
has_interner!(CallableSig);
@ -228,11 +227,7 @@ pub type PolyFnSig = Binders<CallableSig>;
impl CallableSig {
pub fn from_params_and_return(mut params: Vec<Ty>, ret: Ty, is_varargs: bool) -> CallableSig {
params.push(ret);
CallableSig {
params_and_return: params.into(),
is_varargs,
legacy_const_generics_indices: Arc::new([]),
}
CallableSig { params_and_return: params.into(), is_varargs }
}
pub fn from_fn_ptr(fn_ptr: &FnPointer) -> CallableSig {
@ -249,14 +244,9 @@ impl CallableSig {
.map(|arg| arg.assert_ty_ref(Interner).clone())
.collect(),
is_varargs: fn_ptr.sig.variadic,
legacy_const_generics_indices: Arc::new([]),
}
}
pub fn set_legacy_const_generics_indices(&mut self, indices: &[u32]) {
self.legacy_const_generics_indices = indices.into();
}
pub fn to_fn_ptr(&self) -> FnPointer {
FnPointer {
num_binders: 0,
@ -287,11 +277,7 @@ impl Fold<Interner> for CallableSig {
) -> Result<Self::Result, E> {
let vec = self.params_and_return.to_vec();
let folded = vec.fold_with(folder, outer_binder)?;
Ok(CallableSig {
params_and_return: folded.into(),
is_varargs: self.is_varargs,
legacy_const_generics_indices: self.legacy_const_generics_indices,
})
Ok(CallableSig { params_and_return: folded.into(), is_varargs: self.is_varargs })
}
}

View File

@ -1364,10 +1364,7 @@ fn fn_sig_for_fn(db: &dyn HirDatabase, def: FunctionId) -> PolyFnSig {
.with_type_param_mode(ParamLoweringMode::Variable);
let ret = ctx_ret.lower_ty(&data.ret_type);
let generics = generics(db.upcast(), def.into());
let mut sig = CallableSig::from_params_and_return(params, ret, data.is_varargs());
if !data.legacy_const_generics_indices.is_empty() {
sig.set_legacy_const_generics_indices(&data.legacy_const_generics_indices);
}
let sig = CallableSig::from_params_and_return(params, ret, data.is_varargs());
make_binders(db, &generics, sig)
}