Skip to content

rustdoc::invalid_html_tags does not understand SVG self-closing tags #103460

Closed
@kpreid

Description

@kpreid

Given the following code:

/// <svg><rect width=1 height=1 /></svg>
pub fn foo() {}

The current output of cargo +nightly doc is:

warning: unclosed HTML tag `rect`
 --> src/lib.rs:1:10
  |
1 | /// <svg><rect width=1 height=1 /></svg>
  |          ^^^^^
  |
  = note: `#[warn(rustdoc::invalid_html_tags)]` on by default

warning: `scratchpad` (lib doc) generated 1 warning

But it is valid to use /> self-closing tags for SVG embedded in HTML, so this markup is not incorrect. There should be no warning.

rustdoc 1.66.0-nightly (7fcf850d7 2022-10-23)
binary: rustdoc
commit-hash: 7fcf850d7942804990a1d2e3fe036622a0fe4c74
commit-date: 2022-10-23
host: x86_64-apple-darwin
release: 1.66.0-nightly
LLVM version: 15.0.2

cc #67799

@rustbot label +T-rustdoc -T-compiler

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions