Skip to content

Qualify send sync markers#672

Merged
asomers merged 1 commit intoasomers:masterfrom
rakai93:qualify_send_sync_markers
Nov 13, 2025
Merged

Qualify send sync markers#672
asomers merged 1 commit intoasomers:masterfrom
rakai93:qualify_send_sync_markers

Conversation

@rakai93
Copy link
Copy Markdown
Contributor

@rakai93 rakai93 commented Nov 11, 2025

When there is a struct in scope that is named Send or Sync, the code generated by #[mockall::automock] does not compile because it prefers the local scope over prelude traits. This PR fixes this issue by fully qualifying ::std::marker::Send and ::std::marker::Sync in the code generated by mockall.

@rakai93 rakai93 requested a review from asomers as a code owner November 11, 2025 08:31
Copy link
Copy Markdown
Owner

@asomers asomers left a comment

Choose a reason for hiding this comment

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

Lol, that's a silly problem. But your solution is a good one. However, could you please add two things?

  1. A CHANGELOG entry
  2. A test case in mockall/tests

@rakai93
Copy link
Copy Markdown
Contributor Author

rakai93 commented Nov 13, 2025

Yes, the problem is indeed silly, but working on I/O related stuff where sending data is a thing, naming a struct Send happens rather quickly. I added a test and a CHANGELOG entry, but I guess one other test broke with a recent nightly update.

Copy link
Copy Markdown
Owner

@asomers asomers left a comment

Choose a reason for hiding this comment

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

That test is perfect, thanks.

@asomers
Copy link
Copy Markdown
Owner

asomers commented Nov 13, 2025

If you rebase now, the test should be fixed.

@asomers asomers merged commit ae37861 into asomers:master Nov 13, 2025
3 checks passed
@rakai93 rakai93 deleted the qualify_send_sync_markers branch November 14, 2025 06:46
@rakai93
Copy link
Copy Markdown
Contributor Author

rakai93 commented Nov 14, 2025

Thank you for taking care! What is your usual release cycle, or asked differently, when can I expect to have a real mockall version in my Cargo.toml again instead of some commit hash?

@asomers
Copy link
Copy Markdown
Owner

asomers commented Nov 14, 2025

I don't release at any regular interval. But there are several bug fixes since the last release, so I think that I ought to release soon. Maybe Sunday.

@asomers
Copy link
Copy Markdown
Owner

asomers commented Nov 22, 2025

Mockall 0.14.0 is published, @rakai93

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.

2 participants