Skip to content

Conversation

@ada4a
Copy link
Contributor

@ada4a ada4a commented Oct 24, 2025

Fixes #15942

changelog: [use_debug]: don't get confused by nested Debug impls

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Oct 24, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 24, 2025

r? @y21

rustbot has assigned @y21.
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

@ada4a ada4a changed the title fix(use_debug): don't get confused in nested Debug impls fix(use_debug): don't get confused by nested Debug impls Oct 24, 2025
@ada4a
Copy link
Contributor Author

ada4a commented Oct 25, 2025

@rustbot ready

@Jarcho
Copy link
Contributor

Jarcho commented Oct 25, 2025

A better alternative is to use an Option<OwnerId> to track this. It makes the post check just:

if self.id == Some(item.owner_id) {
  self.id = None;
}

This reduces the amount of work done here by a fair bit and leaves no room for messing up the condition if things get more complicated later.

@ada4a
Copy link
Contributor Author

ada4a commented Oct 27, 2025

@Jarcho I must confess that I sometimes find it hard to understand your proposals as they're often very succinct -- I'd appreciate it if you could give a bit more detail. Thanks in advance:)

I think this should be what you meant

Copy link
Contributor

@Jarcho Jarcho left a comment

Choose a reason for hiding this comment

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

@Jarcho Jarcho added this pull request to the merge queue Oct 31, 2025
Merged via the queue into rust-lang:master with commit e415911 Oct 31, 2025
11 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Oct 31, 2025
@ada4a ada4a deleted the in_debug_impl branch October 31, 2025 11:55
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.

Check that in_debug_impl pattern is sound

4 participants