Skip to content

Commit 83d3158

Browse files
fix rustdoc-json-types docs, remove missing_docs warning
2 parents 662f4e5 + 8a8ad34 commit 83d3158

File tree

663 files changed

+12058
-5606
lines changed

Some content is hidden

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

663 files changed

+12058
-5606
lines changed

Cargo.lock

+26-6
Original file line numberDiff line numberDiff line change
@@ -3141,7 +3141,19 @@ dependencies = [
31413141
"bitflags 2.5.0",
31423142
"getopts",
31433143
"memchr",
3144-
"pulldown-cmark-escape",
3144+
"pulldown-cmark-escape 0.10.1",
3145+
"unicase",
3146+
]
3147+
3148+
[[package]]
3149+
name = "pulldown-cmark"
3150+
version = "0.11.0"
3151+
source = "registry+https://github.com/rust-lang/crates.io-index"
3152+
checksum = "8746739f11d39ce5ad5c2520a9b75285310dbfe78c541ccf832d38615765aec0"
3153+
dependencies = [
3154+
"bitflags 2.5.0",
3155+
"memchr",
3156+
"pulldown-cmark-escape 0.11.0",
31453157
"unicase",
31463158
]
31473159

@@ -3151,6 +3163,12 @@ version = "0.10.1"
31513163
source = "registry+https://github.com/rust-lang/crates.io-index"
31523164
checksum = "bd348ff538bc9caeda7ee8cad2d1d48236a1f443c1fa3913c6a02fe0043b1dd3"
31533165

