]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_hir/src/arena.rs
Rollup merge of #83683 - tblah:riscv64linux_links, r=Mark-Simulacrum
[rust.git] / compiler / rustc_hir / src / arena.rs
1 /// This declares a list of types which can be allocated by `Arena`.
2 ///
3 /// The `few` modifier will cause allocation to use the shared arena and recording the destructor.
4 /// This is faster and more memory efficient if there's only a few allocations of the type.
5 /// Leaving `few` out will cause the type to get its own dedicated `TypedArena` which is
6 /// faster and more memory efficient if there is lots of allocations.
7 ///
8 /// Specifying the `decode` modifier will add decode impls for `&T` and `&[T]`,
9 /// where `T` is the type listed. These impls will appear in the implement_ty_decoder! macro.
10 #[macro_export]
11 macro_rules! arena_types {
12     ($macro:path, $args:tt, $tcx:lifetime) => (
13         $macro!($args, [
14             // HIR types
15             [few] hir_krate: rustc_hir::Crate<$tcx>,
16             [] arm: rustc_hir::Arm<$tcx>,
17             [] asm_operand: (rustc_hir::InlineAsmOperand<$tcx>, Span),
18             [] asm_template: rustc_ast::InlineAsmTemplatePiece,
19             [] attribute: rustc_ast::Attribute,
20             [] block: rustc_hir::Block<$tcx>,
21             [] bare_fn_ty: rustc_hir::BareFnTy<$tcx>,
22             [few] global_asm: rustc_hir::GlobalAsm,
23             [] generic_arg: rustc_hir::GenericArg<$tcx>,
24             [] generic_args: rustc_hir::GenericArgs<$tcx>,
25             [] generic_bound: rustc_hir::GenericBound<$tcx>,
26             [] generic_param: rustc_hir::GenericParam<$tcx>,
27             [] expr: rustc_hir::Expr<$tcx>,
28             [] expr_field: rustc_hir::ExprField<$tcx>,
29             [] pat_field: rustc_hir::PatField<$tcx>,
30             [] fn_decl: rustc_hir::FnDecl<$tcx>,
31             [] foreign_item: rustc_hir::ForeignItem<$tcx>,
32             [few] foreign_item_ref: rustc_hir::ForeignItemRef<$tcx>,
33             [] impl_item_ref: rustc_hir::ImplItemRef<$tcx>,
34             [few] inline_asm: rustc_hir::InlineAsm<$tcx>,
35             [few] llvm_inline_asm: rustc_hir::LlvmInlineAsm<$tcx>,
36             [] local: rustc_hir::Local<$tcx>,
37             [few] macro_def: rustc_hir::MacroDef<$tcx>,
38             [] param: rustc_hir::Param<$tcx>,
39             [] pat: rustc_hir::Pat<$tcx>,
40             [] path: rustc_hir::Path<$tcx>,
41             [] path_segment: rustc_hir::PathSegment<$tcx>,
42             [] poly_trait_ref: rustc_hir::PolyTraitRef<$tcx>,
43             [] qpath: rustc_hir::QPath<$tcx>,
44             [] stmt: rustc_hir::Stmt<$tcx>,
45             [] field_def: rustc_hir::FieldDef<$tcx>,
46             [] trait_item_ref: rustc_hir::TraitItemRef,
47             [] ty: rustc_hir::Ty<$tcx>,
48             [] type_binding: rustc_hir::TypeBinding<$tcx>,
49             [] variant: rustc_hir::Variant<$tcx>,
50             [] where_predicate: rustc_hir::WherePredicate<$tcx>,
51         ], $tcx);
52     )
53 }