Handle generic parameters.
This commit is contained in:
parent
cdf78073c5
commit
05812df603
25 changed files with 171 additions and 224 deletions
|
@ -2505,6 +2505,7 @@ pub struct OpaqueTy<'hir> {
|
|||
pub generics: &'hir Generics<'hir>,
|
||||
pub bounds: GenericBounds<'hir>,
|
||||
pub origin: OpaqueTyOrigin,
|
||||
pub in_trait: bool,
|
||||
}
|
||||
|
||||
/// From whence the opaque type came.
|
||||
|
@ -2518,12 +2519,6 @@ pub enum OpaqueTyOrigin {
|
|||
TyAlias,
|
||||
}
|
||||
|
||||
/// Placeholder representation of an `impl Trait` in a trait. Since this never gets lowered into a `ty::Opaque` of its own, we just keep this as
|
||||
#[derive(Debug, HashStable_Generic)]
|
||||
pub struct ImplTraitPlaceholder<'hir> {
|
||||
pub bounds: GenericBounds<'hir>,
|
||||
}
|
||||
|
||||
/// The various kinds of types recognized by the compiler.
|
||||
#[derive(Debug, HashStable_Generic)]
|
||||
pub enum TyKind<'hir> {
|
||||
|
@ -2550,12 +2545,9 @@ pub enum TyKind<'hir> {
|
|||
///
|
||||
/// The generic argument list contains the lifetimes (and in the future
|
||||
/// possibly parameters) that are actually bound on the `impl Trait`.
|
||||
OpaqueDef(ItemId, &'hir [GenericArg<'hir>]),
|
||||
/// A type that represents an `impl Trait` in a trait function. This is
|
||||
/// not an opaque type, since it acts more like an associated type than
|
||||
/// an opaque, and since it needs no generics since it inherits those
|
||||
/// from the item's parent.
|
||||
ImplTraitInTrait(ItemId),
|
||||
///
|
||||
/// The last parameter specifies whether this opaque appears in a trait definition.
|
||||
OpaqueDef(ItemId, &'hir [GenericArg<'hir>], bool),
|
||||
/// A trait object type `Bound1 + Bound2 + Bound3`
|
||||
/// where `Bound` is a trait or a lifetime.
|
||||
TraitObject(&'hir [PolyTraitRef<'hir>], &'hir Lifetime, TraitObjectSyntax),
|
||||
|
@ -3011,8 +3003,6 @@ pub enum ItemKind<'hir> {
|
|||
TyAlias(&'hir Ty<'hir>, &'hir Generics<'hir>),
|
||||
/// An opaque `impl Trait` type alias, e.g., `type Foo = impl Bar;`.
|
||||
OpaqueTy(OpaqueTy<'hir>),
|
||||
/// An `impl Trait` in a trait
|
||||
ImplTraitPlaceholder(ImplTraitPlaceholder<'hir>),
|
||||
/// An enum definition, e.g., `enum Foo<A, B> {C<A>, D<B>}`.
|
||||
Enum(EnumDef<'hir>, &'hir Generics<'hir>),
|
||||
/// A struct definition, e.g., `struct Foo<A> {x: A}`.
|
||||
|
@ -3081,7 +3071,6 @@ impl ItemKind<'_> {
|
|||
ItemKind::Trait(..) => "trait",
|
||||
ItemKind::TraitAlias(..) => "trait alias",
|
||||
ItemKind::Impl(..) => "implementation",
|
||||
ItemKind::ImplTraitPlaceholder(..) => "opaque type in trait",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue