slint-ui/slint · error
Components written in Rust can not get embedded yet.
Error message
Components written in Rust can not get embedded yet.
What it means
Error "Components written in Rust can not get embedded yet." thrown in slint-ui/slint.
Source
Thrown at internal/compiler/generator/rust.rs:2317
quote!(SharedGlobals::new(sp::VRc::downgrade(&self_dyn_rc)))
};
// The root component owns the freshly created `SharedGlobals` and is responsible for running
// its eager initialization. The root's own `globals` field must be set *before* that init
// runs, because a global binding (e.g. `Palette.color-scheme`) may resolve the root's window
// adapter through `globals` during evaluation. Popups and sub-components receive an already
// initialized `SharedGlobals`, so they skip this step.
let set_and_init_globals = if is_root_component {
quote!(
let _ = sp::VRc::map(self_rc.clone(), |x| x).as_pin_ref().globals.set(globals.clone());
globals.init_globals();
)
} else {
quote!()
};
let globals_arg = is_popup.then(|| quote!(globals: sp::Rc<SharedGlobals>));
let embedding_function = if parent_ctx.is_some() {
quote!(todo!("Components written in Rust can not get embedded yet."))
} else {
quote!(false)
};
let parent_item_expression = parent_ctx.map(|parent| parent.repeater_index.map_or_else(|| {
// No repeater index, this could be a PopupWindow
quote!{
if let Some(parent_rc) = self.parent.clone().upgrade() {
let parent_origin = sp::VRcMapped::origin(&parent_rc);
// TODO: store popup index in ctx and set it here instead of 0?
*_result = sp::ItemRc::new_root(parent_origin).downgrade();
}
}
}, |idx| {
let current_sub_component = &root.sub_components[parent.sub_component];
let sub_component_offset = current_sub_component.repeated[idx].index_in_tree;
quote!{View on GitHub (pinned to 3fd8f2ec03)
Solutions
- Write the component in .slint instead of pure Rust to allow embedding.
- Avoid embedding Rust-only components.
When it happens
Trigger: Thrown at internal/compiler/generator/rust.rs:2317 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of slint-ui/slint@3fd8f2ec03 (2026-08-19).
Data as JSON: /api/errors/7f56381019adb535.
Report an issue: GitHub.