Rollup merge of #134491 - compiler-errors:dtor-tweaks, r=lqd
Some destructor/drop related tweaks Two random tweaks I got from investigating some stuff around drops in edition 2024: 1. Use the `TypingEnv` of the mir builder, rather than making it over again. 2. Rename the `id` field from `Scope` to `local_id`, to reflect that it's a local id, and remove the `item_local_id()` accessor which just returned the id field.
This commit is contained in:
commit
e2bc71866e
8 changed files with 46 additions and 53 deletions
|
@ -129,7 +129,7 @@ fn resolve_block<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx h
|
||||||
let mut prev_cx = visitor.cx;
|
let mut prev_cx = visitor.cx;
|
||||||
|
|
||||||
visitor.enter_scope(Scope {
|
visitor.enter_scope(Scope {
|
||||||
id: blk.hir_id.local_id,
|
local_id: blk.hir_id.local_id,
|
||||||
data: ScopeData::Remainder(FirstStatementIndex::new(i)),
|
data: ScopeData::Remainder(FirstStatementIndex::new(i)),
|
||||||
});
|
});
|
||||||
visitor.cx.var_parent = visitor.cx.parent;
|
visitor.cx.var_parent = visitor.cx.parent;
|
||||||
|
@ -154,7 +154,7 @@ fn resolve_block<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx h
|
||||||
// the first such subscope, which has the block itself as a
|
// the first such subscope, which has the block itself as a
|
||||||
// parent.
|
// parent.
|
||||||
visitor.enter_scope(Scope {
|
visitor.enter_scope(Scope {
|
||||||
id: blk.hir_id.local_id,
|
local_id: blk.hir_id.local_id,
|
||||||
data: ScopeData::Remainder(FirstStatementIndex::new(i)),
|
data: ScopeData::Remainder(FirstStatementIndex::new(i)),
|
||||||
});
|
});
|
||||||
visitor.cx.var_parent = visitor.cx.parent;
|
visitor.cx.var_parent = visitor.cx.parent;
|
||||||
|
@ -184,7 +184,7 @@ fn resolve_block<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx h
|
||||||
visitor
|
visitor
|
||||||
.scope_tree
|
.scope_tree
|
||||||
.backwards_incompatible_scope
|
.backwards_incompatible_scope
|
||||||
.insert(local_id, Scope { id: local_id, data: ScopeData::Node });
|
.insert(local_id, Scope { local_id, data: ScopeData::Node });
|
||||||
}
|
}
|
||||||
visitor.visit_expr(tail_expr);
|
visitor.visit_expr(tail_expr);
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ fn resolve_arm<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, arm: &'tcx hir
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolve_pat<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, pat: &'tcx hir::Pat<'tcx>) {
|
fn resolve_pat<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, pat: &'tcx hir::Pat<'tcx>) {
|
||||||
visitor.record_child_scope(Scope { id: pat.hir_id.local_id, data: ScopeData::Node });
|
visitor.record_child_scope(Scope { local_id: pat.hir_id.local_id, data: ScopeData::Node });
|
||||||
|
|
||||||
// If this is a binding then record the lifetime of that binding.
|
// If this is a binding then record the lifetime of that binding.
|
||||||
if let PatKind::Binding(..) = pat.kind {
|
if let PatKind::Binding(..) = pat.kind {
|
||||||
|
@ -485,7 +485,7 @@ fn resolve_expr<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, expr: &'tcx h
|
||||||
} else {
|
} else {
|
||||||
ScopeData::IfThen
|
ScopeData::IfThen
|
||||||
};
|
};
|
||||||
visitor.enter_scope(Scope { id: then.hir_id.local_id, data });
|
visitor.enter_scope(Scope { local_id: then.hir_id.local_id, data });
|
||||||
visitor.cx.var_parent = visitor.cx.parent;
|
visitor.cx.var_parent = visitor.cx.parent;
|
||||||
visitor.visit_expr(cond);
|
visitor.visit_expr(cond);
|
||||||
visitor.visit_expr(then);
|
visitor.visit_expr(then);
|
||||||
|
@ -500,7 +500,7 @@ fn resolve_expr<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, expr: &'tcx h
|
||||||
} else {
|
} else {
|
||||||
ScopeData::IfThen
|
ScopeData::IfThen
|
||||||
};
|
};
|
||||||
visitor.enter_scope(Scope { id: then.hir_id.local_id, data });
|
visitor.enter_scope(Scope { local_id: then.hir_id.local_id, data });
|
||||||
visitor.cx.var_parent = visitor.cx.parent;
|
visitor.cx.var_parent = visitor.cx.parent;
|
||||||
visitor.visit_expr(cond);
|
visitor.visit_expr(cond);
|
||||||
visitor.visit_expr(then);
|
visitor.visit_expr(then);
|
||||||
|
@ -516,7 +516,7 @@ fn resolve_expr<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, expr: &'tcx h
|
||||||
|
|
||||||
if let hir::ExprKind::Yield(_, source) = &expr.kind {
|
if let hir::ExprKind::Yield(_, source) = &expr.kind {
|
||||||
// Mark this expr's scope and all parent scopes as containing `yield`.
|
// Mark this expr's scope and all parent scopes as containing `yield`.
|
||||||
let mut scope = Scope { id: expr.hir_id.local_id, data: ScopeData::Node };
|
let mut scope = Scope { local_id: expr.hir_id.local_id, data: ScopeData::Node };
|
||||||
loop {
|
loop {
|
||||||
let span = match expr.kind {
|
let span = match expr.kind {
|
||||||
hir::ExprKind::Yield(expr, hir::YieldSource::Await { .. }) => {
|
hir::ExprKind::Yield(expr, hir::YieldSource::Await { .. }) => {
|
||||||
|
@ -803,9 +803,9 @@ impl<'tcx> RegionResolutionVisitor<'tcx> {
|
||||||
// account for the destruction scope representing the scope of
|
// account for the destruction scope representing the scope of
|
||||||
// the destructors that run immediately after it completes.
|
// the destructors that run immediately after it completes.
|
||||||
if self.terminating_scopes.contains(&id) {
|
if self.terminating_scopes.contains(&id) {
|
||||||
self.enter_scope(Scope { id, data: ScopeData::Destruction });
|
self.enter_scope(Scope { local_id: id, data: ScopeData::Destruction });
|
||||||
}
|
}
|
||||||
self.enter_scope(Scope { id, data: ScopeData::Node });
|
self.enter_scope(Scope { local_id: id, data: ScopeData::Node });
|
||||||
}
|
}
|
||||||
|
|
||||||
fn enter_body(&mut self, hir_id: hir::HirId, f: impl FnOnce(&mut Self)) {
|
fn enter_body(&mut self, hir_id: hir::HirId, f: impl FnOnce(&mut Self)) {
|
||||||
|
@ -822,8 +822,8 @@ impl<'tcx> RegionResolutionVisitor<'tcx> {
|
||||||
let outer_pessimistic_yield = mem::replace(&mut self.pessimistic_yield, false);
|
let outer_pessimistic_yield = mem::replace(&mut self.pessimistic_yield, false);
|
||||||
self.terminating_scopes.insert(hir_id.local_id);
|
self.terminating_scopes.insert(hir_id.local_id);
|
||||||
|
|
||||||
self.enter_scope(Scope { id: hir_id.local_id, data: ScopeData::CallSite });
|
self.enter_scope(Scope { local_id: hir_id.local_id, data: ScopeData::CallSite });
|
||||||
self.enter_scope(Scope { id: hir_id.local_id, data: ScopeData::Arguments });
|
self.enter_scope(Scope { local_id: hir_id.local_id, data: ScopeData::Arguments });
|
||||||
|
|
||||||
f(self);
|
f(self);
|
||||||
|
|
||||||
|
|
|
@ -84,23 +84,23 @@ use crate::ty::TyCtxt;
|
||||||
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Copy, TyEncodable, TyDecodable)]
|
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Copy, TyEncodable, TyDecodable)]
|
||||||
#[derive(HashStable)]
|
#[derive(HashStable)]
|
||||||
pub struct Scope {
|
pub struct Scope {
|
||||||
pub id: hir::ItemLocalId,
|
pub local_id: hir::ItemLocalId,
|
||||||
pub data: ScopeData,
|
pub data: ScopeData,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for Scope {
|
impl fmt::Debug for Scope {
|
||||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self.data {
|
match self.data {
|
||||||
ScopeData::Node => write!(fmt, "Node({:?})", self.id),
|
ScopeData::Node => write!(fmt, "Node({:?})", self.local_id),
|
||||||
ScopeData::CallSite => write!(fmt, "CallSite({:?})", self.id),
|
ScopeData::CallSite => write!(fmt, "CallSite({:?})", self.local_id),
|
||||||
ScopeData::Arguments => write!(fmt, "Arguments({:?})", self.id),
|
ScopeData::Arguments => write!(fmt, "Arguments({:?})", self.local_id),
|
||||||
ScopeData::Destruction => write!(fmt, "Destruction({:?})", self.id),
|
ScopeData::Destruction => write!(fmt, "Destruction({:?})", self.local_id),
|
||||||
ScopeData::IfThen => write!(fmt, "IfThen({:?})", self.id),
|
ScopeData::IfThen => write!(fmt, "IfThen({:?})", self.local_id),
|
||||||
ScopeData::IfThenRescope => write!(fmt, "IfThen[edition2024]({:?})", self.id),
|
ScopeData::IfThenRescope => write!(fmt, "IfThen[edition2024]({:?})", self.local_id),
|
||||||
ScopeData::Remainder(fsi) => write!(
|
ScopeData::Remainder(fsi) => write!(
|
||||||
fmt,
|
fmt,
|
||||||
"Remainder {{ block: {:?}, first_statement_index: {}}}",
|
"Remainder {{ block: {:?}, first_statement_index: {}}}",
|
||||||
self.id,
|
self.local_id,
|
||||||
fsi.as_u32(),
|
fsi.as_u32(),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
@ -164,18 +164,8 @@ rustc_index::newtype_index! {
|
||||||
rustc_data_structures::static_assert_size!(ScopeData, 4);
|
rustc_data_structures::static_assert_size!(ScopeData, 4);
|
||||||
|
|
||||||
impl Scope {
|
impl Scope {
|
||||||
/// Returns an item-local ID associated with this scope.
|
|
||||||
///
|
|
||||||
/// N.B., likely to be replaced as API is refined; e.g., pnkfelix
|
|
||||||
/// anticipates `fn entry_node_id` and `fn each_exit_node_id`.
|
|
||||||
pub fn item_local_id(&self) -> hir::ItemLocalId {
|
|
||||||
self.id
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn hir_id(&self, scope_tree: &ScopeTree) -> Option<HirId> {
|
pub fn hir_id(&self, scope_tree: &ScopeTree) -> Option<HirId> {
|
||||||
scope_tree
|
scope_tree.root_body.map(|hir_id| HirId { owner: hir_id.owner, local_id: self.local_id })
|
||||||
.root_body
|
|
||||||
.map(|hir_id| HirId { owner: hir_id.owner, local_id: self.item_local_id() })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the span of this `Scope`. Note that in general the
|
/// Returns the span of this `Scope`. Note that in general the
|
||||||
|
@ -350,7 +340,7 @@ impl ScopeTree {
|
||||||
|
|
||||||
pub fn record_var_scope(&mut self, var: hir::ItemLocalId, lifetime: Scope) {
|
pub fn record_var_scope(&mut self, var: hir::ItemLocalId, lifetime: Scope) {
|
||||||
debug!("record_var_scope(sub={:?}, sup={:?})", var, lifetime);
|
debug!("record_var_scope(sub={:?}, sup={:?})", var, lifetime);
|
||||||
assert!(var != lifetime.item_local_id());
|
assert!(var != lifetime.local_id);
|
||||||
self.var_map.insert(var, lifetime);
|
self.var_map.insert(var, lifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +349,7 @@ impl ScopeTree {
|
||||||
match &candidate_type {
|
match &candidate_type {
|
||||||
RvalueCandidateType::Borrow { lifetime: Some(lifetime), .. }
|
RvalueCandidateType::Borrow { lifetime: Some(lifetime), .. }
|
||||||
| RvalueCandidateType::Pattern { lifetime: Some(lifetime), .. } => {
|
| RvalueCandidateType::Pattern { lifetime: Some(lifetime), .. } => {
|
||||||
assert!(var.local_id != lifetime.item_local_id())
|
assert!(var.local_id != lifetime.local_id)
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ impl RvalueScopes {
|
||||||
// if there's one. Static items, for instance, won't
|
// if there's one. Static items, for instance, won't
|
||||||
// have an enclosing scope, hence no scope will be
|
// have an enclosing scope, hence no scope will be
|
||||||
// returned.
|
// returned.
|
||||||
let mut id = Scope { id: expr_id, data: ScopeData::Node };
|
let mut id = Scope { local_id: expr_id, data: ScopeData::Node };
|
||||||
let mut backwards_incompatible = None;
|
let mut backwards_incompatible = None;
|
||||||
|
|
||||||
while let Some(&(p, _)) = region_scope_tree.parent_map.get(&id) {
|
while let Some(&(p, _)) = region_scope_tree.parent_map.get(&id) {
|
||||||
|
@ -60,7 +60,7 @@ impl RvalueScopes {
|
||||||
if backwards_incompatible.is_none() {
|
if backwards_incompatible.is_none() {
|
||||||
backwards_incompatible = region_scope_tree
|
backwards_incompatible = region_scope_tree
|
||||||
.backwards_incompatible_scope
|
.backwards_incompatible_scope
|
||||||
.get(&p.item_local_id())
|
.get(&p.local_id)
|
||||||
.copied();
|
.copied();
|
||||||
}
|
}
|
||||||
id = p
|
id = p
|
||||||
|
@ -76,7 +76,7 @@ impl RvalueScopes {
|
||||||
pub fn record_rvalue_scope(&mut self, var: hir::ItemLocalId, lifetime: Option<Scope>) {
|
pub fn record_rvalue_scope(&mut self, var: hir::ItemLocalId, lifetime: Option<Scope>) {
|
||||||
debug!("record_rvalue_scope(var={var:?}, lifetime={lifetime:?})");
|
debug!("record_rvalue_scope(var={var:?}, lifetime={lifetime:?})");
|
||||||
if let Some(lifetime) = lifetime {
|
if let Some(lifetime) = lifetime {
|
||||||
assert!(var != lifetime.item_local_id());
|
assert!(var != lifetime.local_id);
|
||||||
}
|
}
|
||||||
self.map.insert(var, lifetime);
|
self.map.insert(var, lifetime);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,11 +75,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
LocalInfo::BlockTailTemp(tail_info)
|
LocalInfo::BlockTailTemp(tail_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
_ if let Some(Scope { data: ScopeData::IfThenRescope, id }) =
|
_ if let Some(Scope { data: ScopeData::IfThenRescope, local_id }) =
|
||||||
temp_lifetime.temp_lifetime =>
|
temp_lifetime.temp_lifetime =>
|
||||||
{
|
{
|
||||||
LocalInfo::IfThenRescopeTemp {
|
LocalInfo::IfThenRescopeTemp {
|
||||||
if_then: HirId { owner: this.hir_id.owner, local_id: id },
|
if_then: HirId { owner: this.hir_id.owner, local_id },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -531,9 +531,9 @@ fn construct_fn<'tcx>(
|
||||||
);
|
);
|
||||||
|
|
||||||
let call_site_scope =
|
let call_site_scope =
|
||||||
region::Scope { id: body.id().hir_id.local_id, data: region::ScopeData::CallSite };
|
region::Scope { local_id: body.id().hir_id.local_id, data: region::ScopeData::CallSite };
|
||||||
let arg_scope =
|
let arg_scope =
|
||||||
region::Scope { id: body.id().hir_id.local_id, data: region::ScopeData::Arguments };
|
region::Scope { local_id: body.id().hir_id.local_id, data: region::ScopeData::Arguments };
|
||||||
let source_info = builder.source_info(span);
|
let source_info = builder.source_info(span);
|
||||||
let call_site_s = (call_site_scope, source_info);
|
let call_site_s = (call_site_scope, source_info);
|
||||||
let _: BlockAnd<()> = builder.in_scope(call_site_s, LintLevel::Inherited, |builder| {
|
let _: BlockAnd<()> = builder.in_scope(call_site_s, LintLevel::Inherited, |builder| {
|
||||||
|
|
|
@ -89,7 +89,7 @@ use rustc_index::{IndexSlice, IndexVec};
|
||||||
use rustc_middle::middle::region;
|
use rustc_middle::middle::region;
|
||||||
use rustc_middle::mir::*;
|
use rustc_middle::mir::*;
|
||||||
use rustc_middle::thir::{ExprId, LintLevel};
|
use rustc_middle::thir::{ExprId, LintLevel};
|
||||||
use rustc_middle::{bug, span_bug, ty};
|
use rustc_middle::{bug, span_bug};
|
||||||
use rustc_session::lint::Level;
|
use rustc_session::lint::Level;
|
||||||
use rustc_span::source_map::Spanned;
|
use rustc_span::source_map::Spanned;
|
||||||
use rustc_span::{DUMMY_SP, Span};
|
use rustc_span::{DUMMY_SP, Span};
|
||||||
|
@ -1119,10 +1119,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
region_scope: region::Scope,
|
region_scope: region::Scope,
|
||||||
local: Local,
|
local: Local,
|
||||||
) {
|
) {
|
||||||
if !self.local_decls[local].ty.has_significant_drop(self.tcx, ty::TypingEnv {
|
if !self.local_decls[local].ty.has_significant_drop(self.tcx, self.typing_env()) {
|
||||||
typing_mode: ty::TypingMode::non_body_analysis(),
|
|
||||||
param_env: self.param_env,
|
|
||||||
}) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for scope in self.scopes.scopes.iter_mut().rev() {
|
for scope in self.scopes.scopes.iter_mut().rev() {
|
||||||
|
|
|
@ -16,7 +16,7 @@ impl<'tcx> Cx<'tcx> {
|
||||||
let block = Block {
|
let block = Block {
|
||||||
targeted_by_break: block.targeted_by_break,
|
targeted_by_break: block.targeted_by_break,
|
||||||
region_scope: region::Scope {
|
region_scope: region::Scope {
|
||||||
id: block.hir_id.local_id,
|
local_id: block.hir_id.local_id,
|
||||||
data: region::ScopeData::Node,
|
data: region::ScopeData::Node,
|
||||||
},
|
},
|
||||||
span: block.span,
|
span: block.span,
|
||||||
|
@ -51,7 +51,7 @@ impl<'tcx> Cx<'tcx> {
|
||||||
let stmt = Stmt {
|
let stmt = Stmt {
|
||||||
kind: StmtKind::Expr {
|
kind: StmtKind::Expr {
|
||||||
scope: region::Scope {
|
scope: region::Scope {
|
||||||
id: hir_id.local_id,
|
local_id: hir_id.local_id,
|
||||||
data: region::ScopeData::Node,
|
data: region::ScopeData::Node,
|
||||||
},
|
},
|
||||||
expr: self.mirror_expr(expr),
|
expr: self.mirror_expr(expr),
|
||||||
|
@ -65,7 +65,7 @@ impl<'tcx> Cx<'tcx> {
|
||||||
}
|
}
|
||||||
hir::StmtKind::Let(local) => {
|
hir::StmtKind::Let(local) => {
|
||||||
let remainder_scope = region::Scope {
|
let remainder_scope = region::Scope {
|
||||||
id: block_id,
|
local_id: block_id,
|
||||||
data: region::ScopeData::Remainder(region::FirstStatementIndex::new(
|
data: region::ScopeData::Remainder(region::FirstStatementIndex::new(
|
||||||
index,
|
index,
|
||||||
)),
|
)),
|
||||||
|
@ -108,7 +108,7 @@ impl<'tcx> Cx<'tcx> {
|
||||||
kind: StmtKind::Let {
|
kind: StmtKind::Let {
|
||||||
remainder_scope,
|
remainder_scope,
|
||||||
init_scope: region::Scope {
|
init_scope: region::Scope {
|
||||||
id: hir_id.local_id,
|
local_id: hir_id.local_id,
|
||||||
data: region::ScopeData::Node,
|
data: region::ScopeData::Node,
|
||||||
},
|
},
|
||||||
pattern,
|
pattern,
|
||||||
|
|
|
@ -45,7 +45,7 @@ impl<'tcx> Cx<'tcx> {
|
||||||
#[instrument(level = "trace", skip(self, hir_expr))]
|
#[instrument(level = "trace", skip(self, hir_expr))]
|
||||||
pub(super) fn mirror_expr_inner(&mut self, hir_expr: &'tcx hir::Expr<'tcx>) -> ExprId {
|
pub(super) fn mirror_expr_inner(&mut self, hir_expr: &'tcx hir::Expr<'tcx>) -> ExprId {
|
||||||
let expr_scope =
|
let expr_scope =
|
||||||
region::Scope { id: hir_expr.hir_id.local_id, data: region::ScopeData::Node };
|
region::Scope { local_id: hir_expr.hir_id.local_id, data: region::ScopeData::Node };
|
||||||
|
|
||||||
trace!(?hir_expr.hir_id, ?hir_expr.span);
|
trace!(?hir_expr.hir_id, ?hir_expr.span);
|
||||||
|
|
||||||
|
@ -814,14 +814,20 @@ impl<'tcx> Cx<'tcx> {
|
||||||
hir::ExprKind::Become(call) => ExprKind::Become { value: self.mirror_expr(call) },
|
hir::ExprKind::Become(call) => ExprKind::Become { value: self.mirror_expr(call) },
|
||||||
hir::ExprKind::Break(dest, ref value) => match dest.target_id {
|
hir::ExprKind::Break(dest, ref value) => match dest.target_id {
|
||||||
Ok(target_id) => ExprKind::Break {
|
Ok(target_id) => ExprKind::Break {
|
||||||
label: region::Scope { id: target_id.local_id, data: region::ScopeData::Node },
|
label: region::Scope {
|
||||||
|
local_id: target_id.local_id,
|
||||||
|
data: region::ScopeData::Node,
|
||||||
|
},
|
||||||
value: value.map(|value| self.mirror_expr(value)),
|
value: value.map(|value| self.mirror_expr(value)),
|
||||||
},
|
},
|
||||||
Err(err) => bug!("invalid loop id for break: {}", err),
|
Err(err) => bug!("invalid loop id for break: {}", err),
|
||||||
},
|
},
|
||||||
hir::ExprKind::Continue(dest) => match dest.target_id {
|
hir::ExprKind::Continue(dest) => match dest.target_id {
|
||||||
Ok(loop_id) => ExprKind::Continue {
|
Ok(loop_id) => ExprKind::Continue {
|
||||||
label: region::Scope { id: loop_id.local_id, data: region::ScopeData::Node },
|
label: region::Scope {
|
||||||
|
local_id: loop_id.local_id,
|
||||||
|
data: region::ScopeData::Node,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Err(err) => bug!("invalid loop id for continue: {}", err),
|
Err(err) => bug!("invalid loop id for continue: {}", err),
|
||||||
},
|
},
|
||||||
|
@ -831,7 +837,7 @@ impl<'tcx> Cx<'tcx> {
|
||||||
},
|
},
|
||||||
hir::ExprKind::If(cond, then, else_opt) => ExprKind::If {
|
hir::ExprKind::If(cond, then, else_opt) => ExprKind::If {
|
||||||
if_then_scope: region::Scope {
|
if_then_scope: region::Scope {
|
||||||
id: then.hir_id.local_id,
|
local_id: then.hir_id.local_id,
|
||||||
data: {
|
data: {
|
||||||
if expr.span.at_least_rust_2024() {
|
if expr.span.at_least_rust_2024() {
|
||||||
region::ScopeData::IfThenRescope
|
region::ScopeData::IfThenRescope
|
||||||
|
@ -1021,7 +1027,7 @@ impl<'tcx> Cx<'tcx> {
|
||||||
guard: arm.guard.as_ref().map(|g| self.mirror_expr(g)),
|
guard: arm.guard.as_ref().map(|g| self.mirror_expr(g)),
|
||||||
body: self.mirror_expr(arm.body),
|
body: self.mirror_expr(arm.body),
|
||||||
lint_level: LintLevel::Explicit(arm.hir_id),
|
lint_level: LintLevel::Explicit(arm.hir_id),
|
||||||
scope: region::Scope { id: arm.hir_id.local_id, data: region::ScopeData::Node },
|
scope: region::Scope { local_id: arm.hir_id.local_id, data: region::ScopeData::Node },
|
||||||
span: arm.span,
|
span: arm.span,
|
||||||
};
|
};
|
||||||
self.thir.arms.push(arm)
|
self.thir.arms.push(arm)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue