Skip to content

Commit e14e582

Browse files
committed
fix: Nomarlize the relative path for bin target
1 parent ad389f0 commit e14e582

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/cargo/util/toml/targets.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use std::fs::{self, DirEntry};
1515
use std::path::{Path, PathBuf};
1616

1717
use anyhow::Context as _;
18+
use cargo_util::paths;
1819
use cargo_util_schemas::manifest::{
1920
PathValue, StringOrBool, StringOrVec, TomlBenchTarget, TomlBinTarget, TomlExampleTarget,
2021
TomlLibTarget, TomlManifest, TomlTarget, TomlTestTarget,
@@ -315,7 +316,9 @@ fn to_bin_targets(
315316

316317
let mut result = Vec::new();
317318
for bin in bins {
318-
let path = package_root.join(&bin.path.as_ref().expect("previously normalized").0);
319+
let path = package_root.join(paths::normalize_path(
320+
&bin.path.as_ref().expect("previously normalized").0,
321+
));
319322
let mut target = Target::bin_target(
320323
name_or_panic(bin),
321324
bin.filename.clone(),

tests/testsuite/binary_name.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ fn bin_target_with_relative_path() {
372372
.with_stderr_data(str![[r#"
373373
[CHECKING] relative-bar v0.1.0 ([ROOT]/foo/relative-bar)
374374
[WARNING] unused variable: `a`
375-
--> relative-bar/./src/main.rs:1:17
375+
--> relative-bar/src/main.rs:1:17
376376
|
377377
1 | fn main() { let a = 1; }
378378
| ^ [HELP] if this is intentional, prefix it with an underscore: `_a`

0 commit comments

Comments
 (0)