Skip to content

Commit 5123394

Browse files
committed
mir: Introduce an empty StmtDebugInfo
1 parent d5b2987 commit 5123394

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,12 +1162,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
11621162
let opt_assignment_rhs_span =
11631163
self.find_assignments(local).first().map(|&location| {
11641164
if let Some(mir::Statement {
1165-
source_info: _,
11661165
kind:
11671166
mir::StatementKind::Assign(box (
11681167
_,
11691168
mir::Rvalue::Use(mir::Operand::Copy(place)),
11701169
)),
1170+
..
11711171
}) = self.body[location.block].statements.get(location.statement_index)
11721172
{
11731173
self.body.local_decls[place.local].source_info.span

compiler/rustc_middle/src/mir/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,7 @@ mod size_asserts {
17131713
static_assert_size!(BasicBlockData<'_>, 128);
17141714
static_assert_size!(LocalDecl<'_>, 40);
17151715
static_assert_size!(SourceScopeData<'_>, 64);
1716-
static_assert_size!(Statement<'_>, 32);
1716+
static_assert_size!(Statement<'_>, 56);
17171717
static_assert_size!(Terminator<'_>, 96);
17181718
static_assert_size!(VarDebugInfo<'_>, 88);
17191719
// tidy-alphabetical-end

compiler/rustc_middle/src/mir/statement.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@ use crate::ty::CoroutineArgsExt;
1414
pub struct Statement<'tcx> {
1515
pub source_info: SourceInfo,
1616
pub kind: StatementKind<'tcx>,
17+
pub debug_info: Vec<StmtDebugInfo>,
1718
}
1819

1920
impl<'tcx> Statement<'tcx> {
2021
/// Changes a statement to a nop. This is both faster than deleting instructions and avoids
2122
/// invalidating statement indices in `Location`s.
2223
pub fn make_nop(&mut self) {
24+
// TODO: convert the stmt to debuginfo.
2325
self.kind = StatementKind::Nop
2426
}
2527

2628
pub fn new(source_info: SourceInfo, kind: StatementKind<'tcx>) -> Self {
27-
Statement { source_info, kind }
29+
Statement { source_info, kind, debug_info: Vec::new() }
2830
}
2931
}
3032

@@ -938,3 +940,6 @@ impl RawPtrKind {
938940
}
939941
}
940942
}
943+
944+
#[derive(Debug, Clone, TyEncodable, TyDecodable, HashStable, TypeFoldable, TypeVisitable)]
945+
pub struct StmtDebugInfo {}

compiler/rustc_middle/src/mir/visit.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ macro_rules! make_mir_visitor {
381381
statement: & $($mutability)? Statement<'tcx>,
382382
location: Location
383383
) {
384-
let Statement { source_info, kind } = statement;
384+
// TODO: visit debuginfo
385+
let Statement { source_info, kind, .. } = statement;
385386

386387
self.visit_source_info(source_info);
387388
match kind {

0 commit comments

Comments
 (0)