Skip to content

2021 rustdoc INVALID_RUST_CODEBLOCKS "breakage" #89135

Closed
@Mark-Simulacrum

Description

@Mark-Simulacrum

rustdoc currently has a warn-by-default lint, rustdoc::invalid_rust_codeblocks, which is intended to tell users when rustdoc sees a Rust language code block which is not valid Rust. However, this lint seems to have always been pretty broken: it only attempted to tokenize the input, not actually parse it into a Rust program. So in most cases before almost any text passed in would've not triggered the lint (e.g., the code blocks on this page -- which are clearly not valid Rust -- do not: https://doc.rust-lang.org/1.55.0/nightly-rustc/rustc_metadata/dependency_format/index.html).

However, with the 2021 edition, we have reserved ~any prefix in strings (foo'bar, for example), which causes this lint to fire on quite a lot of this previously accepted Rust code. This is not technically a breaking change -- the lint is warn by default, and is just a lint -- but in practice I worry that the perception will be quite a lot of breakage. The compiler hit quite a few cases in the migration, which all had to be fixed manually -- no rust fix exists here, and can't easily be added I suspect.

Metadata

Metadata

Assignees

Labels

A-edition-2021Area: The 2021 editionC-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

Relationships

None yet

Development

No branches or pull requests

Issue actions