add eq constraints on associated constants
This commit is contained in:
parent
a34c079752
commit
0765999622
23 changed files with 195 additions and 113 deletions
|
@ -224,7 +224,7 @@ pub enum AngleBracketedArg {
|
|||
/// Argument for a generic parameter.
|
||||
Arg(GenericArg),
|
||||
/// Constraint for an associated item.
|
||||
Constraint(AssocTyConstraint),
|
||||
Constraint(AssocConstraint),
|
||||
}
|
||||
|
||||
impl AngleBracketedArg {
|
||||
|
@ -1843,19 +1843,21 @@ impl UintTy {
|
|||
/// A constraint on an associated type (e.g., `A = Bar` in `Foo<A = Bar>` or
|
||||
/// `A: TraitA + TraitB` in `Foo<A: TraitA + TraitB>`).
|
||||
#[derive(Clone, Encodable, Decodable, Debug)]
|
||||
pub struct AssocTyConstraint {
|
||||
pub struct AssocConstraint {
|
||||
pub id: NodeId,
|
||||
pub ident: Ident,
|
||||
pub gen_args: Option<GenericArgs>,
|
||||
pub kind: AssocTyConstraintKind,
|
||||
pub kind: AssocConstraintKind,
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
/// The kinds of an `AssocTyConstraint`.
|
||||
/// The kinds of an `AssocConstraint`.
|
||||
#[derive(Clone, Encodable, Decodable, Debug)]
|
||||
pub enum AssocTyConstraintKind {
|
||||
/// E.g., `A = Bar` in `Foo<A = Bar>`.
|
||||
pub enum AssocConstraintKind {
|
||||
/// E.g., `A = Bar` in `Foo<A = Bar>` where A is an associated type.
|
||||
Equality { ty: P<Ty> },
|
||||
/// E.g., `A = 3` in `Foo<N = 3>` where N is an associated const.
|
||||
ConstEquality { c: AnonConst },
|
||||
/// E.g. `A: TraitA + TraitB` in `Foo<A: TraitA + TraitB>`.
|
||||
Bound { bounds: GenericBounds },
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue