Use ConstArg for const param defaults

Now everything that actually affects the type system (i.e., excluding
const blocks, enum variant discriminants, etc.) *should* be using
`ConstArg`.
This commit is contained in:
Noah Lev 2024-06-07 20:26:50 -07:00
parent 67fccb7045
commit 1c49d406b6
12 changed files with 34 additions and 26 deletions

View file

@ -548,7 +548,7 @@ pub enum GenericParamKind<'hir> {
Const {
ty: &'hir Ty<'hir>,
/// Optional default value for the const generic param
default: Option<&'hir AnonConst>,
default: Option<&'hir ConstArg<'hir>>,
is_host_effect: bool,
synthetic: bool,
},

View file

@ -367,7 +367,7 @@ pub trait Visitor<'v>: Sized {
fn visit_generic_param(&mut self, p: &'v GenericParam<'v>) -> Self::Result {
walk_generic_param(self, p)
}
fn visit_const_param_default(&mut self, _param: HirId, ct: &'v AnonConst) -> Self::Result {
fn visit_const_param_default(&mut self, _param: HirId, ct: &'v ConstArg<'v>) -> Self::Result {
walk_const_param_default(self, ct)
}
fn visit_generics(&mut self, g: &'v Generics<'v>) -> Self::Result {
@ -940,9 +940,9 @@ pub fn walk_generic_param<'v, V: Visitor<'v>>(
pub fn walk_const_param_default<'v, V: Visitor<'v>>(
visitor: &mut V,
ct: &'v AnonConst,
ct: &'v ConstArg<'v>,
) -> V::Result {
visitor.visit_anon_const(ct)
visitor.visit_const_arg(ct)
}
pub fn walk_generics<'v, V: Visitor<'v>>(visitor: &mut V, generics: &'v Generics<'v>) -> V::Result {