about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeSeulArtichaut <leseulartichaut@gmail.com>2021-05-10 18:38:09 +0200
committerLeSeulArtichaut <leseulartichaut@gmail.com>2021-05-10 18:38:09 +0200
commit6e8d0dbe11f79737d9652b712f7556c6be629cfb (patch)
tree5b60a7272fe42d08fade3d617350c2ee1180e114
parentf2077c728c8c0a3d79fdede72e506fe9c77f72bc (diff)
downloadrust-6e8d0dbe11f79737d9652b712f7556c6be629cfb.tar.gz
rust-6e8d0dbe11f79737d9652b712f7556c6be629cfb.zip
Add documentation
-rw-r--r--compiler/rustc_passes/src/check_attr.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index 2e1788cfe38..cb06cbfcc7b 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,