doc: Clarify why performance-move-const-arg.CheckTriviallyCopyableMove=false #34523

pull maflcko wants to merge 1 commits into bitcoin:master from maflcko:2602-doc-performance-move-const-arg.CheckTriviallyCopyableMove=false changing 1 files +1 −1
  1. maflcko commented at 7:49 am on February 6, 2026: member

    Without this doc, there is a risk that the setting will be turned off, see #34514.

    The reason to disable it is to catch logic bugs, even on trivially copyable types:

    0#include <utility>
    1void Eat(int&& food) { food = 0; };
    2int main() {
    3  int food{2};
    4  Eat(std::move(food));
    5  Eat(std::move(food));  // This should err
    6}
    
  2. doc: Clarify why performance-move-const-arg.CheckTriviallyCopyableMove=false fa88ac3f4f
  3. DrahtBot added the label Docs on Feb 6, 2026
  4. DrahtBot commented at 7:49 am on February 6, 2026: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK hebasto, sedited, l0rinc

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

  5. maflcko commented at 7:49 am on February 6, 2026: member
  6. DrahtBot added the label CI failed on Feb 6, 2026
  7. hebasto approved
  8. hebasto commented at 9:51 am on February 6, 2026: member
    ACK fa88ac3f4f9b7ed99a1b6ee045cef9a019ed314e.
  9. l0rinc commented at 10:42 am on February 6, 2026: contributor
    I’m not sure I understand the point of Eat(std::move(food)); // This should err - it’s a primitive, why would we want to prohibit it being used multiple times? Isn’t there a less hacky way to do that if this is indeed a contract we want to enforce?
  10. maflcko commented at 11:18 am on February 6, 2026: member

    I’m not sure I understand the point of Eat(std::move(food)); // This should err - it’s a primitive, why would we want to prohibit it being used multiple times? Isn’t there a less hacky way to do that if this is indeed a contract we want to enforce?

    Some resources can only be used once. I don’t understand what is hacky about std::move+clang-tidy.

    Sure, there are other ways to achieve this with runtime checks, or clang annotations. Though, both of them require a verbose wrapper class. Also, runtime checks are not statically checked. Also, the verbose clang annotation only work on clang (obviously). Ex: https://godbolt.org/z/jYq6qe4qq

    I don’t see the benefit.

  11. DrahtBot removed the label CI failed on Feb 9, 2026
  12. sedited approved
  13. sedited commented at 1:09 pm on February 9, 2026: contributor
    ACK fa88ac3f4f9b7ed99a1b6ee045cef9a019ed314e
  14. maflcko requested review from l0rinc on Feb 9, 2026
  15. l0rinc commented at 1:46 pm on February 9, 2026: contributor

    ACK fa88ac3f4f9b7ed99a1b6ee045cef9a019ed314e

    Thanks for the explanation.

  16. fanquake merged this on Feb 9, 2026
  17. fanquake closed this on Feb 9, 2026

  18. maflcko deleted the branch on Feb 9, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-02-11 21:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me