Skip to content

rustdoc does not warn about misuse of html render option attributes #149187

Closed

Description

@lolbinarycat

Code

#![doc(html_favicon_url)]
#![doc(html_logo_url)]
#![doc(html_playground_url)]
#![doc(issue_tracker_base_url)]
#![doc(html_no_source = "asdf")]

Expected Outcome

Rustdoc should emit a separate warning or error for each attribute misuse.

I would recommend a new lint (eg. rustdoc::bad_render_attr), which would be introduced as warn by default, then upgraded to deny by default, and eventually made a hard error over an edition.

Actual Output

All attributes are silently ignored.

Version

rustdoc 1.93.0-nightly (53732d5 2025-11-20)

Additional Details

Rustdoc also needs to handle cases like #![doc(html_logo_url = 3)] (mismatched type instead of missing argument).

Activity

  1. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    C-bugCategory: This is a bug.
    on Nov 21, 2025
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Nov 21, 2025
  3. self-assigned this
    on Nov 21, 2025
  4. lolbinarycat commented on Nov 21, 2025

    @lolbinarycat
    ContributorAuthor

    Hmm, this could alternatively just be wrapped into invalid_doc_attributes..

  5. lolbinarycat commented on Nov 21, 2025

    @lolbinarycat
    ContributorAuthor

    It would be nice to make it a sub-lint, kinda like broken_intra_doc_links and private_intra_doc_links, tho that relationship is actually defined via control flow and not declarativly..

  6. lolbinarycat commented on Nov 21, 2025

    @lolbinarycat
    ContributorAuthor

    Ok, here's another related snippet:

    #[doc = 1]
    mod foo {}
  7. lolbinarycat commented on Nov 21, 2025

    @lolbinarycat
    ContributorAuthor

    Eventually this will all be solved by porting these attributes over to the new parsing infrastructure, but in the meantime I'm gonna try to improve MetaItemInner's ABI. hopefully changing semantics and implementation separately will make for a smoother transition, since then we should be able to have the rewrite's behavior be identical to what we were doing before.

  8. lolbinarycat commented on Nov 21, 2025

    @lolbinarycat
    ContributorAuthor

    yet another thing we don't catch: duplicate attributes (i think there's already an issue for this)

  9. added a commit that references this issue on Nov 23, 2025
  10. added a commit that references this issue on Nov 24, 2025
  11. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.T-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