1
Fork 0

Rollup merge of #117871 - klensy:unused-pub, r=cjgillot

remove unused pub fns

This removes some unused `pub fn`; also fixes few obsoleted fn names or added fixmes with reminders to update them.
This commit is contained in:
Guillaume Gomez 2023-11-25 19:51:54 +01:00 committed by GitHub
commit 9a59b059d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 5 additions and 248 deletions

View file

@ -256,13 +256,13 @@ where
}
/// Iterates over all fields of an array. Much more efficient than doing the
/// same by repeatedly calling `operand_index`.
/// same by repeatedly calling `project_index`.
pub fn project_array_fields<'a, P: Projectable<'tcx, M::Provenance>>(
&self,
base: &'a P,
) -> InterpResult<'tcx, ArrayIterator<'tcx, 'a, M::Provenance, P>> {
let abi::FieldsShape::Array { stride, .. } = base.layout().fields else {
span_bug!(self.cur_span(), "operand_array_fields: expected an array layout");
span_bug!(self.cur_span(), "project_array_fields: expected an array layout");
};
let len = base.len(self)?;
let field_layout = base.layout().field(self, 0);

View file

@ -1023,36 +1023,3 @@ pub fn promote_candidates<'tcx>(
promotions
}
/// This function returns `true` if the function being called in the array
/// repeat expression is a `const` function.
pub fn is_const_fn_in_array_repeat_expression<'tcx>(
ccx: &ConstCx<'_, 'tcx>,
place: &Place<'tcx>,
body: &Body<'tcx>,
) -> bool {
match place.as_local() {
// rule out cases such as: `let my_var = some_fn(); [my_var; N]`
Some(local) if body.local_decls[local].is_user_variable() => return false,
None => return false,
_ => {}
}
for block in body.basic_blocks.iter() {
if let Some(Terminator { kind: TerminatorKind::Call { func, destination, .. }, .. }) =
&block.terminator
{
if let Operand::Constant(box ConstOperand { const_, .. }) = func {
if let ty::FnDef(def_id, _) = *const_.ty().kind() {
if destination == place {
if ccx.tcx.is_const_fn(def_id) {
return true;
}
}
}
}
}
}
false
}