fix(base): Support bases in patches in virtual manifests

This bug has been there since #14360
This commit is contained in:
Ed Page 2024-12-13 11:00:57 -06:00
parent 2d23b94a7f
commit 5b8b2ac248
2 changed files with 13 additions and 24 deletions

View File

@ -304,7 +304,12 @@ fn normalize_toml(
lints: None,
workspace: original_toml.workspace.clone(),
profile: original_toml.profile.clone(),
patch: None,
patch: normalize_patch(
gctx,
original_toml.patch.as_ref(),
&workspace_root,
features,
)?,
replace: original_toml.replace.clone(),
_unused_keys: Default::default(),
};
@ -483,13 +488,6 @@ fn normalize_toml(
}
normalized_toml.target = (!normalized_target.is_empty()).then_some(normalized_target);
normalized_toml.patch = normalize_patch(
gctx,
original_toml.patch.as_ref(),
&workspace_root,
features,
)?;
let normalized_lints = original_toml
.lints
.clone()
@ -1733,14 +1731,14 @@ fn to_virtual_manifest(
root,
};
(
replace(&original_toml, &mut manifest_ctx)?,
patch(&original_toml, &mut manifest_ctx)?,
replace(&normalized_toml, &mut manifest_ctx)?,
patch(&normalized_toml, &mut manifest_ctx)?,
)
};
if let Some(profiles) = &original_toml.profile {
if let Some(profiles) = &normalized_toml.profile {
validate_profiles(profiles, gctx.cli_unstable(), &features, warnings)?;
}
let resolve_behavior = original_toml
let resolve_behavior = normalized_toml
.workspace
.as_ref()
.and_then(|ws| ws.resolver.as_deref())

View File

@ -3138,18 +3138,9 @@ fn patch_in_virtual_with_base() {
p.cargo("tree")
.masquerade_as_nightly_cargo(&["path-bases"])
.with_status(101)
.with_stderr_data(str![[r#"
[ERROR] failed to load source for dependency `bar`
Caused by:
Unable to update [ROOT]/foo/bar
Caused by:
failed to read `[ROOT]/foo/bar/Cargo.toml`
Caused by:
[NOT_FOUND]
.with_stdout_data(str![[r#"
foo v0.5.0 ([ROOT]/foo/foo)
bar v0.5.0 ([ROOT]/bar)
"#]])
.run();