E3034

E3034 — A comptime block inside another one. The outer block already runs at compile time, so the inner one asks for nothing extra, and nesting them is what made a block's value depend on evaluating a closure defined inside another block.

What the compiler reports

Error[E3034]{{.*}}inside another one

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 `comptime` block inside another one is refused.
//
// The outer block already runs while compiling, so the inner one asks for nothing extra.
// Allowing it is what put a closure's body out of reach: a block declared inside another
// block had a value that needed calling a closure declared alongside it.
//

fn main() -> i32 {
  let n = comptime {
    let inner = comptime {
      3
    };
    inner + 1
  };
  return 0;
}

From tests/frontend/fail/comptime_block_nested.vx, which asserts this diagnostic on every commit.

Related