1
Fork 0

Alloc hir::Lit in an arena to remove the destructor from Expr

This allows allocating `Expr`s into a dropless arena, which is useful
for using length prefixed thing slices in HIR, since these can only be
allocated in the dropless arena and not in a typed arena. This is
something I'm working on.
This commit is contained in:
Nilstrieb 2023-03-25 10:12:35 +00:00
parent 1b50ea9abb
commit 34ed5c3efc
9 changed files with 34 additions and 38 deletions

View file

@ -51,6 +51,7 @@ macro_rules! arena_types {
[] type_binding: rustc_hir::TypeBinding<'tcx>,
[] variant: rustc_hir::Variant<'tcx>,
[] where_predicate: rustc_hir::WherePredicate<'tcx>,
[] lit: rustc_hir::Lit,
]);
)
}

View file

@ -1957,7 +1957,7 @@ pub enum ExprKind<'hir> {
/// A unary operation (e.g., `!x`, `*x`).
Unary(UnOp, &'hir Expr<'hir>),
/// A literal (e.g., `1`, `"foo"`).
Lit(Lit),
Lit(&'hir Lit),
/// A cast (e.g., `foo as f64`).
Cast(&'hir Expr<'hir>, &'hir Ty<'hir>),
/// A type reference (e.g., `Foo`).