C javadoc comments are not Markdown-escaped, triggering rustdoc warnings · Issue #2057 · rust-lang/rust-bindgen (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@ojeda

Description

@ojeda

This comes up in Rust for Linux when generating the bindings for some C APIs that happen to have javadoc-like comments that end up being broken Markdown: Rust-for-Linux/linux#323.

Input C/C++ Header

/**

Bindgen Invocation

Actual Results

extern "C" { #[doc = " vdso_data.cs[x].shift"] pub fn f(); }

Which leads to rustdoc warnings such as:

warning: unresolved link to `x`
 --> f.rs:4:5
  |
4 |     #[doc = " vdso_data.cs[x].shift"]
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
  = note: the link appears in this line:
          
          vdso_data.cs[x].shift
                       ^
  = note: no item named `x` in scope
  = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

Expected Results

extern "C" { #[doc = " vdso_data.cs\[x\].shift"] pub fn f(); }