gemini-code-assist[bot] commented on code in PR #172:
URL: https://github.com/apache/tvm-ffi/pull/172#discussion_r2442465959


##########
docs/conf.py:
##########
@@ -219,13 +215,29 @@ def _apply_config_overrides(_: object, config: object) -> 
None:
     config.build_rust_docs = build_rust_docs
 
 
+def _copy_rust_docs_to_output(app: sphinx.application.Sphinx, exception: 
Exception | None) -> None:
+    """Copy Rust documentation to the HTML output directory after build 
completes."""
+    if exception is not None or not build_rust_docs:
+        return
+
+    src_dir = _RUST_DIR / "target" / "doc"
+    dst_dir = Path(app.outdir) / "reference" / "rust" / "generated"
+
+    if src_dir.exists():
+        if dst_dir.exists():
+            shutil.rmtree(dst_dir)
+        shutil.copytree(src_dir, dst_dir)
+        print(f"Copied Rust documentation from {src_dir} to {dst_dir}")

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   While the `_build_rust_docs` function handles and logs errors during 
documentation generation, this function will silently do nothing if the source 
directory isn't created. For better traceability and debugging, it would be 
helpful to add a warning here if the source directory does not exist, 
explicitly stating that the copy step was skipped.
   
   ```suggestion
       if src_dir.exists():
           if dst_dir.exists():
               shutil.rmtree(dst_dir)
           shutil.copytree(src_dir, dst_dir)
           print(f"Copied Rust documentation from {src_dir} to {dst_dir}")
       else:
           print(f"Warning: Rust documentation source directory not found at 
{src_dir}. Skipping copy.")
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to