cargo
Add capability of making breaking changes in `update --precise`
#14140
Open

Add capability of making breaking changes in `update --precise` #14140

torhovland wants to merge 10 commits into rust-lang:master from tweag:update-precise
torhovland
torhovland331 days ago (edited 294 days ago)

Implements the second half of #12425.

With the unstable-options feature enabled, cargo update --precise will allow making upgrades/downgrades that require changes to be made to the manifest files, similar to cargo update --breaking.

Blocked on #14259. See https://github.com/rust-lang/cargo/pull/14140/files#r1682381732.

rustbot rustbot assigned weihanglo weihanglo 331 days ago
rustbot
rustbot331 days ago

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

rustbot rustbot added A-cli
rustbot rustbot added A-manifest
rustbot rustbot added A-testing-cargo-itself
rustbot rustbot added A-unstable
rustbot rustbot added Command-update
rustbot rustbot added S-waiting-on-review
torhovland torhovland force pushed from 6d6f64e8 to de47cb4f 331 days ago
torhovland torhovland force pushed from de47cb4f to 7b753cf9 331 days ago
torhovland torhovland force pushed from 7b753cf9 to 5e5b13dd 331 days ago
weihanglo
weihanglo331 days ago

Should we wait for #14049, or this can be reviewed independently?

torhovland
torhovland330 days ago👍 1

The 4 new commits here can be reviewed. I think #14049 is close to being merged anyway.

epage
epage329 days ago👍 1

The 4 new commits here can be reviewed. I think #14049 is close to being merged anyway.

In the future, please make a blocking thing like that explicit either by making this a draft or opening an issue on an arbitrary part of the code.

epage
epage commented on 2024-06-27
Conversation is marked as resolved
Show resolved
tests/testsuite/update.rs
epage329 days ago

Why were these changed?

torhovland329 days ago

Because there is no update-breaking feature. There's only the -Zunstable-options.

epage329 days ago

We still want an identifying label on all uses of masquerade_as_nightly_cargo so we can easily find all tests related to an unstable feature even if there isn't an "unstable feature" for it.

torhovland329 days ago

Fixed.

epage
epage329 days ago

In #12425 (comment), this PR was marked as addressing

Consider an error message if the command completed without doing any upgrades.

Except this PR description does not include an explanation as to why this PR addresses that and why an error is not the way forward

