Skip to content

Commit 3166e5f

Browse files
committed
fix(package): Warn when manifest is not more generally found
Being a bit cautious about not turning this into an error since this is most likely because of case insensitive filesystems.
1 parent f4c97b2 commit 3166e5f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/cargo/ops/cargo_package.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ fn build_ar_list(
229229
) -> CargoResult<Vec<ArchiveFile>> {
230230
let mut result = Vec::new();
231231
let root = pkg.root();
232+
233+
let mut manifest_found = false;
232234
for src_file in src_files {
233235
let rel_path = src_file.strip_prefix(&root)?.to_path_buf();
234236
check_filename(&rel_path, &mut ws.config().shell())?;
@@ -242,6 +244,7 @@ fn build_ar_list(
242244
"Cargo.toml" |
243245
// normalize for case insensitive filesystems (like on Windows)
244246
"cargo.toml" => {
247+
manifest_found = true;
245248
result.push(ArchiveFile {
246249
rel_path: PathBuf::from(ORIGINAL_MANIFEST_FILE),
247250
rel_str: ORIGINAL_MANIFEST_FILE.to_string(),
@@ -267,6 +270,13 @@ fn build_ar_list(
267270
}
268271
}
269272
}
273+
if !manifest_found {
274+
ws.config().shell().warn(&format!(
275+
"no `Cargo.toml` file found when packaging `{}` (note the case of the file name).",
276+
pkg.name()
277+
))?;
278+
}
279+
270280
if pkg.include_lockfile() {
271281
result.push(ArchiveFile {
272282
rel_path: PathBuf::from("Cargo.lock"),

tests/testsuite/package.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3069,6 +3069,7 @@ fn no_manifest_found() {
30693069
"\
30703070
[WARNING] manifest has no documentation[..]
30713071
See [..]
3072+
[WARNING] no `Cargo.toml` file found when packaging `foo` (note the case of the file name).
30723073
[PACKAGING] foo v0.0.1 ([CWD])
30733074
[VERIFYING] foo v0.0.1 ([CWD])
30743075
[COMPILING] foo v0.0.1 ([CWD][..])

0 commit comments

Comments
 (0)