Skip to content

Commit db2a7b2

Browse files
authored
feat: cargo-prove informative error for non standard cargo target dir (#2478)
1 parent 8c21a04 commit db2a7b2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

crates/build/src/command/docker.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,13 @@ pub(crate) fn create_docker_command(
7676

7777
// Get the target directory for the ELF in the context of the Docker container.
7878
let relative_target_dir =
79-
(program_metadata.target_directory).strip_prefix(workspace_root).unwrap();
79+
program_metadata.target_directory.strip_prefix(workspace_root).with_context(|| {
80+
format!(
81+
"Cargo target directory ({}) must be a child of the workspace directory ({}).\n\
82+
This can happen if CARGO_TARGET_DIR is set to a location outside the workspace.",
83+
program_metadata.target_directory, workspace_root
84+
)
85+
})?;
8086
let target_dir = format!(
8187
"/root/program/{}/{}/{}",
8288
relative_target_dir,

0 commit comments

Comments
 (0)