Skip to content

rustdoc HTML shouldn't rely on HIR pretty-printing for attributes #142835

Open
@fmease

Description

@fmease

Oh no :( The rustdoc HTML backend shouldn't use HIR pretty-printing at all. Fortunately, rustdoc only displays a fixed set of attrs: export_name, link_section, no_mangle, non_exhaustive and repr but for repr we don't rely on HIR pretty-printing.

Using HIR pretty is busted anyway, since it doesn't escape HTML. E.g., #[unsafe(link_section = "<script>alert()</script>")] triggers an alert.

Originally posted by @fmease in #142823 (comment)

Metadata

Metadata

Assignees

Labels

A-attributesArea: Attributes (`#[…]`, `#![…]`)A-rustdoc-uiArea: Rustdoc UI (generated HTML)C-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.T-rustdoc-frontendRelevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions