summary refs log tree commit diff
path: root/compiler/rustc_mir_transform
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-11-13 04:09:18 +0000
committerbors <bors@rust-lang.org>2023-11-13 04:09:18 +0000
commit79e9716c980570bfd1f666e3b16ac583f0168962 (patch)
tree3af567c0e202f9b3b28963ef565669d164e71345 /compiler/rustc_mir_transform
parent22d4a4ff135fd79c06cf0274754bd571b1fff400 (diff)
parent7e1d1d4b220f226fdea3ce57e3604e167aa28aae (diff)
downloadrust-1.74.0.tar.gz
rust-1.74.0.zip
Auto merge of #117843 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum 1.74.0
[stable] Prepare 1.74.0 release

https://forge.rust-lang.org/release/process.html#promote-branches-t-3-days-monday

Also backports:

* Disabling specialization as an alternative backport of "Fix excessive initialization and reads beyond EOF in io::copy(_, Vec<u8>) specialization #117576"
*  coverage: Avoid creating malformed macro name spans #117827

r? `@Mark-Simulacrum`
Diffstat (limited to 'compiler/rustc_mir_transform')
-rw-r--r--compiler/rustc_mir_transform/src/coverage/spans.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/coverage/spans.rs b/compiler/rustc_mir_transform/src/coverage/spans.rs
index 767f8e9f4fa..ed0e104d6b6 100644
--- a/compiler/rustc_mir_transform/src/coverage/spans.rs
+++ b/compiler/rustc_mir_transform/src/coverage/spans.rs
@@ -427,6 +427,12 @@ impl<'a, 'tcx> CoverageSpans<'a, 'tcx> {
                 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().len() as u32 + 1);
+                if self.curr().span.lo() + after_macro_bang > self.curr().span.hi() {
+                    // Something is wrong with the macro name span;
+                    // return now to avoid emitting malformed mappings.
+                    // FIXME(#117788): Track down why this happens.
+                    return;
+                }
                 let mut macro_name_cov = self.curr().clone();
                 self.curr_mut().span =
                     self.curr().span.with_lo(self.curr().span.lo() + after_macro_bang);