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(HashStable_Generic)]
pub enum StabilityLevel {
// Reason for the current stability level and the relevant rust-lang issue
Unstable { reason: Option<Symbol>, issue: Option<NonZeroU32>, is_soft: bool },
Stable { since: Symbol, allowed_through_unstable_modules: bool },
/// `#[unstable]`
Unstable {
/// 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 {

View file

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

View file

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