makepad/libs/relax/compiler/tests/modules/host_hook_repro.rs
Admin b22a714840 makepad run: the Rust JIT (libs/relax) and makepad-remote
The JIT that runs makepad apps from source: lexer, front end, type checker,
lazy borrow checker (Gandalf; `--check-first` opts in), codegen, session and
warm/cold caches keyed by compiler stamp, provided crates bound late,
startup images, live patching. User-facing name is `makepad run` (binary
`makepad`, MAKEPAD_RUN_* env, ~/.makepad-run); libs/relax stays the internal
library name. `makepad check` reports rustc-style diagnostics with rustc
error codes and checks a whole workspace (`--workspace`). Runs on macOS,
Linux, Windows and Android. makepad-remote: one tool schema for apps and the
WM (app/1): grabs, captures, traces, frame profiles and tweaks.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 12:26:21 +02:00

19 lines
795 B
Rust

// Standalone Relax regression reproducer, not a Cargo integration test.
// Run with `makepad test <this file>` on node165; see VALIDATION.md.
// It must load successfully even after a host has used catch_unwind.
#[test]
fn load_after_host_catch() {
std::panic::catch_unwind(|| ()).unwrap();
let module = std::relax::Module::load_source("after_catch", "after_catch.rs", r#"
pub fn copy(values: &mut [f64]) {
let mut v = vec![0.0; values.len()];
v.copy_from_slice(values);
values.copy_from_slice(&v);
}
"#, &[]).unwrap();
let copy: fn(&mut [f64]) = module.get("copy").unwrap();
let mut values = [1.0, 2.0];
std::relax::guard(20, || copy(&mut values)).unwrap();
assert_eq!(values, [1.0, 2.0]);
module.unload();
}