slint-ui/slint · error
Using workspace .workspace = true in workspace
Error message
Using workspace {}.workspace = true in workspace What it means
check_and_fix_package_string_field found that the workspace root manifest sets `field.workspace = true` inside its own workspace/package section. Inheritance flags only make sense in member crates; the workspace root must hold the concrete value, so this configuration is contradictory and the check fails immediately (no auto-fix).
Solutions
- Replace `field = { workspace = true }` in [workspace.package] with the concrete value (e.g. version = "1.2.3" or the required license string).
- Run the check with --fix after correcting other files; this specific error is never auto-fixed, so edit the root Cargo.toml manually.
- Audit how the field got there: revert the copy-paste of member package tables into the workspace root.
- Ensure expected_str (the canonical value) is written directly in [workspace.package] so downstream member inheritance resolves.
Example fix
// before: root Cargo.toml
[workspace.package]
version = { workspace = true }
// after
[workspace.package]
version = "1.2.3" Defensive patterns
Strategy: validation
Validate before calling
fn root_uses_inheritance(doc: &toml_edit::DocumentMut, field: &str) -> bool {
doc.as_table().get("workspace")
.and_then(|w| w.get("package"))
.and_then(|p| p.get(field))
.and_then(|f| f.get("workspace")).and_then(|v| v.as_bool())
.unwrap_or(false)
}
// fail fast before the check: if root_uses_inheritance(&doc, "version") { bail!("workspace root must hold concrete values") } Try / catch
match result {
Err(e) if e.to_string().starts_with("Using workspace ") => {
anyhow::bail!("workspace root Cargo.toml must not use field.workspace = true; write the concrete value in [workspace.package]")
}
other => other,
} Prevention
- Never copy a member's inherited fields ({ workspace = true }) into [workspace.package].
- When promoting a member manifest to a workspace root, convert inherited fields to concrete values.
- Add a lint/test asserting the root manifest contains only concrete package values.
- Review automated TOML edits before committing them.
When it happens
Trigger: The manifest is a workspace root (is_workspace() == true) and its package section's field (e.g. version or license) is a table carrying workspace = true, typically produced by blindly copying a member crate's inherited field into the root.
Common situations: A script or editor applied `version = { workspace = true }` to the workspace root; a member Cargo.toml was promoted to workspace root without converting inherited fields back to concrete values; copy-paste of a member's package section into [workspace.package].
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- Incorrect .workspace found: expected true, found false
- Invalid Cargo.toml -- cannot find package section
- Invalid Cargo.toml -- cannot find workspace package section…
- Not a workspace, can not extract version info.
- cargo failed
AI-assisted analysis of slint-ui/slint@3a7e700487 (2026-09-16).
Data as JSON: /api/errors/7773992cfd7afb75.
Report an issue: GitHub.
Appendix: source
Thrown at xtask/src/license_headers_check.rs:860
})
})
.collect(),
None => Vec::new(),
}
}
fn check_and_fix_package_string_field<'a>(
&mut self,
fix_it: bool,
field: &'a str,
expected_str: &'a str,
) -> Result<()> {
let is_workspace = self.is_workspace();
match self.package()?.get(field) {
Some(field_value) => {
match field_value.get("workspace").and_then(|v| v.as_bool()) {
Some(true) if is_workspace => {
return Err(anyhow!(
"Using workspace {}.workspace = true in workspace",
field
));
}
Some(true) => { /* nothing to do */ }
Some(false) => {
if fix_it {
eprintln!(
"Fixing up {:?} as instructed. It has {field}.workspace = false",
self.path
);
self.doc["package"][field]["workspace"] = toml_edit::value(true);
self.edited = true;
} else {
return Err(anyhow!(
"Incorrect {}.workspace found: expected true, found false",
field,
));View on GitHub (pinned to 3a7e700487)