1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! Compile-fail tests pinning structural invariants of the curated
//! `lean_rs::*` / `lean_rs_host::*` surface:
//!
//! 1. Semantic handles cannot outlive the `LeanRuntime` borrow that
//! anchors their `'lean` lifetime.
//! 2. `LeanRuntime`, `LeanSession`, and the semantic handles are
//! neither [`Send`] nor [`Sync`], so a Lean-derived value cannot
//! travel to another OS thread.
//! 3. A `LeanSession` cannot outlive the `LeanCapabilities` borrow it
//! was opened from, and a `PooledSession` cannot outlive its
//! `SessionPool`—each handle borrows its parent and is bounded by it.
//!
//! Each negative case is a standalone `.rs` file with a matching
//! `.stderr` snapshot. The snapshots capture `rustc` diagnostics, whose
//! exact wording and whitespace drift across platforms and toolchain
//! versions (different on-disk `$RUST/core/src` line wraps, different
//! note-position heuristics between Linux and macOS), so the suite runs
//! only when `RUN_TRYBUILD=1` is set. The pinned `compile-fail` CI job
//! sets it on a single OS + the repo's pinned stable toolchain, so the
//! snapshots are stable there; the type markers plus consumer `cargo
//! check` remain the enforcement everywhere else. Regenerate after a
//! refactor or toolchain bump with:
//!
//! ```sh
//! TRYBUILD=overwrite RUN_TRYBUILD=1 \
//! cargo test -p lean-rs-host --test compile_fail_surface
//! ```