@@ -123,8 +123,17 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
123
123
124
124
let line_strings = & mut self . debug_context . dwarf . line_strings ;
125
125
let function_span = self . mir . span ;
126
+ let mut last_span = None ;
126
127
let mut last_file = None ;
127
128
let mut create_row_for_span = |line_program : & mut LineProgram , span : Span | {
129
+ if let Some ( last_span) = last_span {
130
+ if span == last_span {
131
+ line_program. generate_row ( ) ;
132
+ return ;
133
+ }
134
+ }
135
+ last_span = Some ( span) ;
136
+
128
137
// Based on https://github.com/rust-lang/rust/blob/e369d87b015a84653343032833d65d0545fd3f26/src/librustc_codegen_ssa/mir/mod.rs#L116-L131
129
138
// In order to have a good line stepping behavior in debugger, we overwrite debug
130
139
// locations of macro expansions with that of the outermost expansion site
@@ -150,7 +159,7 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
150
159
151
160
// line_program_add_file is very slow.
152
161
// Optimize for the common case of the current file not being changed.
153
- let current_file_changed = if let Some ( last_file) = & mut last_file {
162
+ let current_file_changed = if let Some ( last_file) = & last_file {
154
163
// If the allocations are not equal, then the files may still be equal, but that
155
164
// is not a problem, as this is just an optimization.
156
165
!Lrc :: ptr_eq ( last_file, & file)
0 commit comments