E3028
E3028 — A 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.
What the compiler reports
E3028{{.*}}'finishes' is declared `-> !`, so it must never return, but its body can finish
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
//
// Part of the Vx Project, under the Apache License v2.0 with LLVM Exceptions.
// See LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// A function declared `-> !` must not return: not by reaching the end of its body, and not with
// `return`.
//
fn finishes(x : i32) -> ! {
if x > 0 {
panic("positive");
}
}
fn returns() -> ! {
return;
}
fn main() -> i32 {
return 0;
}
From tests/frontend/fail/never_returning_function_that_returns.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.
E3029A type name in a signature that names no declaration. An unknown name in type position parses as a user nominal, so without this a typo — or a type constructor removed from the language — compiled silently and did nothing.