about summary refs log tree commit diff
path: root/library/std/src/sys/pal
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-02-15 09:20:17 +0100
committerGitHub <noreply@github.com>2024-02-15 09:20:17 +0100
commit09776009eaa0ea4eeabd4d5ee4f76981a16b48ea (patch)
tree63cfd8a03405e1c3dc84a264a806b9bc4878f7de /library/std/src/sys/pal
parent0238d2619fbc99dd707f2761029fc4266617e0a1 (diff)
parent846315ddc95fbe02841c88c540e85f60cb670230 (diff)
downloadrust-09776009eaa0ea4eeabd4d5ee4f76981a16b48ea.tar.gz
rust-09776009eaa0ea4eeabd4d5ee4f76981a16b48ea.zip
Rollup merge of #118749 - ChrisDenton:winsys, r=cuviper
Make contributing to windows bindings easier

This PR does three things:

- Automatically sorts bindings so contributors don't have to. I should have done this to begin with but was lazy.
- Renames `windows_sys.lst` to `bindings.txt`. This [matches the windows-rs repository](https://github.com/microsoft/windows-rs/blob/8e71051ea8a57594478e585d2740126893f9dbb7/crates/tools/sys/bindings.txt) (and repos that copy it). I believe consistency with other projects helps get people orientated.
- Adds a `README.md` file explaining what this is about and how to add bindings. This has the benefit of being directly editable and it's rendered when viewed online. Also people are understandably jumping right into the `windows_sys.rs` file via ripgrep or github search and so missing that it's generated. A `README.md` alongside it is at least slightly more obvious in that case. There is still a small note at the top of `windows_sys` in case people do read from the beginning.

None of this has any impact on the actual code generated. It's purely to make the new contributors workflow a bit nicer.
Diffstat (limited to 'library/std/src/sys/pal')
-rw-r--r--library/std/src/sys/pal/windows/c/README.md9
-rw-r--r--library/std/src/sys/pal/windows/c/bindings.txt (renamed from library/std/src/sys/pal/windows/c/windows_sys.lst)3
-rw-r--r--library/std/src/sys/pal/windows/c/windows_sys.rs7
3 files changed, 10 insertions, 9 deletions
diff --git a/library/std/src/sys/pal/windows/c/README.md b/library/std/src/sys/pal/windows/c/README.md
new file mode 100644
index 00000000000..d458e55efbc
--- /dev/null
+++ b/library/std/src/sys/pal/windows/c/README.md
@@ -0,0 +1,9 @@
+The `windows_sys.rs` file is autogenerated from `bindings.txt` and must not
+be edited manually.
+
+To add bindings, edit `bindings.txt` then regenerate using the following command:
+
+    ./x run generate-windows-sys && ./x fmt library/std
+
+If you need to override generated functions or types then add them to
+`library/std/src/sys/pal/windows/c.rs`.
diff --git a/library/std/src/sys/pal/windows/c/windows_sys.lst b/library/std/src/sys/pal/windows/c/bindings.txt
index f91e1054a04..726f1c3df82 100644
--- a/library/std/src/sys/pal/windows/c/windows_sys.lst
+++ b/library/std/src/sys/pal/windows/c/bindings.txt
@@ -1,7 +1,6 @@
 --out windows_sys.rs
 --config flatten std
 --filter
-// tidy-alphabetical-start
 !Windows.Win32.Foundation.INVALID_HANDLE_VALUE
 Windows.Wdk.Storage.FileSystem.FILE_COMPLETE_IF_OPLOCKED
 Windows.Wdk.Storage.FileSystem.FILE_CONTAINS_EXTENDED_CREATE_INFORMATION
@@ -2592,5 +2591,3 @@ Windows.Win32.System.Threading.WakeAllConditionVariable
 Windows.Win32.System.Threading.WakeConditionVariable
 Windows.Win32.System.WindowsProgramming.PROGRESS_CONTINUE
 Windows.Win32.UI.Shell.GetUserProfileDirectoryW
-// tidy-alphabetical-end
-
diff --git a/library/std/src/sys/pal/windows/c/windows_sys.rs b/library/std/src/sys/pal/windows/c/windows_sys.rs
index b38b70c8983..c386b66a722 100644
--- a/library/std/src/sys/pal/windows/c/windows_sys.rs
+++ b/library/std/src/sys/pal/windows/c/windows_sys.rs
@@ -1,9 +1,3 @@
-// This file is autogenerated.
-//
-// To add bindings, edit windows_sys.lst then use `./x run generate-windows-sys` to
-// regenerate the bindings.
-//
-// ignore-tidy-filelength
 // Bindings generated by `windows-bindgen` 0.52.0
 
 #![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all)]
@@ -4351,3 +4345,4 @@ impl ::core::clone::Clone for XSAVE_FORMAT {
         *self
     }
 }
+// ignore-tidy-filelength