Skip to content

Commit 23f4e64

Browse files
committed
Convert unused doc comments to regular comments
1 parent 121e65f commit 23f4e64

File tree

29 files changed

+143
-142
lines changed

29 files changed

+143
-142
lines changed

compiler/rustc_ast/src/util/comments.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub struct Comment {
2626
/// Makes a doc string more presentable to users.
2727
/// Used by rustdoc and perhaps other tools, but not by rustc.
2828
pub fn beautify_doc_string(data: Symbol) -> String {
29-
/// remove whitespace-only lines from the start/end of lines
29+
// remove whitespace-only lines from the start/end of lines
3030
fn vertical_trim(lines: Vec<String>) -> Vec<String> {
3131
let mut i = 0;
3232
let mut j = lines.len();
@@ -50,7 +50,7 @@ pub fn beautify_doc_string(data: Symbol) -> String {
5050
lines[i..j].to_vec()
5151
}
5252

53-
/// remove a "[ \t]*\*" block from each line, if possible
53+
// remove a "[ \t]*\*" block from each line, if possible
5454
fn horizontal_trim(lines: Vec<String>) -> Vec<String> {
5555
let mut i = usize::MAX;
5656
let mut can_trim = true;

compiler/rustc_ast_lowering/src/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,11 @@ impl Visitor<'_> for ImplTraitTypeIdVisitor<'_> {
419419

420420
impl<'a, 'hir> LoweringContext<'a, 'hir> {
421421
fn lower_crate(mut self, c: &Crate) -> hir::Crate<'hir> {
422-
/// Full-crate AST visitor that inserts into a fresh
423-
/// `LoweringContext` any information that may be
424-
/// needed from arbitrary locations in the crate,
425-
/// e.g., the number of lifetime generic parameters
426-
/// declared for every type and trait definition.
422+
// Full-crate AST visitor that inserts into a fresh
423+
// `LoweringContext` any information that may be
424+
// needed from arbitrary locations in the crate,
425+
// e.g., the number of lifetime generic parameters
426+
// declared for every type and trait definition.
427427
struct MiscCollector<'tcx, 'lowering, 'hir> {
428428
lctx: &'tcx mut LoweringContext<'lowering, 'hir>,
429429
hir_id_owner: Option<NodeId>,

compiler/rustc_errors/src/emitter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ impl EmitterWriter {
11601160
// `max_line_num_len`
11611161
let padding = " ".repeat(padding + label.len() + 5);
11621162

1163-
/// Returns `override` if it is present and `style` is `NoStyle` or `style` otherwise
1163+
// Returns `override` if it is present and `style` is `NoStyle` or `style` otherwise
11641164
fn style_or_override(style: Style, override_: Option<Style>) -> Style {
11651165
match (style, override_) {
11661166
(Style::NoStyle, Some(override_)) => override_,

compiler/rustc_index/src/bit_set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ impl<R: Idx, C: Idx> BitMatrix<R, C> {
900900

901901
impl<R: Idx, C: Idx> fmt::Debug for BitMatrix<R, C> {
902902
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
903-
/// Forces its contents to print in regular mode instead of alternate mode.
903+
// Forces its contents to print in regular mode instead of alternate mode.
904904
struct OneLinePrinter<T>(T);
905905
impl<T: fmt::Debug> fmt::Debug for OneLinePrinter<T> {
906906
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {

compiler/rustc_lint/src/builtin.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -1658,8 +1658,8 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns {
16581658

16591659
use self::ast::{PatKind, RangeSyntax::DotDotDot};
16601660

1661-
/// If `pat` is a `...` pattern, return the start and end of the range, as well as the span
1662-
/// corresponding to the ellipsis.
1661+
// If `pat` is a `...` pattern, return the start and end of the range, as well as the span
1662+
// corresponding to the ellipsis.
16631663
fn matches_ellipsis_pat(pat: &ast::Pat) -> Option<(Option<&Expr>, &Expr, Span)> {
16641664
match &pat.kind {
16651665
PatKind::Range(
@@ -2348,11 +2348,11 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
23482348
Uninit,
23492349
};
23502350

2351-
/// Information about why a type cannot be initialized this way.
2352-
/// Contains an error message and optionally a span to point at.
2351+
// Information about why a type cannot be initialized this way.
2352+
// Contains an error message and optionally a span to point at.
23532353
type InitError = (String, Option<Span>);
23542354

2355-
/// Test if this constant is all-0.
2355+
// Test if this constant is all-0.
23562356
fn is_zero(expr: &hir::Expr<'_>) -> bool {
23572357
use hir::ExprKind::*;
23582358
use rustc_ast::LitKind::*;
@@ -2369,7 +2369,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
23692369
}
23702370
}
23712371

2372-
/// Determine if this expression is a "dangerous initialization".
2372+
// Determine if this expression is a "dangerous initialization".
23732373
fn is_dangerous_init(cx: &LateContext<'_>, expr: &hir::Expr<'_>) -> Option<InitKind> {
23742374
if let hir::ExprKind::Call(ref path_expr, ref args) = expr.kind {
23752375
// Find calls to `mem::{uninitialized,zeroed}` methods.
@@ -2409,16 +2409,16 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
24092409
None
24102410
}
24112411

2412-
/// Test if this enum has several actually "existing" variants.
2413-
/// Zero-sized uninhabited variants do not always have a tag assigned and thus do not "exist".
2412+
// Test if this enum has several actually "existing" variants.
2413+
// Zero-sized uninhabited variants do not always have a tag assigned and thus do not "exist".
24142414
fn is_multi_variant(adt: &ty::AdtDef) -> bool {
24152415
// As an approximation, we only count dataless variants. Those are definitely inhabited.
24162416
let existing_variants = adt.variants.iter().filter(|v| v.fields.is_empty()).count();
24172417
existing_variants > 1
24182418
}
24192419

2420-
/// Return `Some` only if we are sure this type does *not*
2421-
/// allow zero initialization.
2420+
// Return `Some` only if we are sure this type does *not*
2421+
// allow zero initialization.
24222422
fn ty_find_init_error<'tcx>(
24232423
tcx: TyCtxt<'tcx>,
24242424
ty: Ty<'tcx>,

compiler/rustc_middle/src/mir/query.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pub struct GeneratorLayout<'tcx> {
167167

168168
impl Debug for GeneratorLayout<'_> {
169169
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
170-
/// Prints an iterator of (key, value) tuples as a map.
170+
// Prints an iterator of (key, value) tuples as a map.
171171
struct MapPrinter<'a, K, V>(Cell<Option<Box<dyn Iterator<Item = (K, V)> + 'a>>>);
172172
impl<'a, K, V> MapPrinter<'a, K, V> {
173173
fn new(iter: impl Iterator<Item = (K, V)> + 'a) -> Self {
@@ -180,7 +180,7 @@ impl Debug for GeneratorLayout<'_> {
180180
}
181181
}
182182

183-
/// Prints the generator variant name.
183+
// Prints the generator variant name.
184184
struct GenVariantPrinter(VariantIdx);
185185
impl From<VariantIdx> for GenVariantPrinter {
186186
fn from(idx: VariantIdx) -> Self {
@@ -198,7 +198,7 @@ impl Debug for GeneratorLayout<'_> {
198198
}
199199
}
200200

201-
/// Forces its contents to print in regular mode instead of alternate mode.
201+
// Forces its contents to print in regular mode instead of alternate mode.
202202
struct OneLinePrinter<T>(T);
203203
impl<T: Debug> Debug for OneLinePrinter<T> {
204204
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {

compiler/rustc_mir/src/interpret/operand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub struct ImmTy<'tcx, Tag = ()> {
9494

9595
impl<Tag: Copy> std::fmt::Display for ImmTy<'tcx, Tag> {
9696
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
97-
/// Helper function for printing a scalar to a FmtPrinter
97+
// Helper function for printing a scalar to a FmtPrinter
9898
fn p<'a, 'tcx, F: std::fmt::Write, Tag>(
9999
cx: FmtPrinter<'a, 'tcx, F>,
100100
s: ScalarMaybeUninit<Tag>,

compiler/rustc_mir/src/transform/simplify_try.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ fn get_arm_identity_info<'a, 'tcx>(
106106
matches!(stmt.kind, StatementKind::StorageLive(_) | StatementKind::StorageDead(_))
107107
}
108108

109-
/// Eats consecutive Statements which match `test`, performing the specified `action` for each.
110-
/// The iterator `stmt_iter` is not advanced if none were matched.
109+
// Eats consecutive Statements which match `test`, performing the specified `action` for each.
110+
// The iterator `stmt_iter` is not advanced if none were matched.
111111
fn try_eat<'a, 'tcx>(
112112
stmt_iter: &mut StmtIter<'a, 'tcx>,
113113
test: impl Fn(&'a Statement<'tcx>) -> bool,
@@ -120,8 +120,8 @@ fn get_arm_identity_info<'a, 'tcx>(
120120
}
121121
}
122122

123-
/// Eats consecutive `StorageLive` and `StorageDead` Statements.
124-
/// The iterator `stmt_iter` is not advanced if none were found.
123+
// Eats consecutive `StorageLive` and `StorageDead` Statements.
124+
// The iterator `stmt_iter` is not advanced if none were found.
125125
fn try_eat_storage_stmts<'a, 'tcx>(
126126
stmt_iter: &mut StmtIter<'a, 'tcx>,
127127
storage_live_stmts: &mut Vec<(usize, Local)>,
@@ -145,7 +145,7 @@ fn get_arm_identity_info<'a, 'tcx>(
145145
}
146146
}
147147

148-
/// Eats consecutive `Assign` Statements.
148+
// Eats consecutive `Assign` Statements.
149149
// The iterator `stmt_iter` is not advanced if none were found.
150150
fn try_eat_assign_tmp_stmts<'a, 'tcx>(
151151
stmt_iter: &mut StmtIter<'a, 'tcx>,

compiler/rustc_mir_build/src/thir/pattern/_match.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2431,9 +2431,9 @@ fn split_grouped_constructors<'p, 'tcx>(
24312431
continue;
24322432
}
24332433

2434-
/// Represents a border between 2 integers. Because the intervals spanning borders
2435-
/// must be able to cover every integer, we need to be able to represent
2436-
/// 2^128 + 1 such borders.
2434+
// Represents a border between 2 integers. Because the intervals spanning borders
2435+
// must be able to cover every integer, we need to be able to represent
2436+
// 2^128 + 1 such borders.
24372437
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
24382438
enum Border {
24392439
JustBefore(u128),

compiler/rustc_parse/src/parser/nonterminal.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ impl<'a> Parser<'a> {
1212
/// Returning `false` is a *stability guarantee* that such a matcher will *never* begin with that
1313
/// token. Be conservative (return true) if not sure.
1414
pub fn nonterminal_may_begin_with(kind: NonterminalKind, token: &Token) -> bool {
15-
/// Checks whether the non-terminal may contain a single (non-keyword) identifier.
15+
// Checks whether the non-terminal may contain a single (non-keyword) identifier.
1616
fn may_be_ident(nt: &token::Nonterminal) -> bool {
1717
match *nt {
1818
token::NtItem(_) | token::NtBlock(_) | token::NtVis(_) | token::NtLifetime(_) => {

compiler/rustc_passes/src/region.rs

+40-40
Original file line numberDiff line numberDiff line change
@@ -509,17 +509,17 @@ fn resolve_local<'tcx>(
509509
visitor.visit_pat(pat);
510510
}
511511

512-
/// Returns `true` if `pat` match the `P&` non-terminal.
513-
///
514-
/// ```text
515-
/// P& = ref X
516-
/// | StructName { ..., P&, ... }
517-
/// | VariantName(..., P&, ...)
518-
/// | [ ..., P&, ... ]
519-
/// | ( ..., P&, ... )
520-
/// | ... "|" P& "|" ...
521-
/// | box P&
522-
/// ```
512+
// Returns `true` if `pat` match the `P&` non-terminal.
513+
//
514+
// ```text
515+
// P& = ref X
516+
// | StructName { ..., P&, ... }
517+
// | VariantName(..., P&, ...)
518+
// | [ ..., P&, ... ]
519+
// | ( ..., P&, ... )
520+
// | ... "|" P& "|" ...
521+
// | box P&
522+
// ```
523523
fn is_binding_pat(pat: &hir::Pat<'_>) -> bool {
524524
// Note that the code below looks for *explicit* refs only, that is, it won't
525525
// know about *implicit* refs as introduced in #42640.
@@ -576,18 +576,18 @@ fn resolve_local<'tcx>(
576576
}
577577
}
578578

579-
/// If `expr` matches the `E&` grammar, then records an extended rvalue scope as appropriate:
580-
///
581-
/// ```text
582-
/// E& = & ET
583-
/// | StructName { ..., f: E&, ... }
584-
/// | [ ..., E&, ... ]
585-
/// | ( ..., E&, ... )
586-
/// | {...; E&}
587-
/// | box E&
588-
/// | E& as ...
589-
/// | ( E& )
590-
/// ```
579+
// If `expr` matches the `E&` grammar, then records an extended rvalue scope as appropriate:
580+
//
581+
// ```text
582+
// E& = & ET
583+
// | StructName { ..., f: E&, ... }
584+
// | [ ..., E&, ... ]
585+
// | ( ..., E&, ... )
586+
// | {...; E&}
587+
// | box E&
588+
// | E& as ...
589+
// | ( E& )
590+
// ```
591591
fn record_rvalue_scope_if_borrow_expr<'tcx>(
592592
visitor: &mut RegionResolutionVisitor<'tcx>,
593593
expr: &hir::Expr<'_>,
@@ -620,23 +620,23 @@ fn resolve_local<'tcx>(
620620
}
621621
}
622622

623-
/// Applied to an expression `expr` if `expr` -- or something owned or partially owned by
624-
/// `expr` -- is going to be indirectly referenced by a variable in a let statement. In that
625-
/// case, the "temporary lifetime" or `expr` is extended to be the block enclosing the `let`
626-
/// statement.
627-
///
628-
/// More formally, if `expr` matches the grammar `ET`, record the rvalue scope of the matching
629-
/// `<rvalue>` as `blk_id`:
630-
///
631-
/// ```text
632-
/// ET = *ET
633-
/// | ET[...]
634-
/// | ET.f
635-
/// | (ET)
636-
/// | <rvalue>
637-
/// ```
638-
///
639-
/// Note: ET is intended to match "rvalues or places based on rvalues".
623+
// Applied to an expression `expr` if `expr` -- or something owned or partially owned by
624+
// `expr` -- is going to be indirectly referenced by a variable in a let statement. In that
625+
// case, the "temporary lifetime" or `expr` is extended to be the block enclosing the `let`
626+
// statement.
627+
//
628+
// More formally, if `expr` matches the grammar `ET`, record the rvalue scope of the matching
629+
// `<rvalue>` as `blk_id`:
630+
//
631+
// ```text
632+
// ET = *ET
633+
// | ET[...]
634+
// | ET.f
635+
// | (ET)
636+
// | <rvalue>
637+
// ```
638+
//
639+
// Note: ET is intended to match "rvalues or places based on rvalues".
640640
fn record_rvalue_scope<'tcx>(
641641
visitor: &mut RegionResolutionVisitor<'tcx>,
642642
expr: &hir::Expr<'_>,

compiler/rustc_resolve/src/imports.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
730730
errors: Vec<(String, UnresolvedImportError)>,
731731
span: Option<MultiSpan>,
732732
) {
733-
/// Upper limit on the number of `span_label` messages.
733+
// Upper limit on the number of `span_label` messages.
734734
const MAX_LABEL_COUNT: usize = 10;
735735

736736
let (span, msg) = if errors.is_empty() {

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1242,8 +1242,8 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
12421242
}
12431243

12441244
fn fuzzy_match_tys(&self, a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
1245-
/// returns the fuzzy category of a given type, or None
1246-
/// if the type can be equated to any type.
1245+
// returns the fuzzy category of a given type, or None
1246+
// if the type can be equated to any type.
12471247
fn type_category(t: Ty<'_>) -> Option<u32> {
12481248
match t.kind() {
12491249
ty::Bool => Some(0),

library/alloc/src/collections/vec_deque.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ impl<T: Clone> Clone for VecDeque<T> {
154154
#[stable(feature = "rust1", since = "1.0.0")]
155155
unsafe impl<#[may_dangle] T> Drop for VecDeque<T> {
156156
fn drop(&mut self) {
157-
/// Runs the destructor for all items in the slice when it gets dropped (normally or
158-
/// during unwinding).
157+
// Runs the destructor for all items in the slice when it gets dropped (normally or
158+
// during unwinding).
159159
struct Dropper<'a, T>(&'a mut [T]);
160160

161161
impl<'a, T> Drop for Dropper<'a, T> {
@@ -901,8 +901,8 @@ impl<T> VecDeque<T> {
901901
/// ```
902902
#[stable(feature = "deque_extras", since = "1.16.0")]
903903
pub fn truncate(&mut self, len: usize) {
904-
/// Runs the destructor for all items in the slice when it gets dropped (normally or
905-
/// during unwinding).
904+
// Runs the destructor for all items in the slice when it gets dropped (normally or
905+
// during unwinding).
906906
struct Dropper<'a, T>(&'a mut [T]);
907907

908908
impl<'a, T> Drop for Dropper<'a, T> {

library/alloc/src/vec.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3144,8 +3144,8 @@ impl<T> DoubleEndedIterator for Drain<'_, T> {
31443144
#[stable(feature = "drain", since = "1.6.0")]
31453145
impl<T> Drop for Drain<'_, T> {
31463146
fn drop(&mut self) {
3147-
/// Continues dropping the remaining elements in the `Drain`, then moves back the
3148-
/// un-`Drain`ed elements to restore the original `Vec`.
3147+
// Continues dropping the remaining elements in the `Drain`, then moves back the
3148+
// un-`Drain`ed elements to restore the original `Vec`.
31493149
struct DropGuard<'r, 'a, T>(&'r mut Drain<'a, T>);
31503150

31513151
impl<'r, 'a, T> Drop for DropGuard<'r, 'a, T> {

library/alloc/tests/vec.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1541,8 +1541,8 @@ fn test_try_reserve_exact() {
15411541

15421542
#[test]
15431543
fn test_stable_pointers() {
1544-
/// Pull an element from the iterator, then drop it.
1545-
/// Useful to cover both the `next` and `drop` paths of an iterator.
1544+
// Pull an element from the iterator, then drop it.
1545+
// Useful to cover both the `next` and `drop` paths of an iterator.
15461546
fn next_then_drop<I: Iterator>(mut i: I) {
15471547
i.next().unwrap();
15481548
drop(i);

library/core/src/intrinsics.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1800,7 +1800,7 @@ pub(crate) fn is_nonoverlapping<T>(src: *const T, dst: *const T, count: usize) -
18001800
/// ```
18011801
/// use std::ptr;
18021802
///
1803-
/// /// Moves all the elements of `src` into `dst`, leaving `src` empty.
1803+
/// // Moves all the elements of `src` into `dst`, leaving `src` empty.
18041804
/// fn append<T>(dst: &mut Vec<T>, src: &mut Vec<T>) {
18051805
/// let src_len = src.len();
18061806
/// let dst_len = dst.len();
@@ -1907,6 +1907,7 @@ pub unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize) {
19071907
/// /// * `ptr` must be valid for reads of `elts` contiguous elements of type `T`.
19081908
/// /// * Those elements must not be used after calling this function unless `T: Copy`.
19091909
/// # #[allow(dead_code)]
1910+
/// # #[allow(unused_doc_comments)]
19101911
/// unsafe fn from_buf_raw<T>(ptr: *const T, elts: usize) -> Vec<T> {
19111912
/// let mut dst = Vec::with_capacity(elts);
19121913
///

library/core/src/iter/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
//! ```
8181
//! // First, the struct:
8282
//!
83-
//! /// An iterator which counts from one to five
83+
//! // An iterator which counts from one to five
8484
//! struct Counter {
8585
//! count: usize,
8686
//! }

library/core/src/mem/maybe_uninit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ impl<T> MaybeUninit<T> {
302302
/// fn read_into_buffer(ptr: *mut u8, max_len: usize) -> usize;
303303
/// }
304304
///
305-
/// /// Returns a (possibly smaller) slice of data that was actually read
305+
/// // Returns a (possibly smaller) slice of data that was actually read
306306
/// fn read(buf: &mut [MaybeUninit<u8>]) -> &[u8] {
307307
/// unsafe {
308308
/// let len = read_into_buffer(buf.as_mut_ptr() as *mut u8, buf.len());

0 commit comments

Comments
 (0)