slint-ui/slint · error

Missing description field

Error message

Missing description field

What it means

check_cargo_toml requires every crate's [package] to include a description field. It checks several fields via check_and_fix_package_string_field, then explicitly errors if package["description"] is absent (this one is not auto-fixed).

Solutions

  1. Add a `description = "..."` line to the [package] table of the offending Cargo.toml
  2. Add `description.workspace = true` if a workspace-level description inheritance is used in this repo
  3. Run `cargo xtask check` again to confirm

Example fix

// before
[package]
name = "my-crate"
// after
[package]
name = "my-crate"
description = "Short description of the crate"
Defensive patterns

Strategy: validation

Validate before calling

let t: toml::Value = toml::from_str(&std::fs::read_to_string("Cargo.toml")?)?;
assert!(t["package"].get("description").is_some(), "[package] missing description");

Type guard

fn has_description(doc: &toml::Value) -> bool {
    doc["package"]["description"].is_str()
}

Prevention

When it happens

Trigger: Running `cargo xtask check` on a crate whose Cargo.toml [package] table has no `description` key. Note this error fires even with --fix, since only existence is checked here.

Common situations: Newly scaffolded crates; crates copied from templates without description; fields deleted while cleaning up Cargo.toml.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of slint-ui/slint@3a7e700487 (2026-09-16). Data as JSON: /api/errors/ef8808aa8f2da67a. Report an issue: GitHub.

Appendix: source

Thrown at xtask/src/license_headers_check.rs:1028

            self.check_dependencies(&doc, &expected_version)?;

            return Ok(());
        }

        doc.check_and_fix_package_string_field(self.fix_it, "license", license)?;

        if !doc.published()? {
            // Skip further tests for package that are not published
            return doc.save_if_changed();
        }

        if doc.check_and_fix_package_string_field(false, "homepage", ALLOWED_HOMEPAGE).is_err() {
            doc.check_and_fix_package_string_field(self.fix_it, "homepage", EXPECTED_HOMEPAGE)?;
        }
        doc.check_and_fix_package_string_field(self.fix_it, "repository", EXPECTED_REPOSITORY)?;

        if doc.package()?["description"].is_none() {
            return Err(anyhow!("Missing description field"));
        }

        // Check that version of slint- dependencies are matching this version
        let expected_version = {
            let wv = self.workspace_version.borrow().clone();
            doc.package()?
                .get("version")
                .and_then(|v| v.as_value())
                .and_then(|v| v.as_str())
                .unwrap_or(&wv)
                .to_string()
        };

        self.check_dependencies(&doc, &expected_version)?;

        // Check that a LICENSES directory exists with the right symlinks
        let crate_dir = path.parent().unwrap();
        self.check_licenses_dir(crate_dir, license)?;

View on GitHub (pinned to 3a7e700487)