From 6e8d0dbe11f79737d9652b712f7556c6be629cfb Mon Sep 17 00:00:00 2001 From: LeSeulArtichaut Date: Mon, 10 May 2021 18:38:09 +0200 Subject: [PATCH] Add documentation --- compiler/rustc_passes/src/check_attr.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 2e1788cfe3824..cb06cbfcc7be0 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -565,6 +565,15 @@ impl CheckAttrVisitor<'tcx> { true } + /// Checks `#[doc(inline)]`/`#[doc(no_inline)]` attributes. Returns `true` if valid. + /// + /// A doc inlining attribute is invalid if it is applied to a non-`use` item, or + /// if there are conflicting attributes for one item. + /// + /// `specified_inline` is used to keep track of whether we have + /// already seen an inlining attribute for this item. + /// If so, `specified_inline` holds the value and the span of + /// the first `inline`/`no_inline` attribute. fn check_doc_inline( &self, attr: &Attribute, @@ -619,6 +628,7 @@ impl CheckAttrVisitor<'tcx> { } } + /// Checks that an attribute is *not* used at the crate level. Returns `true` if valid. fn check_attr_not_crate_level( &self, meta: &NestedMetaItem, @@ -641,6 +651,7 @@ impl CheckAttrVisitor<'tcx> { true } + /// Checks that an attribute is used at the crate level. Returns `true` if valid. fn check_attr_crate_level( &self, attr: &Attribute, @@ -683,6 +694,12 @@ impl CheckAttrVisitor<'tcx> { true } + /// Runs various checks on `#[doc]` attributes. Returns `true` if valid. + /// + /// `specified_inline` should be initialized to `None` and kept for the scope + /// of one item. Read the documentation of [`check_doc_inline`] for more information. + /// + /// [`check_doc_inline`]: Self::check_doc_inline fn check_doc_attrs( &self, attr: &Attribute,