Skip to content

New Release #8

New issue

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

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

Already on GitHub? # to your account

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

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

No branches or pull requests

1 participant