about summary refs log tree commit diff
path: root/compiler/rustc_passes/src/check_attr.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-12-17 12:07:32 +0000
committerbors <bors@rust-lang.org>2024-12-17 12:07:32 +0000
commitf23a80a4c2fbca593b64e70f5970368824b4c5e9 (patch)
treefb6111f5c9f9064163fc6d3c6afcd5f158dc2f58 /compiler/rustc_passes/src/check_attr.rs
parent604d6691d9ee5c88a05569dd3f707b20afd76e97 (diff)
parentcdd71c9f3d6c08cd35edddf56800aa1aacbdaedc (diff)
downloadrust-f23a80a4c2fbca593b64e70f5970368824b4c5e9.tar.gz
rust-f23a80a4c2fbca593b64e70f5970368824b4c5e9.zip
Auto merge of #134414 - jhpratt:rollup-4gtfd1h, r=jhpratt
Rollup of 10 pull requests

Successful merges:

 - #134202 (Remove `rustc::existing_doc_keyword` lint)
 - #134354 (Handle fndef rendering together with signature rendering)
 - #134365 (Rename `rustc_mir_build::build` to `builder`)
 - #134368 (Use links to edition guide for edition migrations)
 - #134397 (rustc_borrowck: Suggest changing `&raw const` to `&raw mut` if applicable)
 - #134398 (AIX: add alignment info for test)
 - #134400 (Fix some comments related to upvars handling)
 - #134406 (Fix `-Z input-stats` ordering)
 - #134409 (bootstrap: fix a comment)
 - #134412 (small borrowck cleanup)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_passes/src/check_attr.rs')
-rw-r--r--compiler/rustc_passes/src/check_attr.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index ee197ce07ca..4d66f5a5387 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -912,6 +912,13 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
     }
 
     fn check_doc_keyword(&self, meta: &MetaItemInner, hir_id: HirId) {
+        fn is_doc_keyword(s: Symbol) -> bool {
+            // FIXME: Once rustdoc can handle URL conflicts on case insensitive file systems, we
+            // can remove the `SelfTy` case here, remove `sym::SelfTy`, and update the
+            // `#[doc(keyword = "SelfTy")` attribute in `library/std/src/keyword_docs.rs`.
+            s <= kw::Union || s == sym::SelfTy
+        }
+
         let doc_keyword = meta.value_str().unwrap_or(kw::Empty);
         if doc_keyword == kw::Empty {
             self.doc_attr_str_error(meta, "keyword");
@@ -933,10 +940,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
                 return;
             }
         }
-        if !rustc_lexer::is_ident(doc_keyword.as_str()) {
-            self.dcx().emit_err(errors::DocKeywordInvalidIdent {
+        if !is_doc_keyword(doc_keyword) {
+            self.dcx().emit_err(errors::DocKeywordNotKeyword {
                 span: meta.name_value_literal_span().unwrap_or_else(|| meta.span()),
-                doc_keyword,
+                keyword: doc_keyword,
             });
         }
     }