]> git.lizzy.rs Git - rust.git/blob - src/librustc_hir/arena.rs
Auto merge of #71321 - matthewjasper:alloc-min-spec, r=sfackler
[rust.git] / src / librustc_hir / 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             [] attribute: rustc_ast::ast::Attribute,
18             [] block: rustc_hir::Block<$tcx>,
19             [] bare_fn_ty: rustc_hir::BareFnTy<$tcx>,
20             [few] global_asm: rustc_hir::GlobalAsm,
21             [] generic_arg: rustc_hir::GenericArg<$tcx>,
22             [] generic_args: rustc_hir::GenericArgs<$tcx>,
23             [] generic_bound: rustc_hir::GenericBound<$tcx>,
24             [] generic_param: rustc_hir::GenericParam<$tcx>,
25             [] expr: rustc_hir::Expr<$tcx>,
26             [] field: rustc_hir::Field<$tcx>,
27             [] field_pat: rustc_hir::FieldPat<$tcx>,
28             [] fn_decl: rustc_hir::FnDecl<$tcx>,
29             [] foreign_item: rustc_hir::ForeignItem<$tcx>,
30             [] impl_item_ref: rustc_hir::ImplItemRef<$tcx>,
31             [] inline_asm: rustc_hir::LlvmInlineAsm<$tcx>,
32             [] local: rustc_hir::Local<$tcx>,
33             [few] macro_def: rustc_hir::MacroDef<$tcx>,
34             [] param: rustc_hir::Param<$tcx>,
35             [] pat: rustc_hir::Pat<$tcx>,
36             [] path: rustc_hir::Path<$tcx>,
37             [] path_segment: rustc_hir::PathSegment<$tcx>,
38             [] poly_trait_ref: rustc_hir::PolyTraitRef<$tcx>,
39             [] qpath: rustc_hir::QPath<$tcx>,
40             [] stmt: rustc_hir::Stmt<$tcx>,
41             [] struct_field: rustc_hir::StructField<$tcx>,
42             [] trait_item_ref: rustc_hir::TraitItemRef,
43             [] ty: rustc_hir::Ty<$tcx>,
44             [] type_binding: rustc_hir::TypeBinding<$tcx>,
45             [] variant: rustc_hir::Variant<$tcx>,
46             [] where_predicate: rustc_hir::WherePredicate<$tcx>,
47         ], $tcx);
48     )
49 }