Skip to content

Commit fc25d9d

Browse files
committed
feat: use full URL for embedded script paths
Signed-off-by: Rustin170506 <[email protected]>
1 parent 0c2bb4e commit fc25d9d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/cargo/core/workspace.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1800,7 +1800,10 @@ impl<'gctx> Packages<'gctx> {
18001800
match self.packages.entry(key.to_path_buf()) {
18011801
Entry::Occupied(e) => Ok(e.into_mut()),
18021802
Entry::Vacant(v) => {
1803-
let source_id = SourceId::for_path(key)?;
1803+
let source_id = match crate::util::toml::is_embedded(manifest_path) {
1804+
true => SourceId::for_path(manifest_path)?,
1805+
false => SourceId::for_path(key)?,
1806+
};
18041807
let manifest = read_manifest(manifest_path, source_id, self.gctx)?;
18051808
Ok(v.insert(match manifest {
18061809
EitherManifest::Real(manifest) => {

tests/testsuite/script.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1307,11 +1307,10 @@ fn cmd_pkgid_with_embedded() {
13071307
.masquerade_as_nightly_cargo(&["script"])
13081308
.run();
13091309

1310-
// FIXME: It should be `path+[ROOTURL]/foo/script.rs#[email protected]`.
13111310
p.cargo("-Zscript pkgid --manifest-path script.rs")
13121311
.masquerade_as_nightly_cargo(&["script"])
13131312
.with_stdout_data(str![[r#"
1314-
path+[ROOTURL]/foo#[email protected]
1313+
path+[ROOTURL]/foo/script.rs#[email protected]
13151314
13161315
"#]])
13171316
.with_stderr_data(str![[r#"

0 commit comments

Comments
 (0)