1
Fork 0

Auto merge of #116170 - matthewjasper:remove-thir-destruction-scopes, r=cjgillot

Don't include destruction scopes in THIR

They are not used by anyone, and add memory/performance overhead.
This commit is contained in:
bors 2023-12-09 12:38:32 +00:00
commit 1dfb2283d7
11 changed files with 235 additions and 468 deletions

View file

@ -349,10 +349,6 @@ impl ScopeTree {
}
}
pub fn opt_destruction_scope(&self, n: hir::ItemLocalId) -> Option<Scope> {
self.destruction_scopes.get(&n).cloned()
}
pub fn record_var_scope(&mut self, var: hir::ItemLocalId, lifetime: Scope) {
debug!("record_var_scope(sub={:?}, sup={:?})", var, lifetime);
assert!(var != lifetime.item_local_id());

View file

@ -134,7 +134,6 @@ pub struct Block {
/// This does *not* include labels on loops, e.g. `'label: loop {}`.
pub targeted_by_break: bool,
pub region_scope: region::Scope,
pub opt_destruction_scope: Option<region::Scope>,
/// The span of the block, including the opening braces,
/// the label, and the `unsafe` keyword, if present.
pub span: Span,
@ -193,7 +192,6 @@ pub enum BlockSafety {
#[derive(Clone, Debug, HashStable)]
pub struct Stmt<'tcx> {
pub kind: StmtKind<'tcx>,
pub opt_destruction_scope: Option<region::Scope>,
}
#[derive(Clone, Debug, HashStable)]
@ -1224,12 +1222,12 @@ impl<'tcx> fmt::Display for Pat<'tcx> {
mod size_asserts {
use super::*;
// tidy-alphabetical-start
static_assert_size!(Block, 56);
static_assert_size!(Block, 48);
static_assert_size!(Expr<'_>, 64);
static_assert_size!(ExprKind<'_>, 40);
static_assert_size!(Pat<'_>, 64);
static_assert_size!(PatKind<'_>, 48);
static_assert_size!(Stmt<'_>, 56);
static_assert_size!(Stmt<'_>, 48);
static_assert_size!(StmtKind<'_>, 48);
// tidy-alphabetical-end
}