Skip to content

Commit bb81d39

Browse files
crumplecupCopilot
andcommitted
fix(proof-crate-gen): emit description and inherit all workspace pkg fields
Generated proof crates now include: - description: inherited from workspace if present, otherwise synthesized as 'Formal verification proof harnesses for {source_crate}' - all other publishable workspace fields (repository, authors, homepage, documentation, readme, keywords, categories) inherited automatically This ensures generated crates like elicit_proofs satisfy crates.io publishing requirements without any manual editing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2dc8d54 commit bb81d39

1 file changed

Lines changed: 30 additions & 7 deletions

File tree

crates/elicitation/src/cli/generate/proof_crate_gen.rs

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ pub fn generate_proof_crate(
117117
"Cargo.toml",
118118
&render_cargo_toml(
119119
&proof_name,
120+
&sources[0].name,
120121
&source_dep_lines,
121122
elicitation_rel.as_deref(),
122123
creusot_std_rel.as_deref(),
@@ -362,6 +363,7 @@ fn patch_module_tree_kani_reexports(
362363

363364
fn render_cargo_toml(
364365
proof_name: &str,
366+
primary_source: &str,
365367
source_dep_lines: &[&str],
366368
elicitation_rel: Option<&Path>,
367369
creusot_std_rel: Option<&Path>,
@@ -382,17 +384,38 @@ fn render_cargo_toml(
382384
} else {
383385
"edition = \"2024\"".to_string()
384386
};
385-
let license_field = if has_wpkg("license") {
386-
Some("license.workspace = true".to_string())
387+
388+
// description is required by crates.io; inherit from workspace or synthesize
389+
let description_field = if has_wpkg("description") {
390+
"description.workspace = true".to_string()
387391
} else {
388-
None
392+
format!(
393+
"description = \"Formal verification proof harnesses for {}\"",
394+
primary_source
395+
)
389396
};
390397

398+
// Optional publishable fields — inherit from workspace when present
399+
let optional_fields: &[&str] = &[
400+
"license",
401+
"license-file",
402+
"repository",
403+
"authors",
404+
"homepage",
405+
"documentation",
406+
"readme",
407+
"keywords",
408+
"categories",
409+
];
410+
let inherited: Vec<String> = optional_fields
411+
.iter()
412+
.filter(|&&f| has_wpkg(f))
413+
.map(|&f| format!("{f}.workspace = true"))
414+
.collect();
415+
391416
let pkg_fields = {
392-
let mut parts = vec![version_field, edition_field];
393-
if let Some(l) = license_field {
394-
parts.push(l);
395-
}
417+
let mut parts = vec![version_field, edition_field, description_field];
418+
parts.extend(inherited);
396419
parts.join("\n")
397420
};
398421

0 commit comments

Comments
 (0)