Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Release #8

Closed
aDotInTheVoid opened this issue Apr 30, 2022 · 4 comments
Closed

New Release #8

aDotInTheVoid opened this issue Apr 30, 2022 · 4 comments

Comments

@aDotInTheVoid
Copy link
Member

rust-lang/rust#93803

@aDotInTheVoid
Copy link
Member Author

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

@aDotInTheVoid
Copy link
Member Author

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

@aDotInTheVoid
Copy link
Member Author

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
Copy link
Member Author

rust-lang/rust#96680

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant