Repository navigation
The MPSC queue should move the rvalue-reference argument into data_mem init - #3627
Conversation
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
1 open issue
What changed in this PR
This PR fixes MPSCQueue::Enqueue(T&&) so rvalue arguments are actually moved into the node storage, enabling move-only element types and avoiding unintended copies.
Changes:
- Move-construct
data_memby passingstd::move(data)toInitinEnqueue(T&&). - Add a unit test that enqueues a
std::unique_ptr<int>to validate move-only support.
| File | Description |
|---|---|
| test/mpsc_queue_unittest.cc | Adds coverage to ensure move-only types can be enqueued. |
| src/butil/containers/mpsc_queue.h | Fixes rvalue enqueue to forward as a move into node storage. |
Review effort: Lite
Added test for enqueueing and dequeuing move-only types in MPSCQueue. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
No open issues 🎉
1 resolved since last review
Review effort: Lite

What problem does this PR solve?
Issue Number: resolve
Problem Summary:
Without std::move, data is passed to Init as an lvalue, In this case, the move constructor will not be called. And for move-only type, this call will not compile.
What is changed and the side effects?
Changed:
std::move(data) is required to move-construct data_mem.
Side effects:
Performance effects:
Breaking backward compatibility:
Check List: