about summary refs log tree commit diff
path: root/compiler/rustc_hir/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-17 05:12:12 +0000
committerbors <bors@rust-lang.org>2023-04-17 05:12:12 +0000
commit53ac4f8e2fc15e49ef3a04f98622a9b9db755fd4 (patch)
tree6704a4ed47697a967760b6f0de26dbe4f77a4ef2 /compiler/rustc_hir/src
parent5546cb64f6fbba70529582bbe58a40ba4a8ed9fc (diff)
parent34ed5c3efc839913d2dcfcbc60e8f11c3423d87b (diff)
downloadrust-53ac4f8e2fc15e49ef3a04f98622a9b9db755fd4.tar.gz
rust-53ac4f8e2fc15e49ef3a04f98622a9b9db755fd4.zip
Auto merge of #109588 - Nilstrieb:dropless-expr, r=compiler-errors
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.
Diffstat (limited to 'compiler/rustc_hir/src')
-rw-r--r--compiler/rustc_hir/src/arena.rs1
-rw-r--r--compiler/rustc_hir/src/hir.rs2
2 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_hir/src/arena.rs b/compiler/rustc_hir/src/arena.rs
index c89e7eb75f8..3e5b3c498ee 100644
--- a/compiler/rustc_hir/src/arena.rs
+++ b/compiler/rustc_hir/src/arena.rs
@@ -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,
         ]);
     )
 }
diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs
index 35a72f868fb..b274e628079 100644
--- a/compiler/rustc_hir/src/hir.rs
+++ b/compiler/rustc_hir/src/hir.rs
@@ -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`).