diff --git a/src/compiler/rust.rs b/src/compiler/rust.rs index dca3ddf9e..3caa6a1c9 100644 --- a/src/compiler/rust.rs +++ b/src/compiler/rust.rs @@ -1896,6 +1896,17 @@ impl pkg::InputsPackager for RustInputsPackager { let dist_input_path = path_transformer.as_dist(&input_path).with_context(|| { format!("unable to transform input path {}", input_path.display()) })?; + + if input_path.ends_with("src/lib.rs") { + let cargo_toml_path = input_path.parent().expect("No parent").parent().expect("No parent").join("Cargo.toml"); + if cargo_toml_path.is_file() { + let dist_cargo_toml_path = path_transformer.as_dist(&cargo_toml_path).with_context(|| { + format!("unable to transform input path {}", cargo_toml_path.display()) + })?; + tar_inputs.push((cargo_toml_path, dist_cargo_toml_path)) + } + } + tar_inputs.push((input_path, dist_input_path)) }