E3027
E3027 — A function whose return type is a closure. A closure value points into the frame that made it, so it cannot outlive that frame yet.
What the compiler reports
E3027{{.*}}function 'make' returns a closure
The fragments the test suite holds the compiler to. An ellipsis marks text the test does not constrain; the emitted message also carries a source location.
A program that triggers it
//
// A closure value points into the frame that made it. Passing one down is fine, the frame is
// alive; returning one, so that it outlives its frame, is refused until a closure can own its
// environment.
fn make() -> ||->i32 {
let n = 42;
let c = || n;
return c as ||->i32;
}
fn main() -> i32 {
return 0;
}
From tests/frontend/fail/returning_a_closure.vx, which asserts this diagnostic on every commit.
Related
A tour of VxThe chapter covering the rule this code enforces.
All diagnosticsEvery code the compiler can emit, grouped by stage.
E3026A placement query (
.topology()) the checker cannot decide. Placement is a fact of the receiver's type, compared with Some(Topology::..) or None; it has no run-time value.
E3028A function with a non-void return type whose body can complete without returning. Reported here rather than left to codegen, where it surfaced as an MLIR verifier message naming an operation, with no source location.