(btw probably best not to mark things as done when they aren't merged as things can change especially when the "solution" is not decided yet)

epage
epage commented on 2024-06-27
Conversation is marked as resolved
Show resolved
src/cargo/core/features.rs
786786 target_applies_to_host: bool = ("Enable the `target-applies-to-host` key in the .cargo/config.toml file"),
787787 trim_paths: bool = ("Enable the `trim-paths` option in profiles"),
788788 unstable_options: bool = ("Allow the usage of unstable options"),
789
update_precise_breaking: bool = ("Allow `update --precise` to do breaking upgrades"),
epage329 days ago

Why a new unstable option rather than unstable_options?

torhovland329 days ago

Because since there isn't any difference between the breaking command cargo update foo --precise 2.0.1 and its non-breaking counterpart, I thought we needed a feature.

Should the breaking instead be cargo update foo --breaking --precise 2.0.1?

Or is it fine to just use unstable-options to allow the breaking update?

epage329 days ago

I view this as a new supported value within the option which could be used with -Zunstable-options. If there is doing more than turning error cases into success cases, then we might want to consider a more explicit opt-in.

torhovland325 days ago

Fixed.

epage
epage commented on 2024-06-27
tests/testsuite/update_duplicated_with_precise_breaking_feature.rs
1
//! Duplicating tests for `cargo update --precise` with the
2
//! update-precise-breaking feature enabled. When the feature is stabilized,
3
//! this file can be deleted.
4
5
#![allow(deprecated)]
epage329 days ago

Still trying to decide what the best approach is here but in the mean time, could you split this into two commits

  • One that duplicates the tests
  • One that enables the unstable feature

That way it shows what behavior change happened (or not) with the feature.

weihanglo328 days ago

Instead of duplicating tests, one approach we could take is using a test only env var to activate the unstable behavior, for example __CARGO_USE_GITOXIDE_INSTEAD_OF_GIT2.

(Yes I admit that this opens a door for people without -Zunstable-options, though we already have __CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS hence 😬)

torhovland325 days ago👍 1

__CARGO_USE_GITOXIDE_INSTEAD_OF_GIT2 is used from tests to modify Cargo behaviour. You would still need duplicate tests if you wanted to run Cargo with both options.

I was thinking the duplicate test file is OK, as it is meant to be temporary and can be deleted later.

I have put it in a separate commit, and it didn't need any modification after implementing the feature.

epage314 days ago

This was split out into its own commit but I'd like to see it split into two commits.

Currently, the commit is

$ cp tests/testsuite/update.rs
$ edit tests/testsuite/update_duplicated_with_precise_breaking_feature.rs
$ git commit

I was asking to see

$ cp tests/testsuite/update.rs
$ git commit
$ edit tests/testsuite/update_duplicated_with_precise_breaking_feature.rs
$ git commit

Depending on how well it diffs, maybe it should be more

This makes it easier to audit in this review, and in the future, what the differences are between the two tests files.

epage
epage commented on 2024-06-27
Conversation is marked as resolved
Show resolved
tests/testsuite/update.rs
1512 .build();
1513
1514 p.cargo("update -p incompatible --precise 2.0.0")
1515
.masquerade_as_nightly_cargo(&[])
epage329 days ago

Why are these unspecified?

torhovland329 days ago

I thought it was a list of features, but I see now it is a list of reasons. I'll update all the empty ones.

torhovland325 days ago

Fixed.

epage
epage commented on 2024-06-27
Conversation is marked as resolved
Show resolved
tests/testsuite/update.rs
epage329 days ago

Like with --breaking, should we limit this to just the ones that can be upgraded?

Like other cases, this can be broken out into your task list

torhovland325 days ago

I'm curious what you think the correct behaviour should be. We are upgrading shared, so we are not trying to keep it unchanged. So the update tries to do its thing, but fails. Anyway, I'll add this to the task list.

epage314 days ago

This is

Can we limit updates more in case of breaking upgrades? See #14140 (comment) and the test update_precise_breaking_shared_non_ws.

See #12425 (comment)

epage314 days ago

I've renamed the task in the hope that it has enough context to stand on its own

Should cargo update --precise only attempt to update direct dependencies (which can succeed) or also transitive dependencies (which will typically fail) See #14140 (comment) and the test update_precise_breaking_shared_non_ws.

epage
epage commented on 2024-06-27
Conversation is marked as resolved
Show resolved
tests/testsuite/update.rs
epage329 days ago

So --precise will error if the mentioned item can't upgrade but --breaking won't...

torhovland325 days ago

Unlike with --breaking, there is no command line difference between a breaking and a non-breaking precise update. So we just try to do any upgrades, and whether or not we did any, the same lockfile update is run. So a precise update may fall back to being non-breaking, and may fail in the same way as a precise update could break before.

If we changed the API to --breaking --precise we could stop if there aren't any upgrades.

epage314 days ago

I've renamed the existing task to

Should cargo update --breaking error if the command completed without doing any upgrades?

and added this as a parallel task

Should cargo update --precise error if the command completed without doing any upgrades?

epage
epage commented on 2024-06-27
Conversation is marked as resolved
Show resolved
tests/testsuite/update.rs
epage329 days ago

Is there a rest that makes sure cargo update incompatible --precise 2.3.4 sets the version req correctly when 2.5.7 is present?

torhovland325 days ago

Does adding 0.4.5 here cover it?

    Package::new("incompatible", "0.3.0").publish();
    Package::new("incompatible", "0.3.1").publish();
    Package::new("incompatible", "0.4.5").publish();

    p.cargo("update -Zunstable-options -p incompatible@0.1.0 --precise 0.3.0")
        .with_stderr_data(str![[r#"
[UPGRADING] incompatible ^0.1 -> ^0.3
[UPDATING] incompatible v0.1.0 -> v0.3.0
epage314 days ago

That covers

  • Compatible upgrade available
  • Incompatible upgrade available

Seems to cover every case.

epage
epage commented on 2024-06-27
src/bin/cargo/commands/update.rs
1
use std::collections::HashMap;
epage329 days ago

Only did a quick glance at the tests; haven't gotten to the implementation yet.

epage
epage commented on 2024-06-27
Conversation is marked as resolved
Show resolved
tests/testsuite/update.rs
epage329 days ago

In case my comment gets lost track of on a merged pr

Hadn't notice this before. This error message is bad. We should at least be calling out that we are parsing a package id spec

Existing behavior:

$ cargo update clap@foo
error: invalid package ID specification: `clap@foo`

Caused by:
  expected a version like "1.32"

(again, task is list is fine)

epage329 days ago
torhovland325 days ago

Added to list.

torhovland
torhovland329 days ago

Except this PR description does not include an explanation as to why this PR addresses that and why an error is not the way forward

Description updated.

(btw probably best not to mark things as done when they aren't merged as things can change especially when the "solution" is not decided yet)

Got it.

epage
epage329 days ago

Description updated.

I'm still not seeing the description talk to

why an error is not the way forward

btw it would be good to focus on user impact and not implementation. The paragraph that alludes to this starts off by discussing the implementation which someone is likely to gloss over when looking for user impact.

bors
bors329 days ago

☔ The latest upstream changes (presumably #14049) made this pull request unmergeable. Please resolve the merge conflicts.

torhovland torhovland force pushed from 5e5b13dd to b8a45a2d 329 days ago
torhovland torhovland force pushed from b8a45a2d to 0097bf80 329 days ago
torhovland torhovland force pushed from 0097bf80 to 93c2ede8 329 days ago
torhovland
torhovland commented on 2024-06-28
src/bin/cargo/commands/update.rs
103 .fail_if_stable_opt("--breaking", 12425)?;
104
105 let upgrades = ops::upgrade_manifests(&mut ws, &update_opts.to_update)?;
106
ops::resolve_ws(&ws, update_opts.dry_run)?;
torhovland328 days ago

With this change, it is now possible to revert the introduction of the dry_run argument in resolve_ws. Let me know what you think.

torhovland torhovland force pushed from 93c2ede8 to d21785d2 328 days ago
torhovland torhovland changed the title Add `update-precise-breaking` feature. Add capability of making breaking changes in `update --precise` 328 days ago
torhovland torhovland force pushed from d21785d2 to d7ca2a92 328 days ago
rustbot rustbot added A-semver
torhovland torhovland force pushed from d7ca2a92 to 95dddc47 328 days ago
torhovland torhovland force pushed from 95dddc47 to 48dc39ee 328 days ago
torhovland
torhovland commented on 2024-06-28
tests/testsuite/update.rs
18231812 .masquerade_as_nightly_cargo(&["update-precise-breaking"])
18241813 .with_status(101)
18251814 .with_stderr_data(str![[r#"
1826[UPDATING] `dummy-registry` index
1827[ERROR] failed to select a version for the requirement `pre = "^0.1"`
1828candidate versions found which didn't match: 0.2.0-beta
1829location searched: `dummy-registry` index (which is replacing registry `crates-io`)
1830required by package `foo v0.0.1 ([ROOT]/foo)`
1831if you are looking for the prerelease package it needs to be specified explicitly
1832 pre = { version = "0.2.0-beta" }
1833perhaps a crate was updated and forgotten to be re-vendored?
1815
[ERROR] New requirement ^0.2 is invalid, because it doesn't match 0.2.0-beta
torhovland328 days ago

@epage I'm curious what you think of this.

weihanglo328 days ago

Would you mind changing the first letter to lower case? There is a convention we do that. (I know old message didnt' follow the convention…)

weihanglo328 days ago

We have another unstable --precise <pre-release>, which we may want to allow here?

torhovland325 days ago

Lower casing fixed. Awaiting feedback on the error case.

epage314 days ago

Why is this an error?

  • manifest points to 0.1
  • 0.2.0-beta is published
  • user does cargo update --precise 0.2.0-beta

We gave it a valid version that it a breaking change from the current one, so it seems like we should just use that as our version requirement.

The fact that the error doesn't make sense from the users perspective ("I never said the version req was ^0.2 so why is it trying that?") I think helps highlight that.

epage314 days ago

Looks like its only an error because the user's req was 0.1 instead of 0.1.0? In that case, I think its reasonable for us to act as if it was 0.1.0.

torhovland
torhovland commented on 2024-06-28
src/cargo/util/semver_ext.rs
122 return self.matches(&version);
120 let mut version_cleaned = version.clone();
121 version_cleaned.pre = semver::Prerelease::EMPTY;
122
return self.matches(&version) || self.matches(&version_cleaned);
torhovland328 days ago

This needs more looking into. A test is failing. I'll also move this and related changes to a separate commit.

torhovland325 days ago

Two commits inserted at the beginning of the PR.

weihanglo
weihanglo commented on 2024-06-28
src/cargo/ops/cargo_update.rs
1414use crate::util::toml_mut::upgrade::upgrade_requirement;
1515use crate::util::{style, OptVersionReq};
1616use crate::util::{CargoResult, VersionExt};
17
use anyhow::Context;
weihanglo328 days ago

nit: Context is a name so general that may conflict with other structs.

Suggested change
use anyhow::Context;
use anyhow::Context as _;
torhovland325 days ago

Fixed.

tests/testsuite/update.rs
weihanglo328 days ago

There is discrepancy between the normal update and breaking update.

  • With and without v prefix
  • Show SemVer requirement operator or not.

Not a blocker for this PR, but we might want track this somewhere.

torhovland325 days ago

This was discussed here: #13979 (comment)

I'll add it to the task list.

tests/testsuite/update.rs
weihanglo328 days ago

What's the motivation behind 45bc28c?

torhovland325 days ago

In this test (update_breaking_spec_version_transitive) I wanted to specifically target foo.dep but not bar.dep. I can do that if foo.dep=1.0 and bar.dep=2.0:

    p.cargo("update -Zunstable-options --breaking dep@1.0")
        .with_stderr_data(str![[r#"
[UPGRADING] dep ^1.0 -> ^3.0
[UPDATING] dep v1.0.0 -> v3.0.0

But not if bar.dep=1.1, because that makes both foo.dep and bar.dep resolve to 1.1.

tests/testsuite/update.rs
1511 .file("src/lib.rs", "")
1512 .build();
1513
1514
p.cargo("update -p incompatible --precise 2.0.0")
weihanglo328 days ago

-p is not needed anymore :)

torhovland325 days ago

Fixed.

tests/testsuite/update.rs
2851[ERROR] failed to select a version for the requirement `renamed-from = "^1.0"`
2852candidate versions found which didn't match: 2.0.0
2853location searched: `dummy-registry` index (which is replacing registry `crates-io`)
2854
required by package `foo v0.0.1 ([..]/foo)`
weihanglo328 days ago

[..] glob is not necessary.

torhovland325 days ago

Fixed.

tests/testsuite/update.rs
1937candidate versions found which didn't match: 2.0.0
1938location searched: `dummy-registry` index (which is replacing registry `crates-io`)
1939required by package `foo v0.0.1 ([ROOT]/foo)`
1940
perhaps a crate was updated and forgotten to be re-vendored?
weihanglo328 days ago

Oh no this error message is bad 😢

torhovland325 days ago

Keep in mind this is without the feature implemented. In the next commit this becomes:

[UPGRADING] pre ^1.0.0-alpha -> ^2.0.0
[UPDATING] `dummy-registry` index
[UPDATING] pre v1.0.0-alpha -> v2.0.0
weihanglo
weihanglo commented on 2024-06-28
src/cargo/ops/cargo_update.rs
weihanglo328 days ago

Could we document this type alias? It's not immediately clear what should be included in this HashMap. This LockedMap is a good reference:

/// A map of all "locked packages" which is filled in when parsing a lock file
/// and is used to guide dependency resolution by altering summaries as they're
/// queried from this source.
///
/// This map can be thought of as a glorified `Vec<MySummary>` where `MySummary`
/// has a `PackageId` for which package it represents as well as a list of
/// `PackageId` for the resolved dependencies. The hash map is otherwise
/// structured though for easy access throughout this registry.
type LockedMap = HashMap<
// The first level of key-ing done in this hash map is the source that
// dependencies come from, identified by a `SourceId`.
// The next level is keyed by the name of the package...
(SourceId, InternedString),
// ... and the value here is a list of tuples. The first element of each
// tuple is a package which has the source/name used to get to this
// point. The second element of each tuple is the list of locked
// dependencies that the first element has.
Vec<(PackageId, Vec<PackageId>)>,
>;

torhovland325 days ago👍 1

Fixed.

torhovland
torhovland325 days ago

Description updated.

I'm still not seeing the description talk to

why an error is not the way forward

I have updated the task list. Hope that's OK.

torhovland torhovland force pushed from 48dc39ee to eeff5729 325 days ago
torhovland torhovland force pushed from eeff5729 to f57599cf 325 days ago
torhovland
torhovland325 days ago

This is ready for another look now.

epage
epage commented on 2024-07-12
src/cargo/util/semver_ext.rs
117117 /// and we're not sure if this part of the functionality should be implemented in semver or cargo.
118118 pub fn matches_prerelease(&self, version: &Version) -> bool {
119119 if version.is_prerelease() {
120 let mut version = version.clone();
121 version.pre = semver::Prerelease::EMPTY;
122 return self.matches(&version);
120
// Only in the case of "ordinary" version requirements with pre-release
121
// versions do we need to help the version matching. In the case of Any,
122
// Locked, or Precise, the `matches()` function is already doing the
123
// correct handling.
124
if let OptVersionReq::Req(_) = self {
125
let mut version = version.clone();
126
version.pre = semver::Prerelease::EMPTY;
127
return self.matches(&version);
128
}
epage314 days ago

I don't think this is an appropriate place to be putting this fix.

Note the comment in the description

we're not sure if this part of the functionality should be implemented in semver or cargo.

At this time, this is an abstraction that we shouldn't be breaking with cargo-specific logic

btw these two commtis seem unrelated with the rest and seem like they should be their own PR

torhovland308 days ago

Hmm, but all I'm doing here is relaxing the cargo-specific logic. Without this fix, I get this bug:

   Upgrading pre ^0.1.0 -> ^0.2.0-beta
    Updating `dummy-registry` index
error: failed to select a version for the requirement `pre = "^0.2.0-beta"`
candidate versions found which didn't match: 0.2.0-beta

What do you think I should do?

epage308 days ago

If we take 0.2.0-beta, remove -beta, we get 0.2.0. That seems like 0.2.0-beta should be able to match that.

Any insight into why this isn't working?

linyihai300 days ago

This is a bug for this PR.

matches_prerelease will alaways a OptVersionReq::Req in my previous PR, but this PR will add OptVersionReq::Precise to match , see


    let req = if precise.is_some() {
        OptVersionReq::Precise(new_version, new_version_req)
    } else {
        OptVersionReq::Req(new_version_req)
    };
epage
epage314 days ago

Except this PR description does not include an explanation as to why this PR addresses that and why an error is not the way forward

Description updated.

The PR says:

This PR is making a change that also affects cargo update --breaking. We'll reuse ops::update_lockfile() for both breaking and non-breaking updates. The benefit is more consistent output and behaviour between the two. In particular, it addresses a task about an error output if there is nothing to upgrade. See #12425 (comment).

This is focused on the implementation, glosses over the reason, and doesn't say what is being changed.

I think its best to split this out from this PR, either making ti independent or making one depend on the other. Trying to slip it in like this is making it harder to review and discuss both.

epage
epage commented on 2024-07-12
tests/testsuite/precise_pre_release.rs
epage314 days ago

This seems to incorrectly be interacting with the precise-prerelease feature. The intention of that feature is that we should occasionally allow matching pre-releases with a regular version requirement.

epage
epage commented on 2024-07-12
tests/testsuite/update.rs
17131709
17141710
p.cargo("update -Zunstable-options incompatible --precise 0.2.0")
17151711
.masquerade_as_nightly_cargo(&["update-precise-breaking"])
1716
.with_status(101)
17171712
.with_stderr_data(str![[r#"
1713
[UPGRADING] incompatible ^0.1 -> ^0.2
17181714
[UPDATING] `dummy-registry` index
1719
[ERROR] failed to select a version for the requirement `incompatible = "^0.1"`
1720
candidate versions found which didn't match: 0.2.0
1721
location searched: `dummy-registry` index (which is replacing registry `crates-io`)
1722
required by package `foo v0.0.1 ([ROOT]/foo)`
1723
perhaps a crate was updated and forgotten to be re-vendored?
1715
[UPDATING] incompatible v0.1.0 -> v0.2.0
1716
[NOTE] pass `--verbose` to see 1 unchanged dependencies behind latest
epage314 days ago

update_precise_breaking_consistent_output

Consistent with what? How will this ensure we keep remaining consistent?

epage
epage commented on 2024-07-12
tests/testsuite/update.rs
22552218
// No spec
22562219
p.cargo("update -Zunstable-options incompatible --precise 0.3.1")
epage314 days ago

update_precise_breaking_spec_version

I'm confused as to what this test is trying to capture compared to other tests

epage314 days ago

Oh, its not that there is no spec but that we aren't specifying a version in the spec, only the name

epage
epage commented on 2024-07-12
tests/testsuite/update.rs
epage314 days ago

Does cargo update --precise <no-meta> work on packages with metadata? Whichever way, this should do the same if its a breaking change

epage
epage commented on 2024-07-12
src/cargo/ops/cargo_update.rs
165182 .filter(|s| !s.is_registry())
166183 .collect();
167184
168 let keep = |p: &PackageId| !to_avoid_sources.contains(&p.source_id()) && !to_avoid.contains(p);
185
let breaking_precise_upgrades = opts.precise.is_some() && !upgrades.is_empty();
186
let breaking_mode = opts.breaking || breaking_precise_upgrades;
187
188
let keep = |p: &PackageId| {
189
(!to_avoid_sources.contains(&p.source_id()) && !to_avoid.contains(p))
190
// In case of `--breaking` or precise upgrades, we want to keep all
191
// packages unchanged that didn't get upgraded.
192
|| (breaking_mode && !upgrades.contains_key(&(p.name().to_string(), p.source_id())))
193
};
epage314 days ago

@torhovland I was very intentionally trying to avoid changing this in past PRs. To go back and change it requires a good explanation. Even better if you can also split this into its own commit or PR

@Eh2406 I'm very cautious of messing with keep and would appreciate your input on tweaking it for this case

Eh2406311 days ago

keep also makes my head spin. I feel like it's something about the triple negative structure, we update the ones that are not keep, we keep the ones that are not avoid, we avoid the things that asked to be updated. But I've never found it clearer naming structure, so maybe that's not it. It's also trying to do a linear prediction of resolution which feels like an approximation.

In specific, why does this need to be a separate lookup as opposed to adding the matching packages to to_avoid?

Also, this callback is run a lot on no-op builds, so very small performance problems end up being a high percentage of runtime. I suspect the to_string is going to end up being expensive. Can the upgrades map be InternedStrings or &str?

torhovland310 days ago

The reason this is not put in to_avoid is that those require PackageIds, i.e. they require a version. When doing upgrades, we don't have any versions, only version requirements.

torhovland310 days ago

I'm pulling this out into a separate PR: #14259

epage310 days ago

I assume with that pulled out this PR will be updated so we can get it merged without #14259 so this doesn't get blocked on that decision?

torhovland309 days ago

OK, I suppose we can do that. It will help illustrate why #14259 is useful.

torhovland308 days ago

I don't like the idea of not building on #14259. I suggest we rather let this PR depend on #14259 and leave it as draft for now. Here's why:

  • Some of the duplicated existing precise tests with the unstable feature enabled are no longer passing. In other words, without #14259 we will be changing the behaviour of the non-breaking precise update.

  • Some invocations are now silently finishing rather than reporting an error. For example:

[ERROR] package ID specification `incompatible@2.0.0` did not match any packages
Did you mean one of these?

  incompatible@0.3.1
  • The output is generally no longer consistent with the non-breaking update. For example, without #14259 the output changes like this:
-[UPDATING] incompatible v0.1.0 -> v0.2.0
-[NOTE] pass `--verbose` to see 1 unchanged dependencies behind latest
+[LOCKING] 1 package to latest compatible version
+[UPDATING] incompatible v0.1.0 -> v0.2.0 (latest: v0.2.1)
epage308 days ago

I don't like the idea of not building on #14259. I suggest we rather let this PR depend on #14259 and leave it as draft for now.

That PR has behavior changes that have not been agreed to, internal and user-facing. We should not block progress forward on something on changes like that. If there is some intermediate change that side steps the controversial parts that unblocks --precise, then let's go for that.

torhovland308 days ago

Is #14259 still controversial? It no longer changes keep. I hesitate moving forward with this PR without merging #14259 first, particularly because of the first bullet point above (breaking compatibility with the existing precise update).

epage
epage commented on 2024-07-12
src/cargo/ops/cargo_update.rs
epage314 days ago

I'm not seeing this error covered in the tests

epage
epage commented on 2024-07-12
src/cargo/ops/cargo_update.rs
epage314 days ago

Why did the style for Upgrading change?

epage
epage commented on 2024-07-12
src/cargo/util/toml_mut/upgrade.rs
2729 new_req_text.remove(0);
2830 }
2931
// Validate contract
30
#[cfg(debug_assertions)]
31
{
32
assert!(
epage314 days ago

With my other comment in mind, is there a reason this should be a bail, rather than an assert?

torhovland torhovland marked this pull request as draft 308 days ago
torhovland test: Adjust update-breaking tests.
8c8ad487
torhovland fix: Use ops::update_lockfile for consistency with non-breaking update.
324ad020
torhovland test: Demonstrate a problem with matching precise prerelease versions.
f40eadee
torhovland fix: Matching of precise prerelease versions.
49a3d72a
torhovland test: Duplicate update tests.
7e63a9ef
torhovland test: Enable unstable-options for the duplicated tests.
c5770061
torhovland test: Tests for allowing breaking updates in `cargo update --precise`.
a79c1b54
torhovland feat: Make cargo update --precise capable of doing breaking upgrades.
659039c3
torhovland Fix upgrading of pre-release.
0fe5f00e
torhovland test: update_precise_breaking_direct_plus_transitive
68f606c3
torhovland torhovland force pushed from f57599cf to 68f606c3 279 days ago
torhovland
torhovland commented on 2024-08-16
tests/testsuite/update.rs
2565}
2566
2567#[cargo_test]
2568
fn update_precise_breaking_direct_plus_transitive() {
torhovland279 days ago

@epage Can I ask you to take a quick look at this test, please? I believe it answers the concern you raised in office hours. The test demonstrates that we do support upgrading a direct dependency while leaving the transitive dependency at its original version.

If this is reassuring to you, it means #14259 is a valid step forward and we should get it merged. Then I'll clean up this PR.

rustbot
rustbot153 days ago

☔ The latest upstream changes (possibly 081d7ba) made this pull request unmergeable. Please resolve the merge conflicts.

Login to write a write a comment.

Login via GitHub

Assignees
Labels
Milestone