make docs render better by separating intro from rest of paragraph
This commit is contained in:
parent
84741ed8ce
commit
3be2843107
3 changed files with 39 additions and 13 deletions
|
|
@ -769,8 +769,9 @@ impl Features {
|
|||
}
|
||||
}
|
||||
|
||||
/// Some features are not allowed to be used together at the same time, if
|
||||
/// the two are present, produce an error.
|
||||
/// Some features are not allowed to be used together at the same time.
|
||||
///
|
||||
/// If the two are present, produce an error.
|
||||
pub const INCOMPATIBLE_FEATURES: &[(Symbol, Symbol)] = &[
|
||||
// Experimental match ergonomics rulesets are incompatible with each other, to simplify the
|
||||
// boolean logic required to tell which typing rules to use.
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// A complete reference to a trait. These take numerous guises in syntax,
|
||||
/// A complete reference to a trait.
|
||||
///
|
||||
/// These take numerous guises in syntax,
|
||||
/// but perhaps the most recognizable form is in a where-clause:
|
||||
/// ```ignore (illustrative)
|
||||
/// T: Foo<U>
|
||||
|
|
@ -241,7 +243,9 @@ impl ImplPolarity {
|
|||
}
|
||||
}
|
||||
|
||||
/// Polarity for a trait predicate. May either be negative or positive.
|
||||
/// Polarity for a trait predicate.
|
||||
///
|
||||
/// May either be negative or positive.
|
||||
/// Distinguished from [`ImplPolarity`] since we never compute goals with
|
||||
/// "reservation" level.
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
||||
|
|
@ -327,6 +331,7 @@ impl<I: Interner> ty::Binder<I, ExistentialPredicate<I>> {
|
|||
}
|
||||
|
||||
/// An existential reference to a trait, where `Self` is erased.
|
||||
///
|
||||
/// For example, the trait object `Trait<'a, 'b, X, Y>` is:
|
||||
/// ```ignore (illustrative)
|
||||
/// exists T. T: Trait<'a, 'b, X, Y>
|
||||
|
|
@ -442,6 +447,7 @@ impl<I: Interner> ExistentialProjection<I> {
|
|||
}
|
||||
|
||||
/// Extracts the underlying existential trait reference from this projection.
|
||||
///
|
||||
/// For example, if this is a projection of `exists T. <T as Iterator>::Item == X`,
|
||||
/// then this function would return an `exists T. T: Iterator` existential trait
|
||||
/// reference.
|
||||
|
|
@ -493,14 +499,17 @@ impl<I: Interner> ty::Binder<I, ExistentialProjection<I>> {
|
|||
#[cfg_attr(feature = "nightly", derive(Encodable, Decodable, HashStable_NoContext))]
|
||||
pub enum AliasTermKind {
|
||||
/// A projection `<Type as Trait>::AssocType`.
|
||||
///
|
||||
/// Can get normalized away if monomorphic enough.
|
||||
ProjectionTy,
|
||||
/// An associated type in an inherent `impl`
|
||||
InherentTy,
|
||||
/// An opaque type (usually from `impl Trait` in type aliases or function return types)
|
||||
///
|
||||
/// Can only be normalized away in PostAnalysis mode or its defining scope.
|
||||
OpaqueTy,
|
||||
/// A free type alias that actually checks its trait bounds.
|
||||
///
|
||||
/// Currently only used if the type alias references opaque types.
|
||||
/// Can always be normalized away.
|
||||
FreeTy,
|
||||
|
|
|
|||
|
|
@ -29,14 +29,17 @@ mod closure;
|
|||
)]
|
||||
pub enum AliasTyKind {
|
||||
/// A projection `<Type as Trait>::AssocType`.
|
||||
///
|
||||
/// Can get normalized away if monomorphic enough.
|
||||
Projection,
|
||||
/// An associated type in an inherent `impl`
|
||||
Inherent,
|
||||
/// An opaque type (usually from `impl Trait` in type aliases or function return types)
|
||||
///
|
||||
/// Can only be normalized away in PostAnalysis mode or its defining scope.
|
||||
Opaque,
|
||||
/// A type alias that actually checks its trait bounds.
|
||||
///
|
||||
/// Currently only used if the type alias references opaque types.
|
||||
/// Can always be normalized away.
|
||||
Free,
|
||||
|
|
@ -99,7 +102,9 @@ pub enum TyKind<I: Interner> {
|
|||
/// An array with the given length. Written as `[T; N]`.
|
||||
Array(I::Ty, I::Const),
|
||||
|
||||
/// A pattern newtype. Takes any type and restricts its valid values to its pattern.
|
||||
/// A pattern newtype.
|
||||
///
|
||||
/// Takes any type and restricts its valid values to its pattern.
|
||||
/// This will also change the layout to take advantage of this restriction.
|
||||
/// Only `Copy` and `Clone` will automatically get implemented for pattern types.
|
||||
/// Auto-traits treat this as if it were an aggregate with a single nested type.
|
||||
|
|
@ -116,8 +121,9 @@ pub enum TyKind<I: Interner> {
|
|||
/// `&'a mut T` or `&'a T`.
|
||||
Ref(I::Region, I::Ty, Mutability),
|
||||
|
||||
/// The anonymous type of a function declaration/definition. Each
|
||||
/// function has a unique type.
|
||||
/// The anonymous type of a function declaration/definition.
|
||||
///
|
||||
/// Each function has a unique type.
|
||||
///
|
||||
/// For the function `fn foo() -> i32 { 3 }` this type would be
|
||||
/// shown to the user as `fn() -> i32 {foo}`.
|
||||
|
|
@ -129,7 +135,9 @@ pub enum TyKind<I: Interner> {
|
|||
/// ```
|
||||
FnDef(I::FunctionId, I::GenericArgs),
|
||||
|
||||
/// A pointer to a function. Written as `fn() -> i32`.
|
||||
/// A pointer to a function.
|
||||
///
|
||||
/// Written as `fn() -> i32`.
|
||||
///
|
||||
/// Note that both functions and closures start out as either
|
||||
/// [FnDef] or [Closure] which can be then be coerced to this variant.
|
||||
|
|
@ -179,6 +187,7 @@ pub enum TyKind<I: Interner> {
|
|||
Coroutine(I::CoroutineId, I::GenericArgs),
|
||||
|
||||
/// A type representing the types stored inside a coroutine.
|
||||
///
|
||||
/// This should only appear as part of the `CoroutineArgs`.
|
||||
///
|
||||
/// Unlike upvars, the witness can reference lifetimes from
|
||||
|
|
@ -210,6 +219,7 @@ pub enum TyKind<I: Interner> {
|
|||
Tuple(I::Tys),
|
||||
|
||||
/// A projection, opaque type, free type alias, or inherent associated type.
|
||||
///
|
||||
/// All of these types are represented as pairs of def-id and args, and can
|
||||
/// be normalized, so they are grouped conceptually.
|
||||
Alias(AliasTyKind, AliasTy<I>),
|
||||
|
|
@ -253,8 +263,9 @@ pub enum TyKind<I: Interner> {
|
|||
/// inside of the type.
|
||||
Infer(InferTy),
|
||||
|
||||
/// A placeholder for a type which could not be computed; this is
|
||||
/// propagated to avoid useless error messages.
|
||||
/// A placeholder for a type which could not be computed.
|
||||
///
|
||||
/// This is propagated to avoid useless error messages.
|
||||
Error(I::ErrorGuaranteed),
|
||||
}
|
||||
|
||||
|
|
@ -282,7 +293,9 @@ impl<I: Interner> TyKind<I> {
|
|||
}
|
||||
|
||||
/// Returns `true` when the outermost type cannot be further normalized,
|
||||
/// resolved, or instantiated. This includes all primitive types, but also
|
||||
/// resolved, or instantiated.
|
||||
///
|
||||
/// This includes all primitive types, but also
|
||||
/// things like ADTs and trait objects, since even if their arguments or
|
||||
/// nested types may be further simplified, the outermost [`ty::TyKind`] or
|
||||
/// type constructor remains the same.
|
||||
|
|
@ -481,6 +494,7 @@ impl<I: Interner> AliasTy<I> {
|
|||
}
|
||||
|
||||
/// Extracts the underlying trait reference and own args from this projection.
|
||||
///
|
||||
/// For example, if this is a projection of `<T as StreamingIterator>::Item<'a>`,
|
||||
/// then this function would return a `T: StreamingIterator` trait reference and
|
||||
/// `['a]` as the own args.
|
||||
|
|
@ -490,6 +504,7 @@ impl<I: Interner> AliasTy<I> {
|
|||
}
|
||||
|
||||
/// Extracts the underlying trait reference from this projection.
|
||||
///
|
||||
/// For example, if this is a projection of `<T as Iterator>::Item`,
|
||||
/// then this function would return a `T: Iterator` trait reference.
|
||||
///
|
||||
|
|
@ -593,8 +608,9 @@ pub enum InferTy {
|
|||
FloatVar(FloatVid),
|
||||
|
||||
/// A [`FreshTy`][Self::FreshTy] is one that is generated as a replacement
|
||||
/// for an unbound type variable. This is convenient for caching etc. See
|
||||
/// `TypeFreshener` for more details.
|
||||
/// for an unbound type variable.
|
||||
///
|
||||
/// This is convenient for caching etc. See `TypeFreshener` for more details.
|
||||
///
|
||||
/// Compare with [`TyVar`][Self::TyVar].
|
||||
FreshTy(u32),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue