@@ -413,11 +413,11 @@ impl WherePredicate {
413
413
#[ derive( Clone , RustcEncodable , RustcDecodable , Debug ) ]
414
414
pub struct WhereBoundPredicate {
415
415
pub span : Span ,
416
- /// Any generics from a `for` binding
416
+ /// Any generics from a `for` binding.
417
417
pub bound_generic_params : Vec < GenericParam > ,
418
- /// The type being bounded
418
+ /// The type being bounded.
419
419
pub bounded_ty : P < Ty > ,
420
- /// Trait and lifetime bounds (`Clone+ Send+ 'static`)
420
+ /// Trait and lifetime bounds (`Clone + Send + 'static`).
421
421
pub bounds : GenericBounds ,
422
422
}
423
423
@@ -495,15 +495,15 @@ pub enum MetaItemKind {
495
495
NameValue ( Lit ) ,
496
496
}
497
497
498
- /// A Block (`{ .. }`).
498
+ /// A block (`{ .. }`).
499
499
///
500
500
/// E.g., `{ .. }` as in `fn foo() { .. }`.
501
501
#[ derive( Clone , RustcEncodable , RustcDecodable , Debug ) ]
502
502
pub struct Block {
503
- /// Statements in a block
503
+ /// The statements in the block.
504
504
pub stmts : Vec < Stmt > ,
505
505
pub id : NodeId ,
506
- /// Distinguishes between `unsafe { ... }` and `{ ... }`
506
+ /// Distinguishes between `unsafe { ... }` and `{ ... }`.
507
507
pub rules : BlockCheckMode ,
508
508
pub span : Span ,
509
509
}
@@ -908,11 +908,11 @@ pub enum MacStmtStyle {
908
908
/// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`.
909
909
#[ derive( Clone , RustcEncodable , RustcDecodable , Debug ) ]
910
910
pub struct Local {
911
+ pub id : NodeId ,
911
912
pub pat : P < Pat > ,
912
913
pub ty : Option < P < Ty > > ,
913
914
/// Initializer expression to set the value, if any.
914
915
pub init : Option < P < Expr > > ,
915
- pub id : NodeId ,
916
916
pub span : Span ,
917
917
pub attrs : ThinVec < Attribute > ,
918
918
}
@@ -970,7 +970,7 @@ pub struct AnonConst {
970
970
pub value : P < Expr > ,
971
971
}
972
972
973
- /// An expression
973
+ /// An expression.
974
974
#[ derive( Clone , RustcEncodable , RustcDecodable ) ]
975
975
pub struct Expr {
976
976
pub id : NodeId ,
@@ -984,26 +984,26 @@ pub struct Expr {
984
984
static_assert_size ! ( Expr , 96 ) ;
985
985
986
986
impl Expr {
987
- /// Whether this expression would be valid somewhere that expects a value; for example, an `if`
988
- /// condition.
987
+ /// Returns `true` if this expression would be valid somewhere that expects a value;
988
+ /// for example, an `if` condition.
989
989
pub fn returns ( & self ) -> bool {
990
990
if let ExprKind :: Block ( ref block, _) = self . node {
991
991
match block. stmts . last ( ) . map ( |last_stmt| & last_stmt. node ) {
992
- // implicit return
992
+ // Implicit return
993
993
Some ( & StmtKind :: Expr ( _) ) => true ,
994
994
Some ( & StmtKind :: Semi ( ref expr) ) => {
995
995
if let ExprKind :: Ret ( _) = expr. node {
996
- // last statement is explicit return
996
+ // Last statement is explicit return.
997
997
true
998
998
} else {
999
999
false
1000
1000
}
1001
1001
}
1002
- // This is a block that doesn't end in either an implicit or explicit return
1002
+ // This is a block that doesn't end in either an implicit or explicit return.
1003
1003
_ => false ,
1004
1004
}
1005
1005
} else {
1006
- // This is not a block, it is a value
1006
+ // This is not a block, it is a value.
1007
1007
true
1008
1008
}
1009
1009
}
@@ -2307,57 +2307,57 @@ impl Default for FnHeader {
2307
2307
2308
2308
#[ derive( Clone , RustcEncodable , RustcDecodable , Debug ) ]
2309
2309
pub enum ItemKind {
2310
- /// An `extern crate` item, with optional *original* crate name if the crate was renamed.
2310
+ /// An `extern crate` item, with the optional *original* crate name if the crate was renamed.
2311
2311
///
2312
2312
/// E.g., `extern crate foo` or `extern crate foo_bar as foo`.
2313
2313
ExternCrate ( Option < Name > ) ,
2314
- /// A use declaration (`use` or `pub use`) item .
2314
+ /// A use declaration item (`use`) .
2315
2315
///
2316
2316
/// E.g., `use foo;`, `use foo::bar;` or `use foo::bar as FooBar;`.
2317
2317
Use ( P < UseTree > ) ,
2318
- /// A static item (`static` or `pub static` ).
2318
+ /// A static item (`static`).
2319
2319
///
2320
2320
/// E.g., `static FOO: i32 = 42;` or `static FOO: &'static str = "bar";`.
2321
2321
Static ( P < Ty > , Mutability , P < Expr > ) ,
2322
- /// A constant item (`const` or `pub const` ).
2322
+ /// A constant item (`const`).
2323
2323
///
2324
2324
/// E.g., `const FOO: i32 = 42;`.
2325
2325
Const ( P < Ty > , P < Expr > ) ,
2326
- /// A function declaration (`fn` or `pub fn` ).
2326
+ /// A function declaration (`fn`).
2327
2327
///
2328
2328
/// E.g., `fn foo(bar: usize) -> usize { .. }`.
2329
2329
Fn ( P < FnDecl > , FnHeader , Generics , P < Block > ) ,
2330
- /// A module declaration (`mod` or `pub mod` ).
2330
+ /// A module declaration (`mod`).
2331
2331
///
2332
2332
/// E.g., `mod foo;` or `mod foo { .. }`.
2333
2333
Mod ( Mod ) ,
2334
- /// An external module (`extern` or `pub extern` ).
2334
+ /// An external module (`extern`).
2335
2335
///
2336
2336
/// E.g., `extern {}` or `extern "C" {}`.
2337
2337
ForeignMod ( ForeignMod ) ,
2338
2338
/// Module-level inline assembly (from `global_asm!()`).
2339
2339
GlobalAsm ( P < GlobalAsm > ) ,
2340
- /// A type alias (`type` or `pub type` ).
2340
+ /// A type alias (`type`).
2341
2341
///
2342
2342
/// E.g., `type Foo = Bar<u8>;`.
2343
2343
TyAlias ( P < Ty > , Generics ) ,
2344
2344
/// An opaque `impl Trait` type alias.
2345
2345
///
2346
2346
/// E.g., `type Foo = impl Bar + Boo;`.
2347
2347
OpaqueTy ( GenericBounds , Generics ) ,
2348
- /// An enum definition (`enum` or `pub enum` ).
2348
+ /// An enum definition (`enum`).
2349
2349
///
2350
2350
/// E.g., `enum Foo<A, B> { C<A>, D<B> }`.
2351
2351
Enum ( EnumDef , Generics ) ,
2352
- /// A struct definition (`struct` or `pub struct` ).
2352
+ /// A struct definition (`struct`).
2353
2353
///
2354
2354
/// E.g., `struct Foo<A> { x: A }`.
2355
2355
Struct ( VariantData , Generics ) ,
2356
- /// A union definition (`union` or `pub union` ).
2356
+ /// A union definition (`union`).
2357
2357
///
2358
2358
/// E.g., `union Foo<A, B> { x: A, y: B }`.
2359
2359
Union ( VariantData , Generics ) ,
2360
- /// A Trait declaration (`trait` or `pub trait`).
2360
+ /// A trait declaration (`trait`).
2361
2361
///
2362
2362
/// E.g., `trait Foo { .. }`, `trait Foo<T> { .. }` or `auto trait Foo {}`.
2363
2363
Trait ( IsAuto , Unsafety , Generics , GenericBounds , Vec < TraitItem > ) ,
0 commit comments