From d3cb25f4cfc15d0c8a13836d52352d1c3225ebd6 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 12 Dec 2023 14:27:20 +0100 Subject: [PATCH] Add `rustX` check to codeblock attributes lint --- src/librustdoc/html/markdown.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index e871cd866c9..d963eb6adfa 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -1284,6 +1284,16 @@ fn parse( LangStringToken::LangToken(x) if x.starts_with("edition") => { data.edition = x[7..].parse::().ok(); } + LangStringToken::LangToken(x) + if x.starts_with("rust") && x[4..].parse::().is_ok() => + { + if let Some(extra) = extra { + extra.error_invalid_codeblock_attr(format!( + "unknown attribute `{x}`. Did you mean `edition{}`?", + &x[4..] + )); + } + } LangStringToken::LangToken(x) if allow_error_code_check && x.starts_with('E') && x.len() == 5 => {