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

E0417: Destructor unknown type

CodeCategoryStability
E0417Struct and enumPermanent

Explanation

A top-level drop fn names a type that is not a struct defined in the same module. Destructor target lookup is module-local, so a struct elsewhere in the program does not satisfy the declaration.

Likely cause

The type name is misspelled, the struct declaration is missing from this module, or the name denotes a non-struct type. Declare the struct in the same module and make the destructor's type name match it exactly.

Examples

Destructor for an unknown type

drop fn Resource(self) {}
fn main() -> i32 { 0 }

Define the destructor's struct type

struct Resource { value: i32 }
drop fn Resource(self) {}
fn main() -> i32 { 0 }

References