mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
fix: remove unsupported embedded workspace check from cargo pkgid
command
Signed-off-by: Rustin170506 <techregister@pm.me>
This commit is contained in:
parent
59b2ddd448
commit
5465e6a451
@ -18,13 +18,6 @@ pub fn cli() -> Command {
|
|||||||
|
|
||||||
pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
|
pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
|
||||||
let ws = args.workspace(gctx)?;
|
let ws = args.workspace(gctx)?;
|
||||||
if ws.root_maybe().is_embedded() {
|
|
||||||
return Err(anyhow::format_err!(
|
|
||||||
"{} is unsupported by `cargo pkgid`",
|
|
||||||
ws.root_manifest().display()
|
|
||||||
)
|
|
||||||
.into());
|
|
||||||
}
|
|
||||||
if args.is_present_with_zero_values("package") {
|
if args.is_present_with_zero_values("package") {
|
||||||
print_available_packages(&ws)?
|
print_available_packages(&ws)?
|
||||||
}
|
}
|
||||||
|
@ -1297,18 +1297,25 @@ fn cmd_verify_project_with_embedded() {
|
|||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test(nightly, reason = "edition2024 hasn't hit stable yet")]
|
||||||
fn cmd_pkgid_with_embedded() {
|
fn cmd_pkgid_with_embedded() {
|
||||||
let p = cargo_test_support::project()
|
let p = cargo_test_support::project()
|
||||||
.file("script.rs", ECHO_SCRIPT)
|
.file("script.rs", ECHO_SCRIPT)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
p.cargo("-Zscript script.rs")
|
||||||
|
.masquerade_as_nightly_cargo(&["script"])
|
||||||
|
.run();
|
||||||
|
|
||||||
|
// FIXME: It should be `path+[ROOTURL]/foo/script.rs#script@0.0.0`.
|
||||||
p.cargo("-Zscript pkgid --manifest-path script.rs")
|
p.cargo("-Zscript pkgid --manifest-path script.rs")
|
||||||
.masquerade_as_nightly_cargo(&["script"])
|
.masquerade_as_nightly_cargo(&["script"])
|
||||||
.with_status(101)
|
.with_stdout_data(str![[r#"
|
||||||
|
path+[ROOTURL]/foo#script@0.0.0
|
||||||
|
|
||||||
|
"#]])
|
||||||
.with_stderr_data(str![[r#"
|
.with_stderr_data(str![[r#"
|
||||||
[WARNING] `package.edition` is unspecified, defaulting to `2024`
|
[WARNING] `package.edition` is unspecified, defaulting to `2024`
|
||||||
[ERROR] [ROOT]/foo/script.rs is unsupported by `cargo pkgid`
|
|
||||||
|
|
||||||
"#]])
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user