Closed aDotInTheVoid closed 2 years ago
Looks like they ended up spliting where and paramus in clean, so no change for us!
Although it might be worth thinking about putting all the bounds in where anyway, and none in params
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 GenericBound
s
https://github.com/rust-lang/rust/pull/93803