diff --git a/compiler/rustc_mir_transform/src/coverage/spans.rs b/compiler/rustc_mir_transform/src/coverage/spans.rs index 5b7b343949c..512d4daf343 100644 --- a/compiler/rustc_mir_transform/src/coverage/spans.rs +++ b/compiler/rustc_mir_transform/src/coverage/spans.rs @@ -485,7 +485,7 @@ fn check_invoked_macro_name_span(&mut self) { }) { let merged_prefix_len = self.curr_original_span.lo() - self.curr().span.lo(); let after_macro_bang = - merged_prefix_len + BytePos(visible_macro.as_str().bytes().count() as u32 + 1); + merged_prefix_len + BytePos(visible_macro.as_str().len() as u32 + 1); let mut macro_name_cov = self.curr().clone(); self.curr_mut().span = self.curr().span.with_lo(self.curr().span.lo() + after_macro_bang);