slint-ui/slint · error
no `enum ` in
Error message
no `enum {name}` in {} What it means
parse_rust_enum searches the parsed file for a top-level enum with the requested name and panics when find_map yields nothing. It is a structural guard: the expected `enum {name}` is absent from that file, meaning the enum was renamed, moved to another module, or deleted while the build script still points at the old location/name.
Solutions
- Confirm the enum named {name} still exists in the referenced source file; it may have been renamed or removed
- Update the path passed to parse_rust_enum from generate_window_event_module if the enum moved to another module
- If the enum was renamed, rename the lookup string in the build script to match
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at api/node/build.rs:562 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16).
Data as JSON: /api/errors/5d34a663a6e0badc.
Report an issue: GitHub.
Appendix: source
Thrown at api/node/build.rs:562
js_name: Option<String>,
/// Last segment of the field's type path.
ty: String,
docs: Vec<String>,
}
fn parse_rust_enum(path: &std::path::Path, name: &str) -> RustEnum {
let source = std::fs::read_to_string(path)
.unwrap_or_else(|err| panic!("cannot read {}: {err}", path.display()));
let file = syn::parse_file(&source)
.unwrap_or_else(|err| panic!("cannot parse {}: {err}", path.display()));
let item = file
.items
.iter()
.find_map(|item| match item {
syn::Item::Enum(item) if item.ident == name => Some(item),
_ => None,
})
.unwrap_or_else(|| panic!("no `enum {name}` in {}", path.display()));
RustEnum {
docs: doc_lines(&item.attrs),
attrs: item.attrs.clone(),
variants: item
.variants
.iter()
.map(|variant| RustVariant {
name: variant.ident.to_string(),
docs: doc_lines(&variant.attrs),
hidden: is_doc_hidden(&variant.attrs),
fields: variant
.fields
.iter()
.map(|field| RustField {
name: field.ident.as_ref().map(|ident| ident.to_string()),
js_name: napi_arg(&field.attrs, "js_name"),
ty: type_name(&field.ty),View on GitHub (pinned to bb937076de)