Skip to content

New Release #8

Closed
Closed
@aDotInTheVoid

Description

@aDotInTheVoid
Member

Activity

aDotInTheVoid

aDotInTheVoid commented on Apr 30, 2022

@aDotInTheVoid
MemberAuthor

Looks like they ended up spliting where and paramus in clean, so no change for us!

aDotInTheVoid

aDotInTheVoid commented on Apr 30, 2022

@aDotInTheVoid
MemberAuthor

Although it might be worth thinking about putting all the bounds in where anyway, and none in params

aDotInTheVoid

aDotInTheVoid commented on Apr 30, 2022

@aDotInTheVoid
MemberAuthor

Something like:

#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq)]
pub struct Generics {
    pub params: Vec<GenericParamDef>,
    pub where_predicates: Vec<WherePredicate>,
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct GenericParamDef {
    pub name: String,
    pub kind: GenericParamDefKind,
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum GenericParamDefKind {
    Lifetime,
    Type { default: Option<Type> },
    Const { ty: Type, default: Option<String> },
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum WherePredicate {
    BoundPredicate { ty: Type, bounds: Vec<GenericBound> },
    RegionPredicate { lifetime: String, bounds: Vec<GenericBound> },
    EqPredicate { lhs: Type, rhs: Term },
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum GenericBound {
    TraitBound {
        #[serde(rename = "trait")]
        trait_: Type,
        /// Used for HRTBs
        generic_params: Vec<GenericParamDef>,
        modifier: TraitBoundModifier,
    },
    Outlives(String),
}

so GenericParamDefKind doesn't store GenericBounds

aDotInTheVoid

aDotInTheVoid commented on May 18, 2022

@aDotInTheVoid
MemberAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @aDotInTheVoid

        Issue actions

          New Release · Issue #8 · rust-lang/rustdoc-types