about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2024-10-25 15:17:44 +1100
committerGitHub <noreply@github.com>2024-10-25 12:17:44 +0800
commitad474b60e3367edabed89dec5700d94ae175c1cf (patch)
tree16ce970c046c4a86d8d084fafd6a4262378e02ce /src
parent13bbf491247d5b3a3274e7c6ef16fd28475a3611 (diff)
downloadrust-ad474b60e3367edabed89dec5700d94ae175c1cf.tar.gz
rust-ad474b60e3367edabed89dec5700d94ae175c1cf.zip
Advice on auto-formatting C++ code (#2104)
Diffstat (limited to 'src')
-rw-r--r--src/doc/rustc-dev-guide/src/conventions.md15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/doc/rustc-dev-guide/src/conventions.md b/src/doc/rustc-dev-guide/src/conventions.md
index 1c963c669a8..e7a8d00cc34 100644
--- a/src/doc/rustc-dev-guide/src/conventions.md
+++ b/src/doc/rustc-dev-guide/src/conventions.md
@@ -27,11 +27,24 @@ pass the <!-- date-check: nov 2022 --> `--edition=2021` argument yourself when c
 [fmt]: https://github.com/rust-dev-tools/fmt-rfcs
 [`rustfmt`]:https://github.com/rust-lang/rustfmt
 
+## Formatting C++ code
+
+The compiler contains some C++ code for interfacing with parts of LLVM that
+don't have a stable C API.
+When modifying that code, use this command to format it:
+
+```sh
+./x test tidy --extra-checks=cpp:fmt --bless
+```
+
+This uses a pinned version of `clang-format`, to avoid relying on the local
+environment.
+
 <a name="copyright"></a>
 
 <!-- REUSE-IgnoreStart -->
 <!-- Prevent REUSE from interpreting the heading as a copyright notice -->
-### Copyright notice
+## Copyright notice
 <!-- REUSE-IgnoreEnd -->
 
 In the past, files began with a copyright and license notice. Please **omit**