@@ -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
181183impl 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 ) ]
196199pub 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
713716impl 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 ) ]
11191123pub 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 ) ]
13561360pub 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 {
13971401pub 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 ) ]
20562060pub 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 ) ]
22312235pub 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 ) ]
25272531pub 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 ) ]
30223026pub 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 ) ]
30533057pub 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 ) ,
0 commit comments