Ruta graveolens  ·  notes from a language experiment  ·  cultivated since 2025

E0306: Bound is not an interface

CodeCategoryStability
E0306SemanticPermanent

Explanation

A conformance assertion, refinement, or interface bound names an entity that is not an interface. An ordinary concrete type cannot be used as an interface requirement.

Likely cause

A struct, enum, or primitive type was supplied where an interface name is required. Use a declared interface, or use comptime T: type for an unbounded type parameter.

Examples

Concrete type used as a bound

Requires --preview interfaces.

struct Concrete {}
fn accept(comptime T: Concrete, borrow x: T) {}
fn main() {}

Use an interface bound

Requires --preview interfaces.

interface Marker { fn mark(borrow self); }
fn accept(comptime T: Marker, borrow x: T) {}
fn main() {}

References