@@ -294,7 +294,7 @@ impl Visibility {
294
294
}
295
295
}
296
296
297
- /// Returns true if an item with this visibility is accessible from the given block.
297
+ /// Returns ` true` if an item with this visibility is accessible from the given block.
298
298
pub fn is_accessible_from < T : DefIdTree > ( self , module : DefId , tree : T ) -> bool {
299
299
let restriction = match self {
300
300
// Public items are visible everywhere.
@@ -309,7 +309,7 @@ impl Visibility {
309
309
tree. is_descendant_of ( module, restriction)
310
310
}
311
311
312
- /// Returns true if this visibility is at least as accessible as the given visibility
312
+ /// Returns ` true` if this visibility is at least as accessible as the given visibility
313
313
pub fn is_at_least < T : DefIdTree > ( self , vis : Visibility , tree : T ) -> bool {
314
314
let vis_restriction = match vis {
315
315
Visibility :: Public => return self == Visibility :: Public ,
@@ -320,7 +320,7 @@ impl Visibility {
320
320
self . is_accessible_from ( vis_restriction, tree)
321
321
}
322
322
323
- // Returns true if this item is visible anywhere in the local crate.
323
+ // Returns ` true` if this item is visible anywhere in the local crate.
324
324
pub fn is_visible_locally ( self ) -> bool {
325
325
match self {
326
326
Visibility :: Public => true ,
@@ -451,7 +451,7 @@ bitflags! {
451
451
// FIXME: Rename this to the actual property since it's used for generators too
452
452
const HAS_TY_CLOSURE = 1 << 9 ;
453
453
454
- // true if there are "names" of types and regions and so forth
454
+ // ` true` if there are "names" of types and regions and so forth
455
455
// that are local to a particular fn
456
456
const HAS_FREE_LOCAL_NAMES = 1 << 10 ;
457
457
@@ -544,14 +544,14 @@ impl<'tcx> TyS<'tcx> {
544
544
pub fn is_primitive_ty ( & self ) -> bool {
545
545
match self . sty {
546
546
TyKind :: Bool |
547
- TyKind :: Char |
548
- TyKind :: Int ( _) |
549
- TyKind :: Uint ( _) |
550
- TyKind :: Float ( _) |
551
- TyKind :: Infer ( InferTy :: IntVar ( _) ) |
552
- TyKind :: Infer ( InferTy :: FloatVar ( _) ) |
553
- TyKind :: Infer ( InferTy :: FreshIntTy ( _) ) |
554
- TyKind :: Infer ( InferTy :: FreshFloatTy ( _) ) => true ,
547
+ TyKind :: Char |
548
+ TyKind :: Int ( _) |
549
+ TyKind :: Uint ( _) |
550
+ TyKind :: Float ( _) |
551
+ TyKind :: Infer ( InferTy :: IntVar ( _) ) |
552
+ TyKind :: Infer ( InferTy :: FloatVar ( _) ) |
553
+ TyKind :: Infer ( InferTy :: FreshIntTy ( _) ) |
554
+ TyKind :: Infer ( InferTy :: FreshFloatTy ( _) ) => true ,
555
555
TyKind :: Ref ( _, x, _) => x. is_primitive_ty ( ) ,
556
556
_ => false ,
557
557
}
@@ -953,7 +953,7 @@ impl<'a, 'gcx, 'tcx> Generics {
953
953
_ => bug ! ( "expected lifetime parameter, but found another generic parameter" )
954
954
}
955
955
} else {
956
- tcx. generics_of ( self . parent . expect ( "parent_count> 0 but no parent?" ) )
956
+ tcx. generics_of ( self . parent . expect ( "parent_count > 0 but no parent?" ) )
957
957
. region_param ( param, tcx)
958
958
}
959
959
}
@@ -970,7 +970,7 @@ impl<'a, 'gcx, 'tcx> Generics {
970
970
_ => bug ! ( "expected type parameter, but found another generic parameter" )
971
971
}
972
972
} else {
973
- tcx. generics_of ( self . parent . expect ( "parent_count> 0 but no parent?" ) )
973
+ tcx. generics_of ( self . parent . expect ( "parent_count > 0 but no parent?" ) )
974
974
. type_param ( param, tcx)
975
975
}
976
976
}
@@ -993,6 +993,7 @@ impl<'a, 'gcx, 'tcx> GenericPredicates<'tcx> {
993
993
self . instantiate_into ( tcx, & mut instantiated, substs) ;
994
994
instantiated
995
995
}
996
+
996
997
pub fn instantiate_own ( & self , tcx : TyCtxt < ' a , ' gcx , ' tcx > , substs : & Substs < ' tcx > )
997
998
-> InstantiatedPredicates < ' tcx > {
998
999
InstantiatedPredicates {
@@ -1041,15 +1042,15 @@ impl<'a, 'gcx, 'tcx> GenericPredicates<'tcx> {
1041
1042
1042
1043
#[ derive( Clone , Copy , PartialEq , Eq , Hash , RustcEncodable , RustcDecodable ) ]
1043
1044
pub enum Predicate < ' tcx > {
1044
- /// Corresponds to `where Foo : Bar<A,B,C>`. `Foo` here would be
1045
+ /// Corresponds to `where Foo: Bar<A,B,C>`. `Foo` here would be
1045
1046
/// the `Self` type of the trait reference and `A`, `B`, and `C`
1046
1047
/// would be the type parameters.
1047
1048
Trait ( PolyTraitPredicate < ' tcx > ) ,
1048
1049
1049
- /// where `'a : 'b`
1050
+ /// where `'a: 'b`
1050
1051
RegionOutlives ( PolyRegionOutlivesPredicate < ' tcx > ) ,
1051
1052
1052
- /// where `T : 'a`
1053
+ /// where `T: 'a`
1053
1054
TypeOutlives ( PolyTypeOutlivesPredicate < ' tcx > ) ,
1054
1055
1055
1056
/// where `<T as TraitRef>::Name == X`, approximately.
@@ -1062,7 +1063,7 @@ pub enum Predicate<'tcx> {
1062
1063
/// trait must be object-safe
1063
1064
ObjectSafe ( DefId ) ,
1064
1065
1065
- /// No direct syntax. May be thought of as `where T : FnFoo<...>`
1066
+ /// No direct syntax. May be thought of as `where T: FnFoo<...>`
1066
1067
/// for some substitutions `...` and `T` being a closure type.
1067
1068
/// Satisfied (or refuted) once we know the closure's kind.
1068
1069
ClosureKind ( DefId , ClosureSubsts < ' tcx > , ClosureKind ) ,
@@ -1111,11 +1112,11 @@ impl<'a, 'gcx, 'tcx> Predicate<'tcx> {
1111
1112
//
1112
1113
// Let's start with an easy case. Consider two traits:
1113
1114
//
1114
- // trait Foo<'a> : Bar<'a,'a> { }
1115
+ // trait Foo<'a>: Bar<'a,'a> { }
1115
1116
// trait Bar<'b,'c> { }
1116
1117
//
1117
- // Now, if we have a trait reference `for<'x> T : Foo<'x>`, then
1118
- // we can deduce that `for<'x> T : Bar<'x,'x>`. Basically, if we
1118
+ // Now, if we have a trait reference `for<'x> T: Foo<'x>`, then
1119
+ // we can deduce that `for<'x> T: Bar<'x,'x>`. Basically, if we
1119
1120
// knew that `Foo<'x>` (for any 'x) then we also know that
1120
1121
// `Bar<'x,'x>` (for any 'x). This more-or-less falls out from
1121
1122
// normal substitution.
@@ -1128,21 +1129,21 @@ impl<'a, 'gcx, 'tcx> Predicate<'tcx> {
1128
1129
//
1129
1130
// Another example to be careful of is this:
1130
1131
//
1131
- // trait Foo1<'a> : for<'b> Bar1<'a,'b> { }
1132
+ // trait Foo1<'a>: for<'b> Bar1<'a,'b> { }
1132
1133
// trait Bar1<'b,'c> { }
1133
1134
//
1134
- // Here, if we have `for<'x> T : Foo1<'x>`, then what do we know?
1135
- // The answer is that we know `for<'x,'b> T : Bar1<'x,'b>`. The
1135
+ // Here, if we have `for<'x> T: Foo1<'x>`, then what do we know?
1136
+ // The answer is that we know `for<'x,'b> T: Bar1<'x,'b>`. The
1136
1137
// reason is similar to the previous example: any impl of
1137
- // `T:Foo1<'x>` must show that `for<'b> T : Bar1<'x, 'b>`. So
1138
+ // `T:Foo1<'x>` must show that `for<'b> T: Bar1<'x, 'b>`. So
1138
1139
// basically we would want to collapse the bound lifetimes from
1139
1140
// the input (`trait_ref`) and the supertraits.
1140
1141
//
1141
1142
// To achieve this in practice is fairly straightforward. Let's
1142
1143
// consider the more complicated scenario:
1143
1144
//
1144
- // - We start out with `for<'x> T : Foo1<'x>`. In this case, `'x`
1145
- // has a De Bruijn index of 1. We want to produce `for<'x,'b> T : Bar1<'x,'b>`,
1145
+ // - We start out with `for<'x> T: Foo1<'x>`. In this case, `'x`
1146
+ // has a De Bruijn index of 1. We want to produce `for<'x,'b> T: Bar1<'x,'b>`,
1146
1147
// where both `'x` and `'b` would have a DB index of 1.
1147
1148
// The substitution from the input trait-ref is therefore going to be
1148
1149
// `'a => 'x` (where `'x` has a DB index of 1).
@@ -1194,6 +1195,7 @@ impl<'a, 'gcx, 'tcx> Predicate<'tcx> {
1194
1195
pub struct TraitPredicate < ' tcx > {
1195
1196
pub trait_ref : TraitRef < ' tcx >
1196
1197
}
1198
+
1197
1199
pub type PolyTraitPredicate < ' tcx > = ty:: Binder < TraitPredicate < ' tcx > > ;
1198
1200
1199
1201
impl < ' tcx > TraitPredicate < ' tcx > {
@@ -1218,7 +1220,7 @@ impl<'tcx> PolyTraitPredicate<'tcx> {
1218
1220
}
1219
1221
1220
1222
#[ derive( Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Hash , Debug , RustcEncodable , RustcDecodable ) ]
1221
- pub struct OutlivesPredicate < A , B > ( pub A , pub B ) ; // `A : B`
1223
+ pub struct OutlivesPredicate < A , B > ( pub A , pub B ) ; // `A: B`
1222
1224
pub type PolyOutlivesPredicate < A , B > = ty:: Binder < OutlivesPredicate < A , B > > ;
1223
1225
pub type RegionOutlivesPredicate < ' tcx > = OutlivesPredicate < ty:: Region < ' tcx > ,
1224
1226
ty:: Region < ' tcx > > ;
@@ -1238,11 +1240,11 @@ pub type PolySubtypePredicate<'tcx> = ty::Binder<SubtypePredicate<'tcx>>;
1238
1240
/// This kind of predicate has no *direct* correspondent in the
1239
1241
/// syntax, but it roughly corresponds to the syntactic forms:
1240
1242
///
1241
- /// 1. `T : TraitRef<..., Item=Type>`
1243
+ /// 1. `T: TraitRef<..., Item=Type>`
1242
1244
/// 2. `<T as TraitRef<...>>::Item == Type` (NYI)
1243
1245
///
1244
1246
/// In particular, form #1 is "desugared" to the combination of a
1245
- /// normal trait predicate (`T : TraitRef<...>`) and one of these
1247
+ /// normal trait predicate (`T: TraitRef<...>`) and one of these
1246
1248
/// predicates. Form #2 is a broader form in that it also permits
1247
1249
/// equality between arbitrary types. Processing an instance of
1248
1250
/// Form #2 eventually yields one of these `ProjectionPredicate`
@@ -1256,14 +1258,14 @@ pub struct ProjectionPredicate<'tcx> {
1256
1258
pub type PolyProjectionPredicate < ' tcx > = Binder < ProjectionPredicate < ' tcx > > ;
1257
1259
1258
1260
impl < ' tcx > PolyProjectionPredicate < ' tcx > {
1259
- /// Returns the def-id of the associated item being projected.
1261
+ /// Returns the `DefId` of the associated item being projected.
1260
1262
pub fn item_def_id ( & self ) -> DefId {
1261
1263
self . skip_binder ( ) . projection_ty . item_def_id
1262
1264
}
1263
1265
1264
1266
pub fn to_poly_trait_ref ( & self , tcx : TyCtxt < ' _ , ' _ , ' _ > ) -> PolyTraitRef < ' tcx > {
1265
- // Note: unlike with TraitRef::to_poly_trait_ref(),
1266
- // self.0.trait_ref is permitted to have escaping regions.
1267
+ // Note: unlike with ` TraitRef::to_poly_trait_ref()` ,
1268
+ // ` self.0.trait_ref` is permitted to have escaping regions.
1267
1269
// This is because here `self` has a `Binder` and so does our
1268
1270
// return value, so we are preserving the number of binding
1269
1271
// levels.
@@ -1274,12 +1276,12 @@ impl<'tcx> PolyProjectionPredicate<'tcx> {
1274
1276
self . map_bound ( |predicate| predicate. ty )
1275
1277
}
1276
1278
1277
- /// The DefId of the TraitItem for the associated type.
1279
+ /// The ` DefId` of the ` TraitItem` for the associated type.
1278
1280
///
1279
- /// Note that this is not the DefId of the TraitRef containing this
1280
- /// associated type, which is in tcx.associated_item(projection_def_id()).container.
1281
+ /// Note that this is not the ` DefId` of the ` TraitRef` containing this
1282
+ /// associated type, which is in ` tcx.associated_item(projection_def_id()).container` .
1281
1283
pub fn projection_def_id ( & self ) -> DefId {
1282
- // ok to skip binder since trait def-id does not care about regions
1284
+ // okay to skip binder since trait def-id does not care about regions
1283
1285
self . skip_binder ( ) . projection_ty . item_def_id
1284
1286
}
1285
1287
}
@@ -1515,14 +1517,14 @@ impl UniverseIndex {
1515
1517
UniverseIndex :: from_u32 ( self . private . checked_add ( 1 ) . unwrap ( ) )
1516
1518
}
1517
1519
1518
- /// True if `self` can name a name from `other` -- in other words,
1520
+ /// Returns `true` if `self` can name a name from `other` -- in other words,
1519
1521
/// if the set of names in `self` is a superset of those in
1520
1522
/// `other` (`self >= other`).
1521
1523
pub fn can_name ( self , other : UniverseIndex ) -> bool {
1522
1524
self . private >= other. private
1523
1525
}
1524
1526
1525
- /// True if `self` cannot name some names from `other` -- in other
1527
+ /// Returns `true` if `self` cannot name some names from `other` -- in other
1526
1528
/// words, if the set of names in `self` is a strict subset of
1527
1529
/// those in `other` (`self < other`).
1528
1530
pub fn cannot_name ( self , other : UniverseIndex ) -> bool {
@@ -1574,7 +1576,7 @@ impl<'tcx> ParamEnv<'tcx> {
1574
1576
/// are revealed. This is suitable for monomorphized, post-typeck
1575
1577
/// environments like codegen or doing optimizations.
1576
1578
///
1577
- /// NB . If you want to have predicates in scope, use `ParamEnv::new`,
1579
+ /// N.B . If you want to have predicates in scope, use `ParamEnv::new`,
1578
1580
/// or invoke `param_env.with_reveal_all()`.
1579
1581
pub fn reveal_all ( ) -> Self {
1580
1582
Self :: new ( List :: empty ( ) , Reveal :: All )
@@ -1979,14 +1981,14 @@ impl ReprOptions {
1979
1981
self . int . unwrap_or ( attr:: SignedInt ( ast:: IntTy :: Isize ) )
1980
1982
}
1981
1983
1982
- /// Returns true if this `#[repr()]` should inhabit "smart enum
1984
+ /// Returns ` true` if this `#[repr()]` should inhabit "smart enum
1983
1985
/// layout" optimizations, such as representing `Foo<&T>` as a
1984
1986
/// single pointer.
1985
1987
pub fn inhibit_enum_layout_opt ( & self ) -> bool {
1986
1988
self . c ( ) || self . int . is_some ( )
1987
1989
}
1988
1990
1989
- /// Returns true if this `#[repr()]` should inhibit struct field reordering
1991
+ /// Returns ` true` if this `#[repr()]` should inhibit struct field reordering
1990
1992
/// optimizations, such as with repr(C) or repr(packed(1)).
1991
1993
pub fn inhibit_struct_field_reordering_opt ( & self ) -> bool {
1992
1994
!( self . flags & ReprFlags :: IS_UNOPTIMISABLE ) . is_empty ( ) || ( self . pack == 1 )
@@ -2089,7 +2091,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
2089
2091
self . flags . intersects ( AdtFlags :: IS_FUNDAMENTAL )
2090
2092
}
2091
2093
2092
- /// Returns true if this is PhantomData<T>.
2094
+ /// Returns ` true` if this is PhantomData<T>.
2093
2095
#[ inline]
2094
2096
pub fn is_phantom_data ( & self ) -> bool {
2095
2097
self . flags . intersects ( AdtFlags :: IS_PHANTOM_DATA )
@@ -2105,7 +2107,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
2105
2107
self . flags . intersects ( AdtFlags :: IS_RC )
2106
2108
}
2107
2109
2108
- /// Returns true if this is Box<T>.
2110
+ /// Returns ` true` if this is Box<T>.
2109
2111
#[ inline]
2110
2112
pub fn is_box ( & self ) -> bool {
2111
2113
self . flags . intersects ( AdtFlags :: IS_BOX )
@@ -2422,7 +2424,7 @@ impl<'a, 'tcx> ClosureKind {
2422
2424
}
2423
2425
}
2424
2426
2425
- /// True if this a type that impls this closure kind
2427
+ /// Returns `true` if this a type that impls this closure kind
2426
2428
/// must also implement `other`.
2427
2429
pub fn extends ( self , other : ty:: ClosureKind ) -> bool {
2428
2430
match ( self , other) {
@@ -2475,7 +2477,7 @@ impl<'tcx> TyS<'tcx> {
2475
2477
///
2476
2478
/// Note: prefer `ty.walk()` where possible.
2477
2479
pub fn maybe_walk < F > ( & ' tcx self , mut f : F )
2478
- where F : FnMut ( Ty < ' tcx > ) -> bool
2480
+ where F : FnMut ( Ty < ' tcx > ) -> bool
2479
2481
{
2480
2482
let mut walker = self . walk ( ) ;
2481
2483
while let Some ( ty) = walker. next ( ) {
@@ -2678,7 +2680,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2678
2680
as Box < dyn Iterator < Item = AssociatedItem > + ' a >
2679
2681
}
2680
2682
2681
- /// Returns true if the impls are the same polarity and the trait either
2683
+ /// Returns ` true` if the impls are the same polarity and the trait either
2682
2684
/// has no items or is annotated #[marker] and prevents item overrides.
2683
2685
pub fn impls_are_allowed_to_overlap ( self , def_id1 : DefId , def_id2 : DefId ) -> bool {
2684
2686
if self . features ( ) . overlapping_marker_traits {
@@ -2802,7 +2804,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2802
2804
attr:: contains_name ( & self . get_attrs ( did) , attr)
2803
2805
}
2804
2806
2805
- /// Returns true if this is an `auto trait`.
2807
+ /// Returns ` true` if this is an `auto trait`.
2806
2808
pub fn trait_is_auto ( self , trait_def_id : DefId ) -> bool {
2807
2809
self . trait_def ( trait_def_id) . has_auto_impl
2808
2810
}
0 commit comments