Skip to content

Fix #641#643

Merged
ltratt merged 1 commit into
softdevteam:masterfrom
ratmice:issue_641
Jul 12, 2026
Merged

Fix #641#643
ltratt merged 1 commit into
softdevteam:masterfrom
ratmice:issue_641

Conversation

@ratmice

@ratmice ratmice commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

This should everything in #641 which is in the grmtools impl, the 3rd issue isn't present because I don't think there are any marks in grmtools that shouldn't carry over the only marks are (required, and used), it doesn't have one like prohibited which shouldn't carry over to the merge destination.

It isn't toally clear that used should carry over, but at the very least, the behavior is now consistent across merge behaviors, if we merge a value we now also merge it's mark. While keeping the merge target's marks intact, and it's merge behavior intact.

This also gets rid of the #[allow(clippy::unnecessary_unwrap)] I was looking at.

@ratmice ratmice linked an issue Jul 12, 2026 that may be closed by this pull request
@ratmice

ratmice commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator Author

I don't think this one should be conflict with the clippy PR, as I cherry-picked it from a branch based off of that.

let merge_reprs = Mark::MergeBehavior(MergeBehavior::MutuallyExclusive).repr()
| Mark::MergeBehavior(MergeBehavior::Ours).repr()
| Mark::MergeBehavior(MergeBehavior::Theirs).repr();
// Zap just the MergeBehavior bits.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It would probably be better to move the merge behavior out of the mark bits,
A better design would be to have two u8 fields to replace the current u16.

Mark's which will get merged into the merge target would in one of these, and marks which
would not could go in the other.

(So, merge behaviors would go into the ephemeral pile, then we wouldn't have to strip them out)

We'd need to mess with the internal representation a little, but it allow us to remove a lot of bit fiddling.
Should at least make things a bit easier to reason about?

@ratmice ratmice Jul 12, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Woke up with a small question of whether stripping merge behavior is always correct.

It's certainly incorrect to always set it via an assignment operator (overwriting any merge bits or marks in the merge target).
It's also incorrect to always bitwise or it, this possibly sets multiple merge behaviors for the merge target.

In this patch we never propagate merge bits. However there could be an argument for propagating them if the target has no merge behavior set.

This patch is still an improvement in that at least we're not knowingly doing incorrect things. even if we really haven't settled on all aspects of what it should be doing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not quite sure what perfection looks like here, but this is at least an improvement, so I think we should merge now, and then consider perfecting in a subsequent PR?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I agree, also there isn't really a place where this code path gets used by anything currently.
So this is just one step closer towards that (perfecting might be a bit strong though)

@ltratt ltratt added this pull request to the merge queue Jul 12, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 12, 2026
@ltratt ltratt added this pull request to the merge queue Jul 12, 2026
Merged via the queue into softdevteam:master with commit 9bbcbe3 Jul 12, 2026
2 checks passed
@ratmice ratmice deleted the issue_641 branch July 13, 2026 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MarkMap::merge_from not always preserving marks on merge

2 participants