Skip to content

Commit 6e8d0db

Browse files
Add documentation
1 parent f2077c7 commit 6e8d0db

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

compiler/rustc_passes/src/check_attr.rs

+17
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,15 @@ impl CheckAttrVisitor<'tcx> {
565565
true
566566
}
567567

568+
/// Checks `#[doc(inline)]`/`#[doc(no_inline)]` attributes. Returns `true` if valid.
569+
///
570+
/// A doc inlining attribute is invalid if it is applied to a non-`use` item, or
571+
/// if there are conflicting attributes for one item.
572+
///
573+
/// `specified_inline` is used to keep track of whether we have
574+
/// already seen an inlining attribute for this item.
575+
/// If so, `specified_inline` holds the value and the span of
576+
/// the first `inline`/`no_inline` attribute.
568577
fn check_doc_inline(
569578
&self,
570579
attr: &Attribute,
@@ -619,6 +628,7 @@ impl CheckAttrVisitor<'tcx> {
619628
}
620629
}
621630

631+
/// Checks that an attribute is *not* used at the crate level. Returns `true` if valid.
622632
fn check_attr_not_crate_level(
623633
&self,
624634
meta: &NestedMetaItem,
@@ -641,6 +651,7 @@ impl CheckAttrVisitor<'tcx> {
641651
true
642652
}
643653

654+
/// Checks that an attribute is used at the crate level. Returns `true` if valid.
644655
fn check_attr_crate_level(
645656
&self,
646657
attr: &Attribute,
@@ -683,6 +694,12 @@ impl CheckAttrVisitor<'tcx> {
683694
true
684695
}
685696

697+
/// Runs various checks on `#[doc]` attributes. Returns `true` if valid.
698+
///
699+
/// `specified_inline` should be initialized to `None` and kept for the scope
700+
/// of one item. Read the documentation of [`check_doc_inline`] for more information.
701+
///
702+
/// [`check_doc_inline`]: Self::check_doc_inline
686703
fn check_doc_attrs(
687704
&self,
688705
attr: &Attribute,

0 commit comments

Comments
 (0)