mirror of
https://github.com/rust-lang/cargo
synced 2024-10-13 19:22:33 +00:00
fix(embedded): Don't generate empty package names
This commit is contained in:
parent
87be661989
commit
7d4e39c4f5
|
@ -100,6 +100,9 @@ pub fn sanitize_package_name(name: &str, placeholder: char) -> String {
|
|||
slug.push(placeholder);
|
||||
}
|
||||
}
|
||||
if slug.is_empty() {
|
||||
slug.push_str("package");
|
||||
}
|
||||
slug
|
||||
}
|
||||
|
||||
|
|
|
@ -574,13 +574,16 @@ fn test_name_is_number() {
|
|||
|
||||
p.cargo("-Zscript -v 42.rs")
|
||||
.masquerade_as_nightly_cargo(&["script"])
|
||||
.with_status(101)
|
||||
.with_stdout(
|
||||
r#"bin: [..]/debug/package[EXE]
|
||||
args: []
|
||||
"#,
|
||||
)
|
||||
.with_stderr(
|
||||
r#"[WARNING] `package.edition` is unspecifiead, defaulting to `2021`
|
||||
[ERROR] failed to parse manifest at `[ROOT]/foo/42.rs`
|
||||
|
||||
Caused by:
|
||||
package name cannot be an empty string
|
||||
[COMPILING] package v0.0.0 ([ROOT]/foo)
|
||||
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
|
||||
[RUNNING] `[..]/debug/package[EXE]`
|
||||
"#,
|
||||
)
|
||||
.run();
|
||||
|
|
Loading…
Reference in a new issue