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

E0305: Interface bound not satisfied

CodeCategoryStability
E0305SemanticPermanent

Explanation

A comptime type argument does not have an asserted conformance satisfying an interface bound. Having matching inherent members alone does not establish declared conformance.

Likely cause

The concrete type needs a conformance assertion, or an enclosing generic parameter needs the required interface in its own bound. Follow the diagnostic's suggested assertion or bound addition.

Examples

Matching member without an assertion

Requires --preview interfaces.

interface Show { fn show(borrow self) -> i64; }
struct Value { fn show(borrow self) -> i64 { 42 } }
fn read(comptime T: Show, borrow x: T) -> i64 { x.show() }
fn main() -> i32 { @intCast(read(Value, borrow Value {})) }

Assert conformance

Requires --preview interfaces.

interface Show { fn show(borrow self) -> i64; }
struct Value is Show { fn show(borrow self) -> i64 { 42 } }
fn read(comptime T: Show, borrow x: T) -> i64 { x.show() }
fn main() -> i32 { @intCast(read(Value, borrow Value {})) }

References