Skip to content

Commit 5bcf4cc

Browse files
committed
fix(script): Don't sanitize scripts named 'test'
This was discussed in the cargo team meeting: - This is a `bin` and so what name is used to access it is of little importance - We don't sanitize other sysroot package names
1 parent 505500f commit 5bcf4cc

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/cargo/util/toml/embedded.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ pub fn sanitize_name(name: &str) -> String {
6565
} else if restricted_names::is_conflicting_artifact_name(&name) {
6666
// Being an embedded manifest, we always assume it is a `[[bin]]`
6767
name.push(placeholder);
68-
} else if name == "test" {
69-
name.push(placeholder);
7068
} else {
7169
break;
7270
}

tests/testsuite/script/cargo.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -705,16 +705,16 @@ fn test_name_is_sysroot_package_name() {
705705
p.cargo("-Zscript -v ./test")
706706
.masquerade_as_nightly_cargo(&["script"])
707707
.with_stdout_data(str![[r#"
708-
current_exe: [ROOT]/home/.cargo/build/[HASH]/target/debug/test-[EXE]
708+
current_exe: [ROOT]/home/.cargo/build/[HASH]/target/debug/test[EXE]
709709
arg0: [..]
710710
args: []
711711
712712
"#]])
713713
.with_stderr_data(str![[r#"
714714
[WARNING] `package.edition` is unspecified, defaulting to `2024`
715-
[COMPILING] test- v0.0.0 ([ROOT]/foo/test)
715+
[COMPILING] test v0.0.0 ([ROOT]/foo/test)
716716
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
717-
[RUNNING] `[ROOT]/home/.cargo/build/[HASH]/target/debug/test-[EXE]`
717+
[RUNNING] `[ROOT]/home/.cargo/build/[HASH]/target/debug/test[EXE]`
718718
719719
"#]])
720720
.run();

0 commit comments

Comments
 (0)