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

fa88ac3f4f doc: Clarify why performance-move-const-arg.CheckTriviallyCopyableMove=false (MarcoFalke)

Pull request description:

  Without this doc, there is a risk that the setting will be turned off, see https://github.com/bitcoin/bitcoin/pull/34514.

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

  ```cpp
  #include <utility>
  void Eat(int&& food) { food = 0; };
  int main() {
    int food{2};
    Eat(std::move(food));
    Eat(std::move(food));  // This should err
  }
  ```

ACKs for top commit:
  l0rinc:
    ACK fa88ac3f4f
  hebasto:
    ACK fa88ac3f4f.
  sedited:
    ACK fa88ac3f4f

Tree-SHA512: d1bda846a10190a2936084a06bd87418c6a3e4ababc298e4beb9bc9e1190bff430cbe973475d634eda5ef7863571c89bfa4b78ff63fcbd9ac10c42fd9d5fa23a
This commit is contained in:
merge-script
2026-02-09 13:53:51 +00:00

View File

@@ -37,7 +37,7 @@ CheckOptions:
- key: modernize-deprecated-headers.CheckHeaderFile
value: false
- key: performance-move-const-arg.CheckTriviallyCopyableMove
value: false
value: false # Disabled, to allow the bugprone-use-after-move rule on trivially copyable types, to catch logic bugs
- key: bugprone-unhandled-self-assignment.WarnOnlyIfThisHasSuspiciousField
value: false
- key: bugprone-unused-return-value.CheckedReturnTypes