3166+
[[package]]
3167+
name = "pulldown-cmark-escape"
3168+
version = "0.11.0"
3169+
source = "registry+https://github.com/rust-lang/crates.io-index"
3170+
checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae"
3171+
31543172
[[package]]
31553173
name = "pulldown-cmark-to-cmark"
31563174
version = "13.0.0"
@@ -4152,6 +4170,7 @@ dependencies = [
41524170
"rustc_middle",
41534171
"rustc_span",
41544172
"rustc_target",
4173+
"rustc_type_ir",
41554174
"smallvec",
41564175
"tracing",
41574176
]
@@ -4604,7 +4623,7 @@ name = "rustc_resolve"
46044623
version = "0.0.0"
46054624
dependencies = [
46064625
"bitflags 2.5.0",
4607-
"pulldown-cmark 0.9.6",
4626+
"pulldown-cmark 0.11.0",
46084627
"rustc_arena",
46094628
"rustc_ast",
46104629
"rustc_ast_pretty",
@@ -4883,6 +4902,7 @@ dependencies = [
48834902
"indexmap",
48844903
"itertools",
48854904
"minifier",
4905+
"pulldown-cmark 0.9.6",
48864906
"regex",
48874907
"rustdoc-json-types",
48884908
"serde",
@@ -6337,9 +6357,9 @@ dependencies = [
63376357

63386358
[[package]]
63396359
name = "windows-bindgen"
6340-
version = "0.57.0"
6360+
version = "0.58.0"
63416361
source = "registry+https://github.com/rust-lang/crates.io-index"
6342-
checksum = "1ccb96113d6277ba543c0f77e1c5494af8094bf9daf9b85acdc3f1b620e7c7b4"
6362+
checksum = "91cd28d93c692351f3a6e5615567c56756e330bee1c99c6bdd57bfc5ab15f589"
63436363
dependencies = [
63446364
"proc-macro2",
63456365
"rayon",
@@ -6360,9 +6380,9 @@ dependencies = [
63606380

63616381
[[package]]
63626382
name = "windows-metadata"
6363-
version = "0.57.0"
6383+
version = "0.58.0"
63646384
source = "registry+https://github.com/rust-lang/crates.io-index"
6365-
checksum = "8308d076825b9d9e5abc64f8113e96d02b2aeeba869b20fdd65c7e70cda13dfc"
6385+
checksum = "2e837f3c3012cfe9e7086302a93f441a7999439be1ad4c530d55d2f6d2921809"
63666386

63676387
[[package]]
63686388
name = "windows-sys"

compiler/rustc_abi/src/layout.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ pub trait LayoutCalculator {
186186
let (present_first, present_second) = {
187187
let mut present_variants = variants
188188
.iter_enumerated()
189-
.filter_map(|(i, v)| if absent(v) { None } else { Some(i) });
189+
.filter_map(|(i, v)| if !repr.c() && absent(v) { None } else { Some(i) });
190190
(present_variants.next(), present_variants.next())
191191
};
192192
let present_first = match present_first {
@@ -621,7 +621,7 @@ where
621621
let discr_type = repr.discr_type();
622622
let bits = Integer::from_attr(dl, discr_type).size().bits();
623623
for (i, mut val) in discriminants {
624-
if variants[i].iter().any(|f| f.abi.is_uninhabited()) {
624+
if !repr.c() && variants[i].iter().any(|f| f.abi.is_uninhabited()) {
625625
continue;
626626
}
627627
if discr_type.is_signed() {

compiler/rustc_abi/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ pub enum Variants<FieldIdx: Idx, VariantIdx: Idx> {
14291429
/// Single enum variants, structs/tuples, unions, and all non-ADTs.
14301430
Single { index: VariantIdx },
14311431

1432-
/// Enum-likes with more than one inhabited variant: each variant comes with
1432+
/// Enum-likes with more than one variant: each variant comes with
14331433
/// a *discriminant* (usually the same as the variant index but the user can
14341434
/// assign explicit discriminant values). That discriminant is encoded
14351435
/// as a *tag* on the machine. The layout of each variant is

compiler/rustc_ast/src/ast.rs

+36-32
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ pub enum GenericArgs {
176176
AngleBracketed(AngleBracketedArgs),
177177
/// The `(A, B)` and `C` in `Foo(A, B) -> C`.
178178
Parenthesized(ParenthesizedArgs),
179+
/// `(..)` in return type notation.
180+
ParenthesizedElided(Span),
179181
}
180182

181183
impl GenericArgs {
@@ -187,18 +189,19 @@ impl GenericArgs {
187189
match self {
188190
AngleBracketed(data) => data.span,
189191
Parenthesized(data) => data.span,
192+
ParenthesizedElided(span) => *span,
190193
}
191194
}
192195
}
193196

194197
/// Concrete argument in the sequence of generic args.
195198
#[derive(Clone, Encodable, Decodable, Debug)]
196199
pub enum GenericArg {
197-
/// `'a` in `Foo<'a>`
200+
/// `'a` in `Foo<'a>`.
198201
Lifetime(Lifetime),
199-
/// `Bar` in `Foo<Bar>`
202+
/// `Bar` in `Foo<Bar>`.
200203
Type(P<Ty>),
201-
/// `1` in `Foo<1>`
204+
/// `1` in `Foo<1>`.
202205
Const(AnonConst),
203206
}
204207

@@ -352,7 +355,7 @@ pub enum GenericParamKind {
352355
ty: P<Ty>,
353356
/// Span of the `const` keyword.
354357
kw_span: Span,
355-
/// Optional default value for the const generic param
358+
/// Optional default value for the const generic param.
356359
default: Option<AnonConst>,
357360
},
358361
}
@@ -711,6 +714,7 @@ pub enum ByRef {
711714
}
712715

713716
impl ByRef {
717+
#[must_use]
714718
pub fn cap_ref_mutability(mut self, mutbl: Mutability) -> Self {
715719
if let ByRef::Yes(old_mutbl) = &mut self {
716720
*old_mutbl = cmp::min(*old_mutbl, mutbl);
@@ -829,7 +833,7 @@ pub enum PatKind {
829833
/// only one rest pattern may occur in the pattern sequences.
830834
Rest,
831835

832-
// A never pattern `!`
836+
// A never pattern `!`.
833837
Never,
834838

835839
/// Parentheses in patterns used for grouping (i.e., `(PAT)`).
@@ -1118,9 +1122,9 @@ impl LocalKind {
11181122
#[derive(Clone, Encodable, Decodable, Debug)]
11191123
pub struct Arm {
11201124
pub attrs: AttrVec,
1121-
/// Match arm pattern, e.g. `10` in `match foo { 10 => {}, _ => {} }`
1125+
/// Match arm pattern, e.g. `10` in `match foo { 10 => {}, _ => {} }`.
11221126
pub pat: P<Pat>,
1123-
/// Match arm guard, e.g. `n > 10` in `match foo { n if n > 10 => {}, _ => {} }`
1127+
/// Match arm guard, e.g. `n > 10` in `match foo { n if n > 10 => {}, _ => {} }`.
11241128
pub guard: Option<P<Expr>>,
11251129
/// Match arm body. Omitted if the pattern is a never pattern.
11261130
pub body: Option<P<Expr>>,
@@ -1351,12 +1355,12 @@ pub struct Closure {
13511355
pub fn_arg_span: Span,
13521356
}
13531357

1354-
/// Limit types of a range (inclusive or exclusive)
1358+
/// Limit types of a range (inclusive or exclusive).
13551359
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug)]
13561360
pub enum RangeLimits {
1357-
/// Inclusive at the beginning, exclusive at the end
1361+
/// Inclusive at the beginning, exclusive at the end.
13581362
HalfOpen,
1359-
/// Inclusive at the beginning and end
1363+
/// Inclusive at the beginning and end.
13601364
Closed,
13611365
}
13621366

@@ -1397,9 +1401,9 @@ pub struct StructExpr {
13971401
pub enum ExprKind {
13981402
/// An array (e.g, `[a, b, c, d]`).
13991403
Array(ThinVec<P<Expr>>),
1400-
/// Allow anonymous constants from an inline `const` block
1404+
/// Allow anonymous constants from an inline `const` block.
14011405
ConstBlock(AnonConst),
1402-
/// A function call
1406+
/// A function call.
14031407
///
14041408
/// The first field resolves to the function itself,
14051409
/// and the second field is the list of arguments.
@@ -1453,7 +1457,7 @@ pub enum ExprKind {
14531457
/// A block (`'label: { ... }`).
14541458
Block(P<Block>, Option<Label>),
14551459
/// An `async` block (`async move { ... }`),
1456-
/// or a `gen` block (`gen move { ... }`)
1460+
/// or a `gen` block (`gen move { ... }`).
14571461
///
14581462
/// The span is the "decl", which is the header before the body `{ }`
14591463
/// including the `asyng`/`gen` keywords and possibly `move`.
@@ -2051,7 +2055,7 @@ impl UintTy {
20512055
/// * the `A: Bound` in `Trait<A: Bound>`
20522056
/// * the `RetTy` in `Trait(ArgTy, ArgTy) -> RetTy`
20532057
/// * the `C = { Ct }` in `Trait<C = { Ct }>` (feature `associated_const_equality`)
2054-
/// * the `f(): Bound` in `Trait<f(): Bound>` (feature `return_type_notation`)
2058+
/// * the `f(..): Bound` in `Trait<f(..): Bound>` (feature `return_type_notation`)
20552059
#[derive(Clone, Encodable, Decodable, Debug)]
20562060
pub struct AssocItemConstraint {
20572061
pub id: NodeId,
@@ -2153,9 +2157,9 @@ pub enum TyKind {
21532157
Never,
21542158
/// A tuple (`(A, B, C, D,...)`).
21552159
Tup(ThinVec<P<Ty>>),
2156-
/// An anonymous struct type i.e. `struct { foo: Type }`
2160+
/// An anonymous struct type i.e. `struct { foo: Type }`.
21572161
AnonStruct(NodeId, ThinVec<FieldDef>),
2158-
/// An anonymous union type i.e. `union { bar: Type }`
2162+
/// An anonymous union type i.e. `union { bar: Type }`.
21592163
AnonUnion(NodeId, ThinVec<FieldDef>),
21602164
/// A path (`module::module::...::Type`), optionally
21612165
/// "qualified", e.g., `<Vec<T> as SomeTrait>::SomeType`.
@@ -2229,9 +2233,9 @@ pub enum TraitObjectSyntax {
22292233

22302234
#[derive(Clone, Encodable, Decodable, Debug)]
22312235
pub enum PreciseCapturingArg {
2232-
/// Lifetime parameter
2236+
/// Lifetime parameter.
22332237
Lifetime(Lifetime),
2234-
/// Type or const parameter
2238+
/// Type or const parameter.
22352239
Arg(Path, NodeId),
22362240
}
22372241

@@ -2525,11 +2529,11 @@ pub enum Safety {
25252529
/// Iterator`.
25262530
#[derive(Copy, Clone, Encodable, Decodable, Debug)]
25272531
pub enum CoroutineKind {
2528-
/// `async`, which returns an `impl Future`
2532+
/// `async`, which returns an `impl Future`.
25292533
Async { span: Span, closure_id: NodeId, return_impl_trait_id: NodeId },
2530-
/// `gen`, which returns an `impl Iterator`
2534+
/// `gen`, which returns an `impl Iterator`.
25312535
Gen { span: Span, closure_id: NodeId, return_impl_trait_id: NodeId },
2532-
/// `async gen`, which returns an `impl AsyncIterator`
2536+
/// `async gen`, which returns an `impl AsyncIterator`.
25332537
AsyncGen { span: Span, closure_id: NodeId, return_impl_trait_id: NodeId },
25342538
}
25352539

@@ -2746,7 +2750,7 @@ pub struct Variant {
27462750
pub data: VariantData,
27472751
/// Explicit discriminant, e.g., `Foo = 1`.
27482752
pub disr_expr: Option<AnonConst>,
2749-
/// Is a macro placeholder
2753+
/// Is a macro placeholder.
27502754
pub is_placeholder: bool,
27512755
}
27522756

@@ -3020,19 +3024,19 @@ impl Item {
30203024
/// `extern` qualifier on a function item or function type.
30213025
#[derive(Clone, Copy, Encodable, Decodable, Debug)]
30223026
pub enum Extern {
3023-
/// No explicit extern keyword was used
3027+
/// No explicit extern keyword was used.
30243028
///
3025-
/// E.g. `fn foo() {}`
3029+
/// E.g. `fn foo() {}`.
30263030
None,
3027-
/// An explicit extern keyword was used, but with implicit ABI
3031+
/// An explicit extern keyword was used, but with implicit ABI.
30283032
///
3029-
/// E.g. `extern fn foo() {}`
3033+
/// E.g. `extern fn foo() {}`.
30303034
///
3031-
/// This is just `extern "C"` (see `rustc_target::spec::abi::Abi::FALLBACK`)
3035+
/// This is just `extern "C"` (see `rustc_target::spec::abi::Abi::FALLBACK`).
30323036
Implicit(Span),
3033-
/// An explicit extern keyword was used with an explicit ABI
3037+
/// An explicit extern keyword was used with an explicit ABI.
30343038
///
3035-
/// E.g. `extern "C" fn foo() {}`
3039+
/// E.g. `extern "C" fn foo() {}`.
30363040
Explicit(StrLit, Span),
30373041
}
30383042

@@ -3051,13 +3055,13 @@ impl Extern {
30513055
/// included in this struct (e.g., `async unsafe fn` or `const extern "C" fn`).
30523056
#[derive(Clone, Copy, Encodable, Decodable, Debug)]
30533057
pub struct FnHeader {
3054-
/// Whether this is `unsafe`, or has a default safety
3058+
/// Whether this is `unsafe`, or has a default safety.
30553059
pub safety: Safety,
30563060
/// Whether this is `async`, `gen`, or nothing.
30573061
pub coroutine_kind: Option<CoroutineKind>,
30583062
/// The `const` keyword, if any
30593063
pub constness: Const,
3060-
/// The `extern` keyword and corresponding ABI string, if any
3064+
/// The `extern` keyword and corresponding ABI string, if any.
30613065
pub ext: Extern,
30623066
}
30633067

@@ -3251,7 +3255,7 @@ pub enum ItemKind {
32513255
///
32523256
/// E.g., `trait Foo { .. }`, `trait Foo<T> { .. }` or `auto trait Foo {}`.
32533257
Trait(Box<Trait>),
3254-
/// Trait alias
3258+
/// Trait alias.
32553259
///
32563260
/// E.g., `trait Foo = Bar + Quux;`.
32573261
TraitAlias(Generics, GenericBounds),

compiler/rustc_ast/src/attr/mod.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,14 @@ impl Attribute {
204204

205205
pub fn tokens(&self) -> TokenStream {
206206
match &self.kind {
207-
AttrKind::Normal(normal) => normal
208-
.tokens
209-
.as_ref()
210-
.unwrap_or_else(|| panic!("attribute is missing tokens: {self:?}"))
211-
.to_attr_token_stream()
212-
.to_tokenstream(),
207+
AttrKind::Normal(normal) => TokenStream::new(
208+
normal
209+
.tokens
210+
.as_ref()
211+
.unwrap_or_else(|| panic!("attribute is missing tokens: {self:?}"))
212+
.to_attr_token_stream()
213+
.to_token_trees(),
214+
),
213215
&AttrKind::DocComment(comment_kind, data) => TokenStream::token_alone(
214216
token::DocComment(comment_kind, self.style, data),
215217
self.span,

compiler/rustc_ast/src/mut_visit.rs

+1
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ fn noop_visit_generic_args<T: MutVisitor>(generic_args: &mut GenericArgs, vis: &
582582
match generic_args {
583583
GenericArgs::AngleBracketed(data) => vis.visit_angle_bracketed_parameter_data(data),
584584
GenericArgs::Parenthesized(data) => vis.visit_parenthesized_parameter_data(data),
585+
GenericArgs::ParenthesizedElided(span) => vis.visit_span(span),
585586
}
586587
}
587588

0 commit comments

Comments
 (0)