rust/src/librustc_middle/arena.rs

81 lines
4.1 KiB
Rust
Raw Normal View History

2019-05-19 10:27:28 -05:00
/// This declares a list of types which can be allocated by `Arena`.
///
/// The `few` modifier will cause allocation to use the shared arena and recording the destructor.
/// This is faster and more memory efficient if there's only a few allocations of the type.
/// Leaving `few` out will cause the type to get its own dedicated `TypedArena` which is
/// faster and more memory efficient if there is lots of allocations.
///
/// Specifying the `decode` modifier will add decode impls for &T and &[T] where T is the type
/// listed. These impls will appear in the implement_ty_decoder! macro.
#[macro_export]
macro_rules! arena_types {
($macro:path, $args:tt, $tcx:lifetime) => (
$macro!($args, [
[] layouts: rustc_target::abi::Layout,
2020-03-29 09:41:09 -05:00
[decode] tables: rustc_middle::ty::TypeckTables<$tcx>,
[] const_allocs: rustc_middle::mir::interpret::Allocation,
2020-03-27 14:26:20 -05:00
[few, decode] mir_keys: rustc_hir::def_id::DefIdSet,
2020-03-29 09:41:09 -05:00
[] region_scope_tree: rustc_middle::middle::region::ScopeTree,
2018-11-30 16:37:18 -06:00
[] dropck_outlives:
2020-03-29 09:41:09 -05:00
rustc_middle::infer::canonical::Canonical<'tcx,
rustc_middle::infer::canonical::QueryResponse<'tcx,
rustc_middle::traits::query::DropckOutlivesResult<'tcx>
2018-11-30 16:37:18 -06:00
>
>,
[] normalize_projection_ty:
2020-03-29 09:41:09 -05:00
rustc_middle::infer::canonical::Canonical<'tcx,
rustc_middle::infer::canonical::QueryResponse<'tcx,
rustc_middle::traits::query::NormalizationResult<'tcx>
2018-11-30 16:37:18 -06:00
>
>,
[] implied_outlives_bounds:
2020-03-29 09:41:09 -05:00
rustc_middle::infer::canonical::Canonical<'tcx,
rustc_middle::infer::canonical::QueryResponse<'tcx,
Vec<rustc_middle::traits::query::OutlivesBound<'tcx>>
2018-11-30 16:37:18 -06:00
>
>,
[] type_op_subtype:
2020-03-29 09:41:09 -05:00
rustc_middle::infer::canonical::Canonical<'tcx,
rustc_middle::infer::canonical::QueryResponse<'tcx, ()>
2018-11-30 16:37:18 -06:00
>,
[] type_op_normalize_poly_fn_sig:
2020-03-29 09:41:09 -05:00
rustc_middle::infer::canonical::Canonical<'tcx,
rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::PolyFnSig<'tcx>>
2018-11-30 16:37:18 -06:00
>,
[] type_op_normalize_fn_sig:
2020-03-29 09:41:09 -05:00
rustc_middle::infer::canonical::Canonical<'tcx,
rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::FnSig<'tcx>>
2018-11-30 16:37:18 -06:00
>,
[] type_op_normalize_predicate:
2020-03-29 09:41:09 -05:00
rustc_middle::infer::canonical::Canonical<'tcx,
rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::Predicate<'tcx>>
2018-11-30 16:37:18 -06:00
>,
[] type_op_normalize_ty:
2020-03-29 09:41:09 -05:00
rustc_middle::infer::canonical::Canonical<'tcx,
rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::Ty<'tcx>>
2018-11-30 16:37:18 -06:00
>,
[few] all_traits: Vec<rustc_hir::def_id::DefId>,
2020-03-29 09:41:09 -05:00
[few] privacy_access_levels: rustc_middle::middle::privacy::AccessLevels,
[few] foreign_module: rustc_middle::middle::cstore::ForeignModule,
[few] foreign_modules: Vec<rustc_middle::middle::cstore::ForeignModule>,
[] upvars: rustc_data_structures::fx::FxIndexMap<rustc_hir::HirId, rustc_hir::Upvar>,
2020-03-14 06:06:06 -05:00
[] object_safety_violations: rustc_middle::traits::ObjectSafetyViolation,
2020-03-14 06:41:32 -05:00
[] codegen_unit: rustc_middle::mir::mono::CodegenUnit<$tcx>,
2020-03-14 11:37:34 -05:00
[] attribute: rustc_ast::ast::Attribute,
[] name_set: rustc_data_structures::fx::FxHashSet<rustc_ast::ast::Name>,
[] hir_id_set: rustc_hir::HirIdSet,
2019-12-01 10:33:31 -06:00
2020-01-01 18:26:18 -06:00
// Interned types
2020-03-29 09:41:09 -05:00
[] tys: rustc_middle::ty::TyS<$tcx>,
2020-01-01 18:26:18 -06:00
2020-02-07 04:45:04 -06:00
// HIR query types
2020-03-29 09:41:09 -05:00
[few] indexed_hir: rustc_middle::hir::map::IndexedHir<$tcx>,
[few] hir_definitions: rustc_hir::definitions::Definitions,
2020-03-29 09:41:09 -05:00
[] hir_owner: rustc_middle::hir::Owner<$tcx>,
[] hir_owner_nodes: rustc_middle::hir::OwnerNodes<$tcx>,
], $tcx);
)
}
2020-03-20 19:42:14 -05:00
arena_types!(arena::declare_arena, [], 'tcx);