@@ -176,6 +176,8 @@ pub enum GenericArgs {
176
176
AngleBracketed ( AngleBracketedArgs ) ,
177
177
/// The `(A, B)` and `C` in `Foo(A, B) -> C`.
178
178
Parenthesized ( ParenthesizedArgs ) ,
179
+ /// `(..)` in return type notation.
180
+ ParenthesizedElided ( Span ) ,
179
181
}
180
182
181
183
impl GenericArgs {
@@ -187,18 +189,19 @@ impl GenericArgs {
187
189
match self {
188
190
AngleBracketed ( data) => data. span ,
189
191
Parenthesized ( data) => data. span ,
192
+ ParenthesizedElided ( span) => * span,
190
193
}
191
194
}
192
195
}
193
196
194
197
/// Concrete argument in the sequence of generic args.
195
198
#[ derive( Clone , Encodable , Decodable , Debug ) ]
196
199
pub enum GenericArg {
197
- /// `'a` in `Foo<'a>`
200
+ /// `'a` in `Foo<'a>`.
198
201
Lifetime ( Lifetime ) ,
199
- /// `Bar` in `Foo<Bar>`
202
+ /// `Bar` in `Foo<Bar>`.
200
203
Type ( P < Ty > ) ,
201
- /// `1` in `Foo<1>`
204
+ /// `1` in `Foo<1>`.
202
205
Const ( AnonConst ) ,
203
206
}
204
207
@@ -352,7 +355,7 @@ pub enum GenericParamKind {
352
355
ty : P < Ty > ,
353
356
/// Span of the `const` keyword.
354
357
kw_span : Span ,
355
- /// Optional default value for the const generic param
358
+ /// Optional default value for the const generic param.
356
359
default : Option < AnonConst > ,
357
360
} ,
358
361
}
@@ -711,6 +714,7 @@ pub enum ByRef {
711
714
}
712
715
713
716
impl ByRef {
717
+ #[ must_use]
714
718
pub fn cap_ref_mutability ( mut self , mutbl : Mutability ) -> Self {
715
719
if let ByRef :: Yes ( old_mutbl) = & mut self {
716
720
* old_mutbl = cmp:: min ( * old_mutbl, mutbl) ;
@@ -829,7 +833,7 @@ pub enum PatKind {
829
833
/// only one rest pattern may occur in the pattern sequences.
830
834
Rest ,
831
835
832
- // A never pattern `!`
836
+ // A never pattern `!`.
833
837
Never ,
834
838
835
839
/// Parentheses in patterns used for grouping (i.e., `(PAT)`).
@@ -1118,9 +1122,9 @@ impl LocalKind {
1118
1122
#[ derive( Clone , Encodable , Decodable , Debug ) ]
1119
1123
pub struct Arm {
1120
1124
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 => {}, _ => {} }`.
1122
1126
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 => {}, _ => {} }`.
1124
1128
pub guard : Option < P < Expr > > ,
1125
1129
/// Match arm body. Omitted if the pattern is a never pattern.
1126
1130
pub body : Option < P < Expr > > ,
@@ -1351,12 +1355,12 @@ pub struct Closure {
1351
1355
pub fn_arg_span : Span ,
1352
1356
}
1353
1357
1354
- /// Limit types of a range (inclusive or exclusive)
1358
+ /// Limit types of a range (inclusive or exclusive).
1355
1359
#[ derive( Copy , Clone , PartialEq , Encodable , Decodable , Debug ) ]
1356
1360
pub enum RangeLimits {
1357
- /// Inclusive at the beginning, exclusive at the end
1361
+ /// Inclusive at the beginning, exclusive at the end.
1358
1362
HalfOpen ,
1359
- /// Inclusive at the beginning and end
1363
+ /// Inclusive at the beginning and end.
1360
1364
Closed ,
1361
1365
}
1362
1366
@@ -1397,9 +1401,9 @@ pub struct StructExpr {
1397
1401
pub enum ExprKind {
1398
1402
/// An array (e.g, `[a, b, c, d]`).
1399
1403
Array ( ThinVec < P < Expr > > ) ,
1400
- /// Allow anonymous constants from an inline `const` block
1404
+ /// Allow anonymous constants from an inline `const` block.
1401
1405
ConstBlock ( AnonConst ) ,
1402
- /// A function call
1406
+ /// A function call.
1403
1407
///
1404
1408
/// The first field resolves to the function itself,
1405
1409
/// and the second field is the list of arguments.
@@ -1453,7 +1457,7 @@ pub enum ExprKind {
1453
1457
/// A block (`'label: { ... }`).
1454
1458
Block ( P < Block > , Option < Label > ) ,
1455
1459
/// An `async` block (`async move { ... }`),
1456
- /// or a `gen` block (`gen move { ... }`)
1460
+ /// or a `gen` block (`gen move { ... }`).
1457
1461
///
1458
1462
/// The span is the "decl", which is the header before the body `{ }`
1459
1463
/// including the `asyng`/`gen` keywords and possibly `move`.
@@ -2051,7 +2055,7 @@ impl UintTy {
2051
2055
/// * the `A: Bound` in `Trait<A: Bound>`
2052
2056
/// * the `RetTy` in `Trait(ArgTy, ArgTy) -> RetTy`
2053
2057
/// * 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`)
2055
2059
#[ derive( Clone , Encodable , Decodable , Debug ) ]
2056
2060
pub struct AssocItemConstraint {
2057
2061
pub id : NodeId ,
@@ -2153,9 +2157,9 @@ pub enum TyKind {
2153
2157
Never ,
2154
2158
/// A tuple (`(A, B, C, D,...)`).
2155
2159
Tup ( ThinVec < P < Ty > > ) ,
2156
- /// An anonymous struct type i.e. `struct { foo: Type }`
2160
+ /// An anonymous struct type i.e. `struct { foo: Type }`.
2157
2161
AnonStruct ( NodeId , ThinVec < FieldDef > ) ,
2158
- /// An anonymous union type i.e. `union { bar: Type }`
2162
+ /// An anonymous union type i.e. `union { bar: Type }`.
2159
2163
AnonUnion ( NodeId , ThinVec < FieldDef > ) ,
2160
2164
/// A path (`module::module::...::Type`), optionally
2161
2165
/// "qualified", e.g., `<Vec<T> as SomeTrait>::SomeType`.
@@ -2229,9 +2233,9 @@ pub enum TraitObjectSyntax {
2229
2233
2230
2234
#[ derive( Clone , Encodable , Decodable , Debug ) ]
2231
2235
pub enum PreciseCapturingArg {
2232
- /// Lifetime parameter
2236
+ /// Lifetime parameter.
2233
2237
Lifetime ( Lifetime ) ,
2234
- /// Type or const parameter
2238
+ /// Type or const parameter.
2235
2239
Arg ( Path , NodeId ) ,
2236
2240
}
2237
2241
@@ -2525,11 +2529,11 @@ pub enum Safety {
2525
2529
/// Iterator`.
2526
2530
#[ derive( Copy , Clone , Encodable , Decodable , Debug ) ]
2527
2531
pub enum CoroutineKind {
2528
- /// `async`, which returns an `impl Future`
2532
+ /// `async`, which returns an `impl Future`.
2529
2533
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`.
2531
2535
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`.
2533
2537
AsyncGen { span : Span , closure_id : NodeId , return_impl_trait_id : NodeId } ,
2534
2538
}
2535
2539
@@ -2746,7 +2750,7 @@ pub struct Variant {
2746
2750
pub data : VariantData ,
2747
2751
/// Explicit discriminant, e.g., `Foo = 1`.
2748
2752
pub disr_expr : Option < AnonConst > ,
2749
- /// Is a macro placeholder
2753
+ /// Is a macro placeholder.
2750
2754
pub is_placeholder : bool ,
2751
2755
}
2752
2756
@@ -3020,19 +3024,19 @@ impl Item {
3020
3024
/// `extern` qualifier on a function item or function type.
3021
3025
#[ derive( Clone , Copy , Encodable , Decodable , Debug ) ]
3022
3026
pub enum Extern {
3023
- /// No explicit extern keyword was used
3027
+ /// No explicit extern keyword was used.
3024
3028
///
3025
- /// E.g. `fn foo() {}`
3029
+ /// E.g. `fn foo() {}`.
3026
3030
None ,
3027
- /// An explicit extern keyword was used, but with implicit ABI
3031
+ /// An explicit extern keyword was used, but with implicit ABI.
3028
3032
///
3029
- /// E.g. `extern fn foo() {}`
3033
+ /// E.g. `extern fn foo() {}`.
3030
3034
///
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`).
3032
3036
Implicit ( Span ) ,
3033
- /// An explicit extern keyword was used with an explicit ABI
3037
+ /// An explicit extern keyword was used with an explicit ABI.
3034
3038
///
3035
- /// E.g. `extern "C" fn foo() {}`
3039
+ /// E.g. `extern "C" fn foo() {}`.
3036
3040
Explicit ( StrLit , Span ) ,
3037
3041
}
3038
3042
@@ -3051,13 +3055,13 @@ impl Extern {
3051
3055
/// included in this struct (e.g., `async unsafe fn` or `const extern "C" fn`).
3052
3056
#[ derive( Clone , Copy , Encodable , Decodable , Debug ) ]
3053
3057
pub struct FnHeader {
3054
- /// Whether this is `unsafe`, or has a default safety
3058
+ /// Whether this is `unsafe`, or has a default safety.
3055
3059
pub safety : Safety ,
3056
3060
/// Whether this is `async`, `gen`, or nothing.
3057
3061
pub coroutine_kind : Option < CoroutineKind > ,
3058
3062
/// The `const` keyword, if any
3059
3063
pub constness : Const ,
3060
- /// The `extern` keyword and corresponding ABI string, if any
3064
+ /// The `extern` keyword and corresponding ABI string, if any.
3061
3065
pub ext : Extern ,
3062
3066
}
3063
3067
@@ -3251,7 +3255,7 @@ pub enum ItemKind {
3251
3255
///
3252
3256
/// E.g., `trait Foo { .. }`, `trait Foo<T> { .. }` or `auto trait Foo {}`.
3253
3257
Trait ( Box < Trait > ) ,
3254
- /// Trait alias
3258
+ /// Trait alias.
3255
3259
///
3256
3260
/// E.g., `trait Foo = Bar + Quux;`.
3257
3261
TraitAlias ( Generics , GenericBounds ) ,
0 commit comments