Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove uses of Option<MarkerTree> #5978

Merged
merged 1 commit into from
Aug 10, 2024

Conversation

ibraheemdev
Copy link
Member

Summary

Follow up to #5898. This should fix some of the failures in #5887 where uv lock --locked is failing due to Some(true) and None markers not comparing equal.

@ibraheemdev ibraheemdev added the internal A refactor or improvement that is not user-facing label Aug 9, 2024
@@ -3120,8 +3117,5 @@ fn satisfies_requires_python(
/// Returns true if and only if the given requirement's marker expression has a
/// possible true value given the `markers` expression given.
fn possible_to_satisfy_markers(markers: &MarkerTree, requirement: &Requirement) -> bool {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to this changed, but also noticed that the invariant here is reversed. This should be fixed as part of #5562.

@ibraheemdev ibraheemdev force-pushed the ibraheem/marker-smart-constructors branch 3 times, most recently from ccc14f8 to 7b5e4ec Compare August 9, 2024 21:38
@ibraheemdev ibraheemdev force-pushed the ibraheem/marker-smart-constructors branch from 7b5e4ec to 26a8062 Compare August 9, 2024 22:02
@@ -146,8 +140,8 @@ impl Lock {
else {
continue;
};
let marker = edge.weight().as_ref();
locked_dist.add_dependency(dependency_dist, marker);
let marker = edge.weight().clone();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to clone here in order to support unwrapping to default?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We used to clone inside add_dependency anyways. Also a MarkerTree is just a usize now, it could even implement Copy.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Yeah sorry saw that afterwards, they're all interned now, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah.

Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable to me.

@ibraheemdev ibraheemdev merged commit f5110f7 into main Aug 10, 2024
57 checks passed
@ibraheemdev ibraheemdev deleted the ibraheem/marker-smart-constructors branch August 10, 2024 17:23
ibraheemdev added a commit that referenced this pull request Aug 12, 2024
## Summary

Missed this one in #5978.

Resolves #5902.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal A refactor or improvement that is not user-facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants