#438·evcxr

Panic on Bizarre Broken Code involving Closures

Author: eliminmaxCreated Feb 15, 2026Updated Feb 15, 2026

Install Info: (Debian 13 amd64, Rust 1.93.1 installed via rustup, evcxr_repl 0.21.1)

The following caused the REPL to panic:

rust
let rf {
let f0 = || || || || || || || || ..;
let f1 = f0();
let f2 = f1();
let f3 = f2();
let f4 = f3();
let f5 = f4();
let f6 = f5();
let f7 = f6();
f7()
}

The ContextState in the panic message, when running that snippet in a fresh REPL:

ContextState { items_by_name: {}, unnamed_items: [], external_deps: {}, extern_crate_stmts: {}, variable_states: {}, stored_variable_states: {}, attributes: {}, async_mode: false, allow_question_mark: false, build_num: 2, config: Config { tmpdir: "redacted", debug_mode: false, preserve_vars_on_panic: true, output_format: "{:?}", display_types: false, display_final_expression: true, expand_use_statements: true, opt_level: "2", error_fmt: ErrorFormat { format_str: "{}", format_trait: "std::fmt::Display" }, time_passes: false, linker: "lld", codegen_backend: None, sccache: None, offline_mode: false, toolchain: "", cargo_path: "/home/eliminmax/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo", rustc_path: "/home/eliminmax/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc", cache_bytes: 0, core_extern: "core=/home/eliminmax/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-8b70f92045177692.so", target: "x86_64-unknown-linux-gnu", allow_static_linking: true, build_envs: {}, subprocess_path: "/home/eliminmax/.cargo/bin/evcxr" } }

I found that because I was bored and aimlessly messing around with closures that return closures, and forgot to type the = in the let expression.

I was able to reduce it to just the following:

rust
let r { let f = || ..; f() }