You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: mod.rs
    path of file: ./repos/uiua/src/primitive
    
    the code of the file until where you have to start completion: //! Primitive definitions and top-level implementations
//!
//! For the meat of the actual array algorithms, see [`crate::algorithm`].

mod defs;
pub use defs::*;
use ecow::EcoString;

use std::{
    borrow::{BorrowMut, Cow},
    cell::RefCell,
    f64::{
        consts::{PI, TAU},
        INFINITY,
    },
    fmt::{self},
    sync::{
        atomic::{self, AtomicUsize},
        OnceLock,
    },
};
    
fn stack_boundaries(env: &Uiua) -> Vec<(usize, &FunctionId)> {
    let mut boundaries: Vec<(usize, &FunctionId)> = Vec::new();
    let mut height = 0;
    let mut reduced = 0;
    for (i, frame) in env.call_frames().rev().enumerate() {
        if i == 0 {
            let before_sig = instrs_signature(&env.instrs(frame.slice)[..frame.pc])
                .ok()
                .unwrap_or(frame.sig);
            reduced = before_sig.args as isize - before_sig.outputs as isize;
        }
        height = height.max(((frame.sig.args as isize) - reduced).max(0) as usize);
        if matches!(frame.id, FunctionId::Main) {
            break;
        }
        boundaries.push((env.stack_height().saturating_sub(height), &frame.id));
    }
    boundaries
}