diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index dd3a610b..2e548ec9 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -168,8 +168,7 @@ jobs: run: | docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail export RUSTDOCFLAGS=-Dwarnings - cargo doc --workspace --all-features --document-private-items --no-deps \ - --exclude cust_raw + cargo doc --workspace --all-features --document-private-items --no-deps ' - name: Normalize build artifacts ownership diff --git a/.github/workflows/ci_windows.yml b/.github/workflows/ci_windows.yml index c29267c1..63082087 100644 --- a/.github/workflows/ci_windows.yml +++ b/.github/workflows/ci_windows.yml @@ -110,7 +110,7 @@ jobs: - name: Check documentation env: RUSTDOCFLAGS: -Dwarnings - run: cargo doc --workspace --all-features --document-private-items --no-deps --exclude cudnn --exclude cudnn-sys --exclude cust_raw + run: cargo doc --workspace --all-features --document-private-items --no-deps --exclude cudnn --exclude cudnn-sys # Disabled due to dll issues, someone with Windows knowledge needed # - name: Compiletest diff --git a/Cargo.lock b/Cargo.lock index d725c2b4..d5382270 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -605,7 +605,6 @@ dependencies = [ "bimap", "bindgen", "cc", - "doxygen-bindgen", ] [[package]] @@ -645,15 +644,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "doxygen-bindgen" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ba4ed6eedf7f4ace1632149d8f0e8a65a480534024d65a7c3b9daacdedbad3" -dependencies = [ - "yap", -] - [[package]] name = "either" version = "1.15.0" @@ -2710,12 +2700,6 @@ dependencies = [ "lzma-sys", ] -[[package]] -name = "yap" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe269e7b803a5e8e20cbd97860e136529cd83bf2c9c6d37b142467e7e1f051f" - [[package]] name = "zerocopy" version = "0.8.26" diff --git a/crates/cust_raw/Cargo.toml b/crates/cust_raw/Cargo.toml index e6557d19..f5fe1f86 100644 --- a/crates/cust_raw/Cargo.toml +++ b/crates/cust_raw/Cargo.toml @@ -13,7 +13,6 @@ build = "build/main.rs" bindgen = "0.71.1" bimap = "0.6.3" cc = "1.2.17" -doxygen-bindgen = "0.1" [package.metadata.docs.rs] features = [ diff --git a/crates/cust_raw/build/callbacks.rs b/crates/cust_raw/build/callbacks.rs index d100220b..8a00f7fe 100644 --- a/crates/cust_raw/build/callbacks.rs +++ b/crates/cust_raw/build/callbacks.rs @@ -35,19 +35,6 @@ impl BindgenCallbacks { } impl ParseCallbacks for BindgenCallbacks { - fn process_comment(&self, comment: &str) -> Option { - // First replace backslashes with @ to avoid doctest parsing issues - let cleaned = comment.replace('\\', "@"); - // Then transform doxygen syntax to rustdoc - match doxygen_bindgen::transform(&cleaned) { - Ok(res) => Some(res), - Err(err) => { - println!("cargo:warning=Problem processing doxygen comment: {comment}\n{err}"); - None - } - } - } - fn will_parse_macro(&self, name: &str) -> MacroParsingBehavior { match self { Self::WithFunctionRenames { diff --git a/crates/cust_raw/build/main.rs b/crates/cust_raw/build/main.rs index c62c272a..212d5510 100644 --- a/crates/cust_raw/build/main.rs +++ b/crates/cust_raw/build/main.rs @@ -70,7 +70,7 @@ fn main() { create_cuda_driver_bindings(&sdk, &outdir, &manifest_dir); create_cuda_runtime_bindings(&sdk, &outdir, &manifest_dir); create_cublas_bindings(&sdk, &outdir, &manifest_dir); - create_nptx_compiler_bindings(&sdk, &outdir, &manifest_dir); + create_nvptx_compiler_bindings(&sdk, &outdir, &manifest_dir); create_nvvm_bindings(&sdk, &outdir, &manifest_dir); if cfg!(any( @@ -154,6 +154,20 @@ fn create_cuda_driver_bindings( .size_t_is_usize(true) .layout_tests(true) .must_use_type("CUresult") + // The CUDA docs have lots of malformed Doxygen directives, e.g. + // + // \sa + // Foo, + // Bar + // + // instead of + // + // \sa Foo + // \sa Bar + // + // (And others.) If we try to convert these to rustdoc, even using the doxygen-bindgen + // crate, we end up with rustdocs that trigger lots of warnings. So don't even try. + .generate_comments(false) .generate() .expect("Unable to generate CUDA driver bindings."); bindings @@ -192,6 +206,7 @@ fn create_cuda_runtime_bindings( .allowlist_type("^libraryPropertyType.*") .allowlist_var("^CU.*") .allowlist_function("^cu.*") + .no_partialeq("cudaHostNodeParams.*") .default_enum_style(bindgen::EnumVariation::Rust { non_exhaustive: false, }) @@ -202,6 +217,8 @@ fn create_cuda_runtime_bindings( .size_t_is_usize(true) .layout_tests(true) .must_use_type("cudaError_t") + // See the comment on `generate_comments` in `create_cuda_runtime_bindings`. + .generate_comments(false) .generate() .expect("Unable to generate CUDA runtime bindings."); bindings @@ -253,6 +270,8 @@ fn create_cublas_bindings(sdk: &cuda_sdk::CudaSdk, outdir: &path::Path, manifest .size_t_is_usize(true) .layout_tests(true) .must_use_type("cublasStatus_t") + // See the comment on `generate_comments` in `create_cuda_runtime_bindings`. + .generate_comments(false) .generate() .unwrap_or_else(|_| panic!("Unable to generate {pkg} bindings.")); bindings @@ -261,7 +280,7 @@ fn create_cublas_bindings(sdk: &cuda_sdk::CudaSdk, outdir: &path::Path, manifest } } -fn create_nptx_compiler_bindings( +fn create_nvptx_compiler_bindings( sdk: &cuda_sdk::CudaSdk, outdir: &path::Path, manifest_dir: &path::Path, @@ -293,6 +312,8 @@ fn create_nptx_compiler_bindings( .size_t_is_usize(true) .layout_tests(true) .must_use_type("nvPTXCompileResult") + // See the comment on `generate_comments` in `create_cuda_runtime_bindings`. + .generate_comments(false) .generate() .expect("Unable to generate nvptx-compiler bindings."); bindings @@ -326,6 +347,8 @@ fn create_nvvm_bindings(sdk: &cuda_sdk::CudaSdk, outdir: &path::Path, manifest_d .size_t_is_usize(true) .layout_tests(true) .must_use_type("nvvmResult") + // See the comment on `generate_comments` in `create_cuda_runtime_bindings`. + .generate_comments(false) .generate() .expect("Unable to generate libNVVM bindings."); bindings