Merge tag 'rust-fixes-6.6' of https://github.com/Rust-for-Linux/linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 21 Oct 2023 19:54:58 +0000 (12:54 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 21 Oct 2023 19:54:58 +0000 (12:54 -0700)
Pull rust fixes from Miguel Ojeda:

 - GCC build: fix bindgen build error with '-fstrict-flex-arrays'

 - Error module: fix the description for 'ECHILD' and fix Markdown
   style nit

 - Code docs: fix logo replacement

 - Docs: update docs output path

 - Kbuild: remove old docs output path in 'cleandocs' target

* tag 'rust-fixes-6.6' of https://github.com/Rust-for-Linux/linux:
  rust: docs: fix logo replacement
  kbuild: remove old Rust docs output path
  docs: rust: update Rust docs output path
  rust: fix bindgen build error with fstrict-flex-arrays
  rust: error: Markdown style nit
  rust: error: fix the description for `ECHILD`

Documentation/rust/general-information.rst
Makefile
rust/Makefile
rust/kernel/error.rs

index 49029ee..0813978 100644 (file)
@@ -29,7 +29,7 @@ target with the same invocation used for compilation, e.g.::
 
 To read the docs locally in your web browser, run e.g.::
 
-       xdg-open rust/doc/kernel/index.html
+       xdg-open Documentation/output/rust/rustdoc/kernel/index.html
 
 To learn about how to write the documentation, please see coding-guidelines.rst.
 
index a3e52e1..5faaaf0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1474,7 +1474,7 @@ endif # CONFIG_MODULES
 # Directories & files removed with 'make clean'
 CLEAN_FILES += vmlinux.symvers modules-only.symvers \
               modules.builtin modules.builtin.modinfo modules.nsdeps \
-              compile_commands.json .thinlto-cache rust/test rust/doc \
+              compile_commands.json .thinlto-cache rust/test \
               rust-project.json .vmlinux.objs .vmlinux.export.c
 
 # Directories & files removed with 'make mrproper'
index 87958e8..7dbf9ab 100644 (file)
@@ -93,15 +93,14 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
 # and then retouch the generated files.
 rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \
     rustdoc-alloc rustdoc-kernel
-       $(Q)cp $(srctree)/Documentation/images/logo.svg $(rustdoc_output)
-       $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(rustdoc_output)
+       $(Q)cp $(srctree)/Documentation/images/logo.svg $(rustdoc_output)/static.files/
+       $(Q)cp $(srctree)/Documentation/images/COPYING-logo $(rustdoc_output)/static.files/
        $(Q)find $(rustdoc_output) -name '*.html' -type f -print0 | xargs -0 sed -Ei \
-               -e 's:rust-logo\.svg:logo.svg:g' \
-               -e 's:rust-logo\.png:logo.svg:g' \
-               -e 's:favicon\.svg:logo.svg:g' \
-               -e 's:<link rel="alternate icon" type="image/png" href="[./]*favicon-(16x16|32x32)\.png">::g'
-       $(Q)echo '.logo-container > img { object-fit: contain; }' \
-               >> $(rustdoc_output)/rustdoc.css
+               -e 's:rust-logo-[0-9a-f]+\.svg:logo.svg:g' \
+               -e 's:favicon-[0-9a-f]+\.svg:logo.svg:g' \
+               -e 's:<link rel="alternate icon" type="image/png" href="[/.]+/static\.files/favicon-(16x16|32x32)-[0-9a-f]+\.png">::g'
+       $(Q)for f in $(rustdoc_output)/static.files/rustdoc-*.css; do \
+               echo ".logo-container > img { object-fit: contain; }" >> $$f; done
 
 rustdoc-macros: private rustdoc_host = yes
 rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \
@@ -290,6 +289,7 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
        -fno-reorder-blocks -fno-allow-store-data-races -fasan-shadow-offset=% \
        -fzero-call-used-regs=% -fno-stack-clash-protection \
        -fno-inline-functions-called-once -fsanitize=bounds-strict \
+       -fstrict-flex-arrays=% \
        --param=% --param asan-%
 
 # Derived from `scripts/Makefile.clang`.
index 05fcab6..032b645 100644 (file)
@@ -37,7 +37,7 @@ pub mod code {
     declare_err!(E2BIG, "Argument list too long.");
     declare_err!(ENOEXEC, "Exec format error.");
     declare_err!(EBADF, "Bad file number.");
-    declare_err!(ECHILD, "Exec format error.");
+    declare_err!(ECHILD, "No child processes.");
     declare_err!(EAGAIN, "Try again.");
     declare_err!(ENOMEM, "Out of memory.");
     declare_err!(EACCES, "Permission denied.");
@@ -133,7 +133,7 @@ impl Error {
     /// Returns the error encoded as a pointer.
     #[allow(dead_code)]
     pub(crate) fn to_ptr<T>(self) -> *mut T {
-        // SAFETY: self.0 is a valid error due to its invariant.
+        // SAFETY: `self.0` is a valid error due to its invariant.
         unsafe { bindings::ERR_PTR(self.0.into()) as *mut _ }
     }