Shrink the size of ClosureTypeInfo to fit into 64 bytes again
This commit is contained in:
parent
2f2350e577
commit
ba5f0418af
3 changed files with 25 additions and 9 deletions
|
@ -45,7 +45,7 @@ impl UpvarId {
|
|||
|
||||
/// Information describing the capture of an upvar. This is computed
|
||||
/// during `typeck`, specifically by `regionck`.
|
||||
#[derive(PartialEq, Clone, Debug, Copy, TyEncodable, TyDecodable, HashStable)]
|
||||
#[derive(Eq, PartialEq, Clone, Debug, Copy, TyEncodable, TyDecodable, HashStable, Hash)]
|
||||
#[derive(TypeFoldable, TypeVisitable)]
|
||||
pub enum UpvarCapture {
|
||||
/// Upvar is captured by value. This is always true when the
|
||||
|
@ -73,7 +73,7 @@ pub type RootVariableMinCaptureList<'tcx> = FxIndexMap<hir::HirId, MinCaptureLis
|
|||
pub type MinCaptureList<'tcx> = Vec<CapturedPlace<'tcx>>;
|
||||
|
||||
/// A composite describing a `Place` that is captured by a closure.
|
||||
#[derive(PartialEq, Clone, Debug, TyEncodable, TyDecodable, HashStable)]
|
||||
#[derive(Eq, PartialEq, Clone, Debug, TyEncodable, TyDecodable, HashStable, Hash)]
|
||||
#[derive(TypeFoldable, TypeVisitable)]
|
||||
pub struct CapturedPlace<'tcx> {
|
||||
/// Name and span where the binding happens.
|
||||
|
@ -192,7 +192,7 @@ impl<'tcx> CapturedPlace<'tcx> {
|
|||
#[derive(Copy, Clone, Debug, HashStable)]
|
||||
pub struct ClosureTypeInfo<'tcx> {
|
||||
user_provided_sig: ty::CanonicalPolyFnSig<'tcx>,
|
||||
captures: &'tcx [&'tcx ty::CapturedPlace<'tcx>],
|
||||
captures: &'tcx ty::List<&'tcx ty::CapturedPlace<'tcx>>,
|
||||
kind_origin: Option<&'tcx (Span, HirPlace<'tcx>)>,
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ fn closure_typeinfo<'tcx>(tcx: TyCtxt<'tcx>, def: LocalDefId) -> ClosureTypeInfo
|
|||
let typeck_results = tcx.typeck(def);
|
||||
let user_provided_sig = typeck_results.user_provided_sigs[&def];
|
||||
let captures = typeck_results.closure_min_captures_flattened(def);
|
||||
let captures = tcx.arena.alloc_from_iter(captures);
|
||||
let captures = tcx.mk_captures_from_iter(captures);
|
||||
let hir_id = tcx.local_def_id_to_hir_id(def);
|
||||
let kind_origin = typeck_results.closure_kind_origins().get(hir_id);
|
||||
ClosureTypeInfo { user_provided_sig, captures, kind_origin }
|
||||
|
@ -253,7 +253,7 @@ pub fn is_ancestor_or_same_capture(
|
|||
/// Part of `MinCaptureInformationMap`; describes the capture kind (&, &mut, move)
|
||||
/// for a particular capture as well as identifying the part of the source code
|
||||
/// that triggered this capture to occur.
|
||||
#[derive(PartialEq, Clone, Debug, Copy, TyEncodable, TyDecodable, HashStable)]
|
||||
#[derive(Eq, PartialEq, Clone, Debug, Copy, TyEncodable, TyDecodable, HashStable, Hash)]
|
||||
#[derive(TypeFoldable, TypeVisitable)]
|
||||
pub struct CaptureInfo {
|
||||
/// Expr Id pointing to use that resulted in selecting the current capture kind
|
||||
|
@ -332,7 +332,7 @@ pub fn place_to_string_for_capture<'tcx>(tcx: TyCtxt<'tcx>, place: &HirPlace<'tc
|
|||
curr_string
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Debug, TyEncodable, TyDecodable, Copy, HashStable)]
|
||||
#[derive(Eq, Clone, PartialEq, Debug, TyEncodable, TyDecodable, Copy, HashStable, Hash)]
|
||||
#[derive(TypeFoldable, TypeVisitable)]
|
||||
pub enum BorrowKind {
|
||||
/// Data must be immutable and is aliasable.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue