move else block into the Local
struct
This commit is contained in:
parent
6c529ded86
commit
1cd30e7b32
59 changed files with 138 additions and 131 deletions
|
@ -66,7 +66,7 @@ impl<'tcx> Cx<'tcx> {
|
|||
// ignore for purposes of the MIR
|
||||
None
|
||||
}
|
||||
hir::StmtKind::Local(local, els) => {
|
||||
hir::StmtKind::Local(local) => {
|
||||
let remainder_scope = region::Scope {
|
||||
id: block_id,
|
||||
data: region::ScopeData::Remainder(region::FirstStatementIndex::new(
|
||||
|
@ -74,7 +74,7 @@ impl<'tcx> Cx<'tcx> {
|
|||
)),
|
||||
};
|
||||
|
||||
let else_block = els.map(|els| self.mirror_block(els));
|
||||
let else_block = local.els.map(|els| self.mirror_block(els));
|
||||
|
||||
let mut pattern = self.pattern_from_hir(local.pat);
|
||||
debug!(?pattern);
|
||||
|
|
|
@ -75,10 +75,11 @@ impl<'tcx> Visitor<'tcx> for MatchVisitor<'_, '_, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn visit_local(&mut self, loc: &'tcx hir::Local<'tcx>, els: Option<&'tcx hir::Block<'tcx>>) {
|
||||
intravisit::walk_local(self, loc, els);
|
||||
if let Some(init) = &loc.init && els.is_some() {
|
||||
self.check_let(&loc.pat, &init, loc.span);
|
||||
fn visit_local(&mut self, loc: &'tcx hir::Local<'tcx>) {
|
||||
intravisit::walk_local(self, loc);
|
||||
let els = loc.els;
|
||||
if let Some(init) = loc.init && els.is_some() {
|
||||
self.check_let(&loc.pat, init, loc.span);
|
||||
}
|
||||
|
||||
let (msg, sp) = match loc.source {
|
||||
|
@ -1135,7 +1136,7 @@ fn let_source_parent(tcx: TyCtxt<'_>, parent: HirId, pat_id: Option<HirId>) -> L
|
|||
|
||||
let parent_parent = hir.get_parent_node(parent);
|
||||
let parent_parent_node = hir.get(parent_parent);
|
||||
if let hir::Node::Stmt(hir::Stmt { kind: hir::StmtKind::Local(_, Some(_)), span, .. }) =
|
||||
if let hir::Node::Stmt(hir::Stmt { kind: hir::StmtKind::Local(_), span, .. }) =
|
||||
parent_parent_node
|
||||
{
|
||||
return LetSource::LetElse(*span);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue