Skip to content

Comments

Remove uses of Option<MarkerTree>#5978

Merged
ibraheemdev merged 1 commit intomainfrom
ibraheem/marker-smart-constructors
Aug 10, 2024
Merged

Remove uses of Option<MarkerTree>#5978
ibraheemdev merged 1 commit intomainfrom
ibraheem/marker-smart-constructors

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
@ibraheemdev ibraheemdev requested a review from BurntSushi August 9, 2024 20:27
@@ -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
};
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
@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