Skip to content

Commit ed8d67d

Browse files
committed
Impl Copy for almost all HIR types
This simplifies the invocation of the `arena_types` macro and probably makes working with HIR nicer in general.
1 parent bb758cf commit ed8d67d

File tree

3 files changed

+66
-106
lines changed

3 files changed

+66
-106
lines changed

compiler/rustc_hir/src/arena.rs

+1-41
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,16 @@
11
/// This higher-order macro declares a list of types which can be allocated by `Arena`.
2-
///
3-
/// Specifying the `decode` modifier will add decode impls for `&T` and `&[T]`,
4-
/// where `T` is the type listed. These impls will appear in the implement_ty_decoder! macro.
2+
/// Note that all `Copy` types can be allocated by default and need not be specified here.
53
#[macro_export]
64
macro_rules! arena_types {
75
($macro:path) => (
86
$macro!([
97
// HIR types
108
[] hir_krate: rustc_hir::Crate<'tcx>,
11-
[] arm: rustc_hir::Arm<'tcx>,
12-
[] asm_operand: (rustc_hir::InlineAsmOperand<'tcx>, rustc_span::Span),
139
[] asm_template: rustc_ast::InlineAsmTemplatePiece,
1410
[] attribute: rustc_ast::Attribute,
15-
[] closure: rustc_hir::Closure<'tcx>,
16-
[] block: rustc_hir::Block<'tcx>,
17-
[] bare_fn_ty: rustc_hir::BareFnTy<'tcx>,
18-
[] body: rustc_hir::Body<'tcx>,
19-
[] generics: rustc_hir::Generics<'tcx>,
20-
[] generic_arg: rustc_hir::GenericArg<'tcx>,
21-
[] generic_args: rustc_hir::GenericArgs<'tcx>,
22-
[] generic_bound: rustc_hir::GenericBound<'tcx>,
23-
[] generic_param: rustc_hir::GenericParam<'tcx>,
24-
[] expr: rustc_hir::Expr<'tcx>,
25-
[] impl_: rustc_hir::Impl<'tcx>,
26-
[] let_expr: rustc_hir::Let<'tcx>,
27-
[] expr_field: rustc_hir::ExprField<'tcx>,
28-
[] pat_field: rustc_hir::PatField<'tcx>,
29-
[] fn_decl: rustc_hir::FnDecl<'tcx>,
30-
[] foreign_item: rustc_hir::ForeignItem<'tcx>,
31-
[] foreign_item_ref: rustc_hir::ForeignItemRef,
32-
[] impl_item: rustc_hir::ImplItem<'tcx>,
33-
[] impl_item_ref: rustc_hir::ImplItemRef,
3411
[] item: rustc_hir::Item<'tcx>,
35-
[] inline_asm: rustc_hir::InlineAsm<'tcx>,
36-
[] local: rustc_hir::Local<'tcx>,
37-
[] mod_: rustc_hir::Mod<'tcx>,
3812
[] owner_info: rustc_hir::OwnerInfo<'tcx>,
39-
[] param: rustc_hir::Param<'tcx>,
40-
[] pat: rustc_hir::Pat<'tcx>,
41-
[] path: rustc_hir::Path<'tcx>,
4213
[] use_path: rustc_hir::UsePath<'tcx>,
43-
[] path_segment: rustc_hir::PathSegment<'tcx>,
44-
[] poly_trait_ref: rustc_hir::PolyTraitRef<'tcx>,
45-
[] qpath: rustc_hir::QPath<'tcx>,
46-
[] stmt: rustc_hir::Stmt<'tcx>,
47-
[] field_def: rustc_hir::FieldDef<'tcx>,
48-
[] trait_item: rustc_hir::TraitItem<'tcx>,
49-
[] trait_item_ref: rustc_hir::TraitItemRef,
50-
[] ty: rustc_hir::Ty<'tcx>,
51-
[] type_binding: rustc_hir::TypeBinding<'tcx>,
52-
[] variant: rustc_hir::Variant<'tcx>,
53-
[] where_predicate: rustc_hir::WherePredicate<'tcx>,
5414
[] lit: rustc_hir::Lit,
5515
]);
5616
)

0 commit comments

Comments
 (0)