put hir::AnonConst
on the hir arena
This commit is contained in:
parent
e7da0fa62f
commit
4dc46f7f17
11 changed files with 47 additions and 41 deletions
|
@ -230,8 +230,8 @@ impl<'hir> PathSegment<'hir> {
|
|||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, HashStable_Generic)]
|
||||
pub struct ConstArg {
|
||||
pub value: AnonConst,
|
||||
pub struct ConstArg<'hir> {
|
||||
pub value: &'hir AnonConst,
|
||||
pub span: Span,
|
||||
/// Indicates whether this comes from a `~const` desugaring.
|
||||
pub is_desugared_from_effects: bool,
|
||||
|
@ -253,7 +253,7 @@ impl InferArg {
|
|||
pub enum GenericArg<'hir> {
|
||||
Lifetime(&'hir Lifetime),
|
||||
Type(&'hir Ty<'hir>),
|
||||
Const(ConstArg),
|
||||
Const(ConstArg<'hir>),
|
||||
Infer(InferArg),
|
||||
}
|
||||
|
||||
|
@ -491,7 +491,7 @@ pub enum GenericParamKind<'hir> {
|
|||
Const {
|
||||
ty: &'hir Ty<'hir>,
|
||||
/// Optional default value for the const generic param
|
||||
default: Option<AnonConst>,
|
||||
default: Option<&'hir AnonConst>,
|
||||
is_host_effect: bool,
|
||||
},
|
||||
}
|
||||
|
@ -1563,12 +1563,12 @@ impl fmt::Display for ConstContext {
|
|||
pub type Lit = Spanned<LitKind>;
|
||||
|
||||
#[derive(Copy, Clone, Debug, HashStable_Generic)]
|
||||
pub enum ArrayLen {
|
||||
pub enum ArrayLen<'hir> {
|
||||
Infer(InferArg),
|
||||
Body(AnonConst),
|
||||
Body(&'hir AnonConst),
|
||||
}
|
||||
|
||||
impl ArrayLen {
|
||||
impl ArrayLen<'_> {
|
||||
pub fn hir_id(&self) -> HirId {
|
||||
match self {
|
||||
ArrayLen::Infer(InferArg { hir_id, .. }) | ArrayLen::Body(AnonConst { hir_id, .. }) => {
|
||||
|
@ -1965,7 +1965,7 @@ pub enum ExprKind<'hir> {
|
|||
///
|
||||
/// E.g., `[1; 5]`. The first expression is the element
|
||||
/// to be repeated; the second is the number of times to repeat it.
|
||||
Repeat(&'hir Expr<'hir>, ArrayLen),
|
||||
Repeat(&'hir Expr<'hir>, ArrayLen<'hir>),
|
||||
|
||||
/// A suspension point for coroutines (i.e., `yield <expr>`).
|
||||
Yield(&'hir Expr<'hir>, YieldSource),
|
||||
|
@ -2345,7 +2345,7 @@ pub struct TypeBinding<'hir> {
|
|||
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||
pub enum Term<'hir> {
|
||||
Ty(&'hir Ty<'hir>),
|
||||
Const(AnonConst),
|
||||
Const(&'hir AnonConst),
|
||||
}
|
||||
|
||||
impl<'hir> From<&'hir Ty<'hir>> for Term<'hir> {
|
||||
|
@ -2354,8 +2354,8 @@ impl<'hir> From<&'hir Ty<'hir>> for Term<'hir> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'hir> From<AnonConst> for Term<'hir> {
|
||||
fn from(c: AnonConst) -> Self {
|
||||
impl<'hir> From<&'hir AnonConst> for Term<'hir> {
|
||||
fn from(c: &'hir AnonConst) -> Self {
|
||||
Term::Const(c)
|
||||
}
|
||||
}
|
||||
|
@ -2646,7 +2646,7 @@ pub enum TyKind<'hir> {
|
|||
/// A variable length slice (i.e., `[T]`).
|
||||
Slice(&'hir Ty<'hir>),
|
||||
/// A fixed length array (i.e., `[T; n]`).
|
||||
Array(&'hir Ty<'hir>, ArrayLen),
|
||||
Array(&'hir Ty<'hir>, ArrayLen<'hir>),
|
||||
/// A raw pointer (i.e., `*const T` or `*mut T`).
|
||||
Ptr(MutTy<'hir>),
|
||||
/// A reference (i.e., `&'a T` or `&'a mut T`).
|
||||
|
@ -2675,7 +2675,7 @@ pub enum TyKind<'hir> {
|
|||
/// where `Bound` is a trait or a lifetime.
|
||||
TraitObject(&'hir [PolyTraitRef<'hir>], &'hir Lifetime, TraitObjectSyntax),
|
||||
/// Unused for now.
|
||||
Typeof(AnonConst),
|
||||
Typeof(&'hir AnonConst),
|
||||
/// `TyKind::Infer` means the type should be inferred instead of it having been
|
||||
/// specified. This can appear anywhere in a type.
|
||||
Infer,
|
||||
|
@ -2708,10 +2708,10 @@ pub enum InlineAsmOperand<'hir> {
|
|||
out_expr: Option<&'hir Expr<'hir>>,
|
||||
},
|
||||
Const {
|
||||
anon_const: AnonConst,
|
||||
anon_const: &'hir AnonConst,
|
||||
},
|
||||
SymFn {
|
||||
anon_const: AnonConst,
|
||||
anon_const: &'hir AnonConst,
|
||||
},
|
||||
SymStatic {
|
||||
path: QPath<'hir>,
|
||||
|
@ -2913,7 +2913,7 @@ pub struct Variant<'hir> {
|
|||
/// Fields and constructor id of the variant.
|
||||
pub data: VariantData<'hir>,
|
||||
/// Explicit discriminant (e.g., `Foo = 1`).
|
||||
pub disr_expr: Option<AnonConst>,
|
||||
pub disr_expr: Option<&'hir AnonConst>,
|
||||
/// Span
|
||||
pub span: Span,
|
||||
}
|
||||
|
@ -3833,7 +3833,7 @@ mod size_asserts {
|
|||
static_assert_size!(FnDecl<'_>, 40);
|
||||
static_assert_size!(ForeignItem<'_>, 72);
|
||||
static_assert_size!(ForeignItemKind<'_>, 40);
|
||||
static_assert_size!(GenericArg<'_>, 32);
|
||||
static_assert_size!(GenericArg<'_>, 24);
|
||||
static_assert_size!(GenericBound<'_>, 48);
|
||||
static_assert_size!(Generics<'_>, 56);
|
||||
static_assert_size!(Impl<'_>, 80);
|
||||
|
|
|
@ -338,7 +338,7 @@ pub trait Visitor<'v>: Sized {
|
|||
fn visit_pat_field(&mut self, f: &'v PatField<'v>) -> Self::Result {
|
||||
walk_pat_field(self, f)
|
||||
}
|
||||
fn visit_array_length(&mut self, len: &'v ArrayLen) -> Self::Result {
|
||||
fn visit_array_length(&mut self, len: &'v ArrayLen<'v>) -> Self::Result {
|
||||
walk_array_len(self, len)
|
||||
}
|
||||
fn visit_anon_const(&mut self, c: &'v AnonConst) -> Self::Result {
|
||||
|
@ -703,7 +703,7 @@ pub fn walk_pat_field<'v, V: Visitor<'v>>(visitor: &mut V, field: &'v PatField<'
|
|||
visitor.visit_pat(field.pat)
|
||||
}
|
||||
|
||||
pub fn walk_array_len<'v, V: Visitor<'v>>(visitor: &mut V, len: &'v ArrayLen) -> V::Result {
|
||||
pub fn walk_array_len<'v, V: Visitor<'v>>(visitor: &mut V, len: &'v ArrayLen<'v>) -> V::Result {
|
||||
match len {
|
||||
// FIXME: Use `visit_infer` here.
|
||||
ArrayLen::Infer(InferArg { hir_id, span: _ }) => visitor.visit_id(*hir_id),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue