diff --git a/src/cargo/ops/cargo_package.rs b/src/cargo/ops/cargo_package.rs index 679883e4f..1493f4847 100644 --- a/src/cargo/ops/cargo_package.rs +++ b/src/cargo/ops/cargo_package.rs @@ -229,6 +229,8 @@ fn build_ar_list( ) -> CargoResult> { let mut result = Vec::new(); let root = pkg.root(); + + let mut manifest_found = false; for src_file in src_files { let rel_path = src_file.strip_prefix(&root)?.to_path_buf(); check_filename(&rel_path, &mut ws.config().shell())?; @@ -242,6 +244,7 @@ fn build_ar_list( "Cargo.toml" | // normalize for case insensitive filesystems (like on Windows) "cargo.toml" => { + manifest_found = true; result.push(ArchiveFile { rel_path: PathBuf::from(ORIGINAL_MANIFEST_FILE), rel_str: ORIGINAL_MANIFEST_FILE.to_string(), @@ -267,6 +270,13 @@ fn build_ar_list( } } } + if !manifest_found { + ws.config().shell().warn(&format!( + "no `Cargo.toml` file found when packaging `{}` (note the case of the file name).", + pkg.name() + ))?; + } + if pkg.include_lockfile() { result.push(ArchiveFile { rel_path: PathBuf::from("Cargo.lock"), diff --git a/tests/testsuite/package.rs b/tests/testsuite/package.rs index 414073ea2..964d61616 100644 --- a/tests/testsuite/package.rs +++ b/tests/testsuite/package.rs @@ -3069,6 +3069,7 @@ fn no_manifest_found() { "\ [WARNING] manifest has no documentation[..] See [..] +[WARNING] no `Cargo.toml` file found when packaging `foo` (note the case of the file name). [PACKAGING] foo v0.0.1 ([CWD]) [VERIFYING] foo v0.0.1 ([CWD]) [COMPILING] foo v0.0.1 ([CWD][..])