diff options
| author | klensy <klensy@users.noreply.github.com> | 2023-11-13 23:43:23 +0300 |
|---|---|---|
| committer | klensy <klensy@users.noreply.github.com> | 2023-11-23 14:11:08 +0300 |
| commit | b06d5b205c0ef74dc7c4a169b543433c7d29de72 (patch) | |
| tree | 57403a94dff7a8288e63c4a03ca167d2185cc21f /compiler/rustc_const_eval/src/transform | |
| parent | aff6c741d466610576b02fde72d139aa8c6ec0a8 (diff) | |
| download | rust-b06d5b205c0ef74dc7c4a169b543433c7d29de72.tar.gz rust-b06d5b205c0ef74dc7c4a169b543433c7d29de72.zip | |
few more
Diffstat (limited to 'compiler/rustc_const_eval/src/transform')
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/promote_consts.rs | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/compiler/rustc_const_eval/src/transform/promote_consts.rs b/compiler/rustc_const_eval/src/transform/promote_consts.rs index 66b813e4e59..8b2ea2dc21d 100644 --- a/compiler/rustc_const_eval/src/transform/promote_consts.rs +++ b/compiler/rustc_const_eval/src/transform/promote_consts.rs @@ -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 -} |
