diff options
| author | lcnr <rust@lcnr.de> | 2025-03-11 16:18:06 +0100 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2025-03-11 16:18:06 +0100 |
| commit | 50f5f607b4e34efb0e65583ce27ea6a95c31b049 (patch) | |
| tree | f5f63da632c69523cf491c473eb66cf052bdb096 /compiler/rustc_borrowck/src | |
| parent | 2f6aca820680c47a1a94dcfaa0644689ed4726c8 (diff) | |
| download | rust-50f5f607b4e34efb0e65583ce27ea6a95c31b049.tar.gz rust-50f5f607b4e34efb0e65583ce27ea6a95c31b049.zip | |
unify `last_span` computation
Diffstat (limited to 'compiler/rustc_borrowck/src')
| -rw-r--r-- | compiler/rustc_borrowck/src/type_check/mod.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index 1b03ccfc369..852d71e4d0d 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -497,9 +497,6 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> { for (block, block_data) in body.basic_blocks.iter_enumerated() { let mut location = Location { block, statement_index: 0 }; for stmt in &block_data.statements { - if !stmt.source_info.span.is_dummy() { - self.last_span = stmt.source_info.span; - } self.visit_statement(stmt, location); location.statement_index += 1; } @@ -895,11 +892,16 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { } impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { + fn visit_span(&mut self, span: Span) { + if !span.is_dummy() { + debug!(?span); + self.last_span = span; + } + } + #[instrument(skip(self, body), level = "debug")] fn visit_body(&mut self, body: &Body<'tcx>) { debug_assert!(std::ptr::eq(self.body, body)); - self.last_span = body.span; - debug!(?body.span); for (local, local_decl) in body.local_decls.iter_enumerated() { self.visit_local_decl(local, local_decl); @@ -908,9 +910,6 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { for (block, block_data) in body.basic_blocks.iter_enumerated() { let mut location = Location { block, statement_index: 0 }; for stmt in &block_data.statements { - if !stmt.source_info.span.is_dummy() { - self.last_span = stmt.source_info.span; - } self.visit_statement(stmt, location); location.statement_index += 1; } @@ -2098,7 +2097,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { fn check_iscleanup(&mut self, block_data: &BasicBlockData<'tcx>) { let is_cleanup = block_data.is_cleanup; - self.last_span = block_data.terminator().source_info.span; match block_data.terminator().kind { TerminatorKind::Goto { target } => { self.assert_iscleanup(block_data, target, is_cleanup) |
