1
Fork 0

attr/passes: comment -> doc comment

Change some regular comments into documentation comments.

Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
David Wood 2022-07-13 10:09:37 +01:00
parent 03d488b48a
commit 6f0b8f1a4b
3 changed files with 29 additions and 16 deletions

View file

@ -135,9 +135,22 @@ impl ConstStability {
#[derive(Encodable, Decodable, PartialEq, Copy, Clone, Debug, Eq, Hash)] #[derive(Encodable, Decodable, PartialEq, Copy, Clone, Debug, Eq, Hash)]
#[derive(HashStable_Generic)] #[derive(HashStable_Generic)]
pub enum StabilityLevel { pub enum StabilityLevel {
// Reason for the current stability level and the relevant rust-lang issue /// `#[unstable]`
Unstable { reason: Option<Symbol>, issue: Option<NonZeroU32>, is_soft: bool }, Unstable {
Stable { since: Symbol, allowed_through_unstable_modules: bool }, /// Reason for the current stability level.
reason: Option<Symbol>,
/// Relevant `rust-lang/rust` issue.
issue: Option<NonZeroU32>,
is_soft: bool,
},
/// `#[stable]`
Stable {
/// Rust release which stabilized this feature.
since: Symbol,
/// Is this item allowed to be referred to on stable, despite being contained in unstable
/// modules?
allowed_through_unstable_modules: bool,
},
} }
impl StabilityLevel { impl StabilityLevel {

View file

@ -1,8 +1,8 @@
// Detecting lib features (i.e., features that are not lang features). //! Detecting lib features (i.e., features that are not lang features).
// //!
// These are declared using stability attributes (e.g., `#[stable (..)]` //! These are declared using stability attributes (e.g., `#[stable (..)]` and `#[unstable (..)]`),
// and `#[unstable (..)]`), but are not declared in one single location //! but are not declared in one single location (unlike lang features), which means we need to
// (unlike lang features), which means we need to collect them instead. //! collect them instead.
use rustc_ast::{Attribute, MetaItemKind}; use rustc_ast::{Attribute, MetaItemKind};
use rustc_errors::struct_span_err; use rustc_errors::struct_span_err;

View file

@ -29,13 +29,13 @@ use std::num::NonZeroU32;
#[derive(PartialEq)] #[derive(PartialEq)]
enum AnnotationKind { enum AnnotationKind {
// Annotation is required if not inherited from unstable parents /// Annotation is required if not inherited from unstable parents.
Required, Required,
// Annotation is useless, reject it /// Annotation is useless, reject it.
Prohibited, Prohibited,
// Deprecation annotation is useless, reject it. (Stability attribute is still required.) /// Deprecation annotation is useless, reject it. (Stability attribute is still required.)
DeprecationProhibited, DeprecationProhibited,
// Annotation itself is useless, but it can be propagated to children /// Annotation itself is useless, but it can be propagated to children.
Container, Container,
} }
@ -83,7 +83,7 @@ impl InheritStability {
} }
} }
// A private tree-walker for producing an Index. /// A private tree-walker for producing an `Index`.
struct Annotator<'a, 'tcx> { struct Annotator<'a, 'tcx> {
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
index: &'a mut Index, index: &'a mut Index,
@ -94,9 +94,9 @@ struct Annotator<'a, 'tcx> {
} }
impl<'a, 'tcx> Annotator<'a, 'tcx> { impl<'a, 'tcx> Annotator<'a, 'tcx> {
// Determine the stability for a node based on its attributes and inherited /// Determine the stability for a node based on its attributes and inherited stability. The
// stability. The stability is recorded in the index and used as the parent. /// stability is recorded in the index and used as the parent. If the node is a function,
// If the node is a function, `fn_sig` is its signature /// `fn_sig` is its signature.
fn annotate<F>( fn annotate<F>(
&mut self, &mut self,
def_id: LocalDefId, def_id: LocalDefId,