@@ -29,14 +29,17 @@ mod closure;
2929) ]
3030pub enum AliasTyKind {
3131 /// A projection `<Type as Trait>::AssocType`.
32+ ///
3233 /// Can get normalized away if monomorphic enough.
3334 Projection ,
3435 /// An associated type in an inherent `impl`
3536 Inherent ,
3637 /// An opaque type (usually from `impl Trait` in type aliases or function return types)
38+ ///
3739 /// Can only be normalized away in PostAnalysis mode or its defining scope.
3840 Opaque ,
3941 /// A type alias that actually checks its trait bounds.
42+ ///
4043 /// Currently only used if the type alias references opaque types.
4144 /// Can always be normalized away.
4245 Free ,
@@ -99,7 +102,9 @@ pub enum TyKind<I: Interner> {
99102 /// An array with the given length. Written as `[T; N]`.
100103 Array ( I :: Ty , I :: Const ) ,
101104
102- /// A pattern newtype. Takes any type and restricts its valid values to its pattern.
105+ /// A pattern newtype.
106+ ///
107+ /// Takes any type and restricts its valid values to its pattern.
103108 /// This will also change the layout to take advantage of this restriction.
104109 /// Only `Copy` and `Clone` will automatically get implemented for pattern types.
105110 /// Auto-traits treat this as if it were an aggregate with a single nested type.
@@ -116,8 +121,9 @@ pub enum TyKind<I: Interner> {
116121 /// `&'a mut T` or `&'a T`.
117122 Ref ( I :: Region , I :: Ty , Mutability ) ,
118123
119- /// The anonymous type of a function declaration/definition. Each
120- /// function has a unique type.
124+ /// The anonymous type of a function declaration/definition.
125+ ///
126+ /// Each function has a unique type.
121127 ///
122128 /// For the function `fn foo() -> i32 { 3 }` this type would be
123129 /// shown to the user as `fn() -> i32 {foo}`.
@@ -129,7 +135,9 @@ pub enum TyKind<I: Interner> {
129135 /// ```
130136 FnDef ( I :: FunctionId , I :: GenericArgs ) ,
131137
132- /// A pointer to a function. Written as `fn() -> i32`.
138+ /// A pointer to a function.
139+ ///
140+ /// Written as `fn() -> i32`.
133141 ///
134142 /// Note that both functions and closures start out as either
135143 /// [FnDef] or [Closure] which can be then be coerced to this variant.
@@ -179,6 +187,7 @@ pub enum TyKind<I: Interner> {
179187 Coroutine ( I :: CoroutineId , I :: GenericArgs ) ,
180188
181189 /// A type representing the types stored inside a coroutine.
190+ ///
182191 /// This should only appear as part of the `CoroutineArgs`.
183192 ///
184193 /// Unlike upvars, the witness can reference lifetimes from
@@ -210,6 +219,7 @@ pub enum TyKind<I: Interner> {
210219 Tuple ( I :: Tys ) ,
211220
212221 /// A projection, opaque type, free type alias, or inherent associated type.
222+ ///
213223 /// All of these types are represented as pairs of def-id and args, and can
214224 /// be normalized, so they are grouped conceptually.
215225 Alias ( AliasTyKind , AliasTy < I > ) ,
@@ -253,8 +263,9 @@ pub enum TyKind<I: Interner> {
253263 /// inside of the type.
254264 Infer ( InferTy ) ,
255265
256- /// A placeholder for a type which could not be computed; this is
257- /// propagated to avoid useless error messages.
266+ /// A placeholder for a type which could not be computed.
267+ ///
268+ /// This is propagated to avoid useless error messages.
258269 Error ( I :: ErrorGuaranteed ) ,
259270}
260271
@@ -282,7 +293,9 @@ impl<I: Interner> TyKind<I> {
282293 }
283294
284295 /// Returns `true` when the outermost type cannot be further normalized,
285- /// resolved, or instantiated. This includes all primitive types, but also
296+ /// resolved, or instantiated.
297+ ///
298+ /// This includes all primitive types, but also
286299 /// things like ADTs and trait objects, since even if their arguments or
287300 /// nested types may be further simplified, the outermost [`ty::TyKind`] or
288301 /// type constructor remains the same.
@@ -481,6 +494,7 @@ impl<I: Interner> AliasTy<I> {
481494 }
482495
483496 /// Extracts the underlying trait reference and own args from this projection.
497+ ///
484498 /// For example, if this is a projection of `<T as StreamingIterator>::Item<'a>`,
485499 /// then this function would return a `T: StreamingIterator` trait reference and
486500 /// `['a]` as the own args.
@@ -490,6 +504,7 @@ impl<I: Interner> AliasTy<I> {
490504 }
491505
492506 /// Extracts the underlying trait reference from this projection.
507+ ///
493508 /// For example, if this is a projection of `<T as Iterator>::Item`,
494509 /// then this function would return a `T: Iterator` trait reference.
495510 ///
@@ -593,8 +608,9 @@ pub enum InferTy {
593608 FloatVar ( FloatVid ) ,
594609
595610 /// A [`FreshTy`][Self::FreshTy] is one that is generated as a replacement
596- /// for an unbound type variable. This is convenient for caching etc. See
597- /// `TypeFreshener` for more details.
611+ /// for an unbound type variable.
612+ ///
613+ /// This is convenient for caching etc. See `TypeFreshener` for more details.
598614 ///
599615 /// Compare with [`TyVar`][Self::TyVar].
600616 FreshTy ( u32 ) ,
0 commit comments