@@ -1345,7 +1345,7 @@ impl<'tcx> FnSig<'tcx> {
1345
1345
pub fn inputs ( & self ) -> & ' tcx [ Ty < ' tcx > ] {
1346
1346
& self . inputs_and_output [ ..self . inputs_and_output . len ( ) - 1 ]
1347
1347
}
1348
- /// The return type of this siganture .
1348
+ /// The return type of this signature .
1349
1349
pub fn output ( & self ) -> Ty < ' tcx > {
1350
1350
self . inputs_and_output [ self . inputs_and_output . len ( ) - 1 ]
1351
1351
}
@@ -2037,7 +2037,7 @@ impl<'tcx> Ty<'tcx> {
2037
2037
}
2038
2038
}
2039
2039
2040
- /// Creates a new [`Ty`] representing a reference to type `tm.ty` with mutability `tm.mutbl` in region `r` .
2040
+ /// Creates a reference with type and mutability for a certain [`Region`] .
2041
2041
#[ inline]
2042
2042
pub fn new_ref ( tcx : TyCtxt < ' tcx > , r : Region < ' tcx > , tm : TypeAndMut < ' tcx > ) -> Ty < ' tcx > {
2043
2043
Ty :: new ( tcx, Ref ( r, tm. ty , tm. mutbl ) )
@@ -2105,13 +2105,13 @@ impl<'tcx> Ty<'tcx> {
2105
2105
Ty :: new ( tcx, Slice ( ty) )
2106
2106
}
2107
2107
2108
- /// Creates a new [`Ty`] representing a tuple contining `ts` types .
2108
+ /// Create a new tuple type .
2109
2109
#[ inline]
2110
2110
pub fn new_tup ( tcx : TyCtxt < ' tcx > , ts : & [ Ty < ' tcx > ] ) -> Ty < ' tcx > {
2111
2111
if ts. is_empty ( ) { tcx. types . unit } else { Ty :: new ( tcx, Tuple ( tcx. mk_type_list ( ts) ) ) }
2112
2112
}
2113
2113
2114
- /// Creates a new [`Ty`] representing a tuple contining types from the iterator `iter` .
2114
+ /// Create a new [`Ty`] representing a tuple containing types from an iterator.
2115
2115
pub fn new_tup_from_iter < I , T > ( tcx : TyCtxt < ' tcx > , iter : I ) -> T :: Output
2116
2116
where
2117
2117
I : Iterator < Item = T > ,
@@ -2120,7 +2120,7 @@ impl<'tcx> Ty<'tcx> {
2120
2120
T :: collect_and_apply ( iter, |ts| Ty :: new_tup ( tcx, ts) )
2121
2121
}
2122
2122
2123
- /// Creates a new [`Ty`] representing a function definition type, with `def_id` and `args` generic args .
2123
+ /// Create a new [`Ty`] representing a function definition type.
2124
2124
#[ inline]
2125
2125
pub fn new_fn_def (
2126
2126
tcx : TyCtxt < ' tcx > ,
@@ -2350,7 +2350,7 @@ impl<'tcx> Ty<'tcx> {
2350
2350
}
2351
2351
}
2352
2352
2353
- /// Checks if this type is a silice type.
2353
+ /// `true` if this type is a slice type.
2354
2354
#[ inline]
2355
2355
pub fn is_slice ( self ) -> bool {
2356
2356
matches ! ( self . kind( ) , Slice ( _) )
@@ -2380,8 +2380,7 @@ impl<'tcx> Ty<'tcx> {
2380
2380
}
2381
2381
}
2382
2382
2383
- /// If the type is a slice, array, or a string slice, it will returns its element type.
2384
- /// If this type is not one of those, this function will panic.
2383
+ /// Return the element type of a slice, array, or a string slice, or panic.
2385
2384
pub fn sequence_element_type ( self , tcx : TyCtxt < ' tcx > ) -> Ty < ' tcx > {
2386
2385
match self . kind ( ) {
2387
2386
Array ( ty, _) | Slice ( ty) => * ty,
@@ -2447,7 +2446,7 @@ impl<'tcx> Ty<'tcx> {
2447
2446
self . is_ref ( ) || self . is_unsafe_ptr ( ) || self . is_fn_ptr ( )
2448
2447
}
2449
2448
2450
- /// Checks if this type is an [`Box`].
2449
+ /// `true` if this type is [`Box`].
2451
2450
#[ inline]
2452
2451
pub fn is_box ( self ) -> bool {
2453
2452
match self . kind ( ) {
@@ -2489,13 +2488,13 @@ impl<'tcx> Ty<'tcx> {
2489
2488
matches ! ( self . kind( ) , Float ( _) | Infer ( FloatVar ( _) ) )
2490
2489
}
2491
2490
2492
- /// Checks if this type is an unsized trait object(`dyn Trait`).
2491
+ /// `true` if this type is an unsized trait object (`dyn Trait`).
2493
2492
#[ inline]
2494
2493
pub fn is_trait ( self ) -> bool {
2495
2494
matches ! ( self . kind( ) , Dynamic ( _, _, ty:: Dyn ) )
2496
2495
}
2497
2496
2498
- /// Checks if this type is an sized trait object(`dyn* Trait`).
2497
+ /// `true` if this type is an sized trait object (`dyn* Trait`).
2499
2498
#[ inline]
2500
2499
pub fn is_dyn_star ( self ) -> bool {
2501
2500
matches ! ( self . kind( ) , Dynamic ( _, _, ty:: DynStar ) )
@@ -2524,7 +2523,7 @@ impl<'tcx> Ty<'tcx> {
2524
2523
matches ! ( self . kind( ) , Coroutine ( ..) )
2525
2524
}
2526
2525
2527
- /// Checks if this type is an intgeral type(signed, unsigned on infered) .
2526
+ /// `true` if this type is an integer type.
2528
2527
#[ inline]
2529
2528
pub fn is_integral ( self ) -> bool {
2530
2529
matches ! ( self . kind( ) , Infer ( IntVar ( _) ) | Int ( _) | Uint ( _) )
@@ -2546,19 +2545,19 @@ impl<'tcx> Ty<'tcx> {
2546
2545
matches ! ( self . kind( ) , Char )
2547
2546
}
2548
2547
2549
- /// Checks if this type is numeric(integral or floating point) .
2548
+ /// `true` if this type is an integer or floating point.
2550
2549
#[ inline]
2551
2550
pub fn is_numeric ( self ) -> bool {
2552
2551
self . is_integral ( ) || self . is_floating_point ( )
2553
2552
}
2554
2553
2555
- /// Checks if this type is a signed intiger .
2554
+ /// `true` if this type is a signed integer .
2556
2555
#[ inline]
2557
2556
pub fn is_signed ( self ) -> bool {
2558
2557
matches ! ( self . kind( ) , Int ( _) )
2559
2558
}
2560
2559
2561
- /// Checks if this type is `usize` or `isize`.
2560
+ /// `true` if this type is `usize` or `isize`.
2562
2561
#[ inline]
2563
2562
pub fn is_ptr_sized_integral ( self ) -> bool {
2564
2563
matches ! ( self . kind( ) , Int ( ty:: IntTy :: Isize ) | Uint ( ty:: UintTy :: Usize ) )
@@ -2632,7 +2631,7 @@ impl<'tcx> Ty<'tcx> {
2632
2631
}
2633
2632
}
2634
2633
2635
- /// If this type is a function definition or a function pointer, this will retunrn its signature. Otherwise, this function will panic.
2634
+ /// If this type is a function definition or a function pointer, return its signature. Otherwise, panic.
2636
2635
pub fn fn_sig ( self , tcx : TyCtxt < ' tcx > ) -> PolyFnSig < ' tcx > {
2637
2636
match self . kind ( ) {
2638
2637
FnDef ( def_id, args) => tcx. fn_sig ( * def_id) . instantiate ( tcx, args) ,
@@ -2648,13 +2647,13 @@ impl<'tcx> Ty<'tcx> {
2648
2647
}
2649
2648
}
2650
2649
2651
- /// Checks if this type is a function definition or a function pointer.
2650
+ /// `true` if this type is a function definition or a function pointer.
2652
2651
#[ inline]
2653
2652
pub fn is_fn ( self ) -> bool {
2654
2653
matches ! ( self . kind( ) , FnDef ( ..) | FnPtr ( _) )
2655
2654
}
2656
2655
2657
- /// Checks if this type is a function pointer.
2656
+ /// `true` if this type is a function pointer.
2658
2657
#[ inline]
2659
2658
pub fn is_fn_ptr ( self ) -> bool {
2660
2659
matches ! ( self . kind( ) , FnPtr ( _) )
@@ -2664,7 +2663,7 @@ impl<'tcx> Ty<'tcx> {
2664
2663
pub fn is_impl_trait ( self ) -> bool {
2665
2664
matches ! ( self . kind( ) , Alias ( ty:: Opaque , ..) )
2666
2665
}
2667
- /// Returns the `AdtDef` defining this type, if it is an ADT(struct,union or enum). If this type is not an ADT, returns `None`.
2666
+ /// Returns the `AdtDef` for this type's definition if it is an ADT, `None` otherwise .
2668
2667
#[ inline]
2669
2668
pub fn ty_adt_def ( self ) -> Option < AdtDef < ' tcx > > {
2670
2669
match self . kind ( ) {
0 commit comments