Skip to content

Commit 8c6bf2b

Browse files
committed
Auto merge of #104990 - matthiaskrgr:rollup-oskk8v3, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - #104955 (Switch rustdoc-gui test to function call) - #104976 (Prefer doc comments over `//`-comments in compiler) - #104984 (Remove Crate::primitives field) - #104989 (update Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 07e664c + 2ccb38b commit 8c6bf2b

File tree

169 files changed

+1343
-909
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+1343
-909
lines changed

compiler/rustc_ast/src/ast.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ impl<CTX: rustc_span::HashStableContext> HashStable<CTX> for Path {
111111
}
112112

113113
impl Path {
114-
// Convert a span and an identifier to the corresponding
115-
// one-segment path.
114+
/// Convert a span and an identifier to the corresponding
115+
/// one-segment path.
116116
pub fn from_ident(ident: Ident) -> Path {
117117
Path { segments: thin_vec![PathSegment::from_ident(ident)], span: ident.span, tokens: None }
118118
}
@@ -1283,7 +1283,7 @@ impl Expr {
12831283
)
12841284
}
12851285

1286-
// To a first-order approximation, is this a pattern
1286+
/// To a first-order approximation, is this a pattern?
12871287
pub fn is_approximately_pattern(&self) -> bool {
12881288
match &self.peel_parens().kind {
12891289
ExprKind::Box(_)

compiler/rustc_ast/src/attr/mod.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ use thin_vec::thin_vec;
2626
pub struct MarkedAttrs(GrowableBitSet<AttrId>);
2727

2828
impl MarkedAttrs {
29-
// We have no idea how many attributes there will be, so just
30-
// initiate the vectors with 0 bits. We'll grow them as necessary.
3129
pub fn new() -> Self {
30+
// We have no idea how many attributes there will be, so just
31+
// initiate the vectors with 0 bits. We'll grow them as necessary.
3232
MarkedAttrs(GrowableBitSet::new_empty())
3333
}
3434

@@ -174,9 +174,11 @@ impl MetaItem {
174174
self.ident().unwrap_or_else(Ident::empty).name
175175
}
176176

177-
// Example:
178-
// #[attribute(name = "value")]
179-
// ^^^^^^^^^^^^^^
177+
/// ```text
178+
/// Example:
179+
/// #[attribute(name = "value")]
180+
/// ^^^^^^^^^^^^^^
181+
/// ```
180182
pub fn name_value_literal(&self) -> Option<&Lit> {
181183
match &self.kind {
182184
MetaItemKind::NameValue(v) => Some(v),

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -725,10 +725,10 @@ pub fn visit_lazy_tts<T: MutVisitor>(lazy_tts: &mut Option<LazyAttrTokenStream>,
725725
visit_lazy_tts_opt_mut(lazy_tts.as_mut(), vis);
726726
}
727727

728+
/// Applies ident visitor if it's an ident; applies other visits to interpolated nodes.
729+
/// In practice the ident part is not actually used by specific visitors right now,
730+
/// but there's a test below checking that it works.
728731
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
729-
// Applies ident visitor if it's an ident; applies other visits to interpolated nodes.
730-
// In practice the ident part is not actually used by specific visitors right now,
731-
// but there's a test below checking that it works.
732732
pub fn visit_token<T: MutVisitor>(t: &mut Token, vis: &mut T) {
733733
let Token { kind, span } = t;
734734
match kind {

compiler/rustc_ast/src/token.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,9 @@ impl TokenKind {
302302
Literal(Lit::new(kind, symbol, suffix))
303303
}
304304

305-
// An approximation to proc-macro-style single-character operators used by rustc parser.
306-
// If the operator token can be broken into two tokens, the first of which is single-character,
307-
// then this function performs that operation, otherwise it returns `None`.
305+
/// An approximation to proc-macro-style single-character operators used by rustc parser.
306+
/// If the operator token can be broken into two tokens, the first of which is single-character,
307+
/// then this function performs that operation, otherwise it returns `None`.
308308
pub fn break_two_token_op(&self) -> Option<(TokenKind, TokenKind)> {
309309
Some(match *self {
310310
Le => (Lt, Eq),
@@ -538,10 +538,10 @@ impl Token {
538538
}
539539
}
540540

541-
// A convenience function for matching on identifiers during parsing.
542-
// Turns interpolated identifier (`$i: ident`) or lifetime (`$l: lifetime`) token
543-
// into the regular identifier or lifetime token it refers to,
544-
// otherwise returns the original token.
541+
/// A convenience function for matching on identifiers during parsing.
542+
/// Turns interpolated identifier (`$i: ident`) or lifetime (`$l: lifetime`) token
543+
/// into the regular identifier or lifetime token it refers to,
544+
/// otherwise returns the original token.
545545
pub fn uninterpolate(&self) -> Cow<'_, Token> {
546546
match &self.kind {
547547
Interpolated(nt) => match **nt {
@@ -621,7 +621,7 @@ impl Token {
621621
false
622622
}
623623

624-
// Is the token an interpolated block (`$b:block`)?
624+
/// Is the token an interpolated block (`$b:block`)?
625625
pub fn is_whole_block(&self) -> bool {
626626
if let Interpolated(nt) = &self.kind && let NtBlock(..) = **nt {
627627
return true;
@@ -665,8 +665,8 @@ impl Token {
665665
self.is_non_raw_ident_where(Ident::is_path_segment_keyword)
666666
}
667667

668-
// Returns true for reserved identifiers used internally for elided lifetimes,
669-
// unnamed method parameters, crate root module, error recovery etc.
668+
/// Returns true for reserved identifiers used internally for elided lifetimes,
669+
/// unnamed method parameters, crate root module, error recovery etc.
670670
pub fn is_special_ident(&self) -> bool {
671671
self.is_non_raw_ident_where(Ident::is_special)
672672
}

compiler/rustc_ast/src/tokenstream.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ impl TokenTree {
8686
}
8787
}
8888

89-
// Create a `TokenTree::Token` with alone spacing.
89+
/// Create a `TokenTree::Token` with alone spacing.
9090
pub fn token_alone(kind: TokenKind, span: Span) -> TokenTree {
9191
TokenTree::Token(Token::new(kind, span), Spacing::Alone)
9292
}
9393

94-
// Create a `TokenTree::Token` with joint spacing.
94+
/// Create a `TokenTree::Token` with joint spacing.
9595
pub fn token_joint(kind: TokenKind, span: Span) -> TokenTree {
9696
TokenTree::Token(Token::new(kind, span), Spacing::Joint)
9797
}
@@ -413,17 +413,17 @@ impl TokenStream {
413413
TokenStream(Lrc::new(self.0.iter().enumerate().map(|(i, tree)| f(i, tree)).collect()))
414414
}
415415

416-
// Create a token stream containing a single token with alone spacing.
416+
/// Create a token stream containing a single token with alone spacing.
417417
pub fn token_alone(kind: TokenKind, span: Span) -> TokenStream {
418418
TokenStream::new(vec![TokenTree::token_alone(kind, span)])
419419
}
420420

421-
// Create a token stream containing a single token with joint spacing.
421+
/// Create a token stream containing a single token with joint spacing.
422422
pub fn token_joint(kind: TokenKind, span: Span) -> TokenStream {
423423
TokenStream::new(vec![TokenTree::token_joint(kind, span)])
424424
}
425425

426-
// Create a token stream containing a single `Delimited`.
426+
/// Create a token stream containing a single `Delimited`.
427427
pub fn delimited(span: DelimSpan, delim: Delimiter, tts: TokenStream) -> TokenStream {
428428
TokenStream::new(vec![TokenTree::Delimited(span, delim, tts)])
429429
}
@@ -522,8 +522,8 @@ impl TokenStream {
522522
}
523523
}
524524

525-
// Push `tt` onto the end of the stream, possibly gluing it to the last
526-
// token. Uses `make_mut` to maximize efficiency.
525+
/// Push `tt` onto the end of the stream, possibly gluing it to the last
526+
/// token. Uses `make_mut` to maximize efficiency.
527527
pub fn push_tree(&mut self, tt: TokenTree) {
528528
let vec_mut = Lrc::make_mut(&mut self.0);
529529

@@ -534,9 +534,9 @@ impl TokenStream {
534534
}
535535
}
536536

537-
// Push `stream` onto the end of the stream, possibly gluing the first
538-
// token tree to the last token. (No other token trees will be glued.)
539-
// Uses `make_mut` to maximize efficiency.
537+
/// Push `stream` onto the end of the stream, possibly gluing the first
538+
/// token tree to the last token. (No other token trees will be glued.)
539+
/// Uses `make_mut` to maximize efficiency.
540540
pub fn push_stream(&mut self, stream: TokenStream) {
541541
let vec_mut = Lrc::make_mut(&mut self.0);
542542

compiler/rustc_ast_pretty/src/helpers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ impl Printer {
3636
self.nbsp()
3737
}
3838

39-
// Synthesizes a comment that was not textually present in the original
40-
// source file.
39+
/// Synthesizes a comment that was not textually present in the original
40+
/// source file.
4141
pub fn synth_comment(&mut self, text: impl Into<Cow<'static, str>>) {
4242
self.word("/*");
4343
self.space();

compiler/rustc_ast_pretty/src/pprust/state/expr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ impl<'a> State<'a> {
5858
self.print_expr_cond_paren(expr, Self::cond_needs_par(expr))
5959
}
6060

61-
// Does `expr` need parentheses when printed in a condition position?
62-
//
63-
// These cases need parens due to the parse error observed in #26461: `if return {}`
64-
// parses as the erroneous construct `if (return {})`, not `if (return) {}`.
61+
/// Does `expr` need parentheses when printed in a condition position?
62+
///
63+
/// These cases need parens due to the parse error observed in #26461: `if return {}`
64+
/// parses as the erroneous construct `if (return {})`, not `if (return) {}`.
6565
pub(super) fn cond_needs_par(expr: &ast::Expr) -> bool {
6666
match expr.kind {
6767
ast::ExprKind::Break(..)

compiler/rustc_attr/src/session_diagnostics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub(crate) struct IncorrectMetaItem {
4141
pub span: Span,
4242
}
4343

44-
// Error code: E0541
44+
/// Error code: E0541
4545
pub(crate) struct UnknownMetaItem<'a> {
4646
pub span: Span,
4747
pub item: String,
@@ -200,7 +200,7 @@ pub(crate) struct InvalidReprHintNoValue {
200200
pub name: String,
201201
}
202202

203-
// Error code: E0565
203+
/// Error code: E0565
204204
pub(crate) struct UnsupportedLiteral {
205205
pub span: Span,
206206
pub reason: UnsupportedLiteralReason,

compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ impl UseSpans<'_> {
590590
}
591591
}
592592

593-
// Add a span label to the arguments of the closure, if it exists.
593+
/// Add a span label to the arguments of the closure, if it exists.
594594
pub(super) fn args_span_label(self, err: &mut Diagnostic, message: impl Into<String>) {
595595
if let UseSpans::ClosureUse { args_span, .. } = self {
596596
err.span_label(args_span, message);
@@ -628,7 +628,7 @@ impl UseSpans<'_> {
628628
}
629629
}
630630

631-
// Add a span label to the use of the captured variable, if it exists.
631+
/// Add a span label to the use of the captured variable, if it exists.
632632
pub(super) fn var_span_label(
633633
self,
634634
err: &mut Diagnostic,

compiler/rustc_borrowck/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ mod type_check;
8383
mod universal_regions;
8484
mod used_muts;
8585

86-
// A public API provided for the Rust compiler consumers.
86+
/// A public API provided for the Rust compiler consumers.
8787
pub mod consumers;
8888

8989
use borrow_set::{BorrowData, BorrowSet};

0 commit comments

Comments
 (0)