about summary refs log tree commit diff
path: root/compiler/rustc_const_eval
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-09-22 07:48:56 +0000
committerbors <bors@rust-lang.org>2024-09-22 07:48:56 +0000
commit80aa6fa7314bddcfe95a68f4eb426b296bfdf4a9 (patch)
tree1b267c6f486e10f7a0a8dd557e7520f40f369fe2 /compiler/rustc_const_eval
parent1f9a018fa30a13150b5e3b308d1aa16f86e27ecb (diff)
parentf314db6d6bf3f0fb8268334f2868a266c3587572 (diff)
downloadrust-80aa6fa7314bddcfe95a68f4eb426b296bfdf4a9.tar.gz
rust-80aa6fa7314bddcfe95a68f4eb426b296bfdf4a9.zip
Auto merge of #130688 - workingjubilee:rollup-ovre6p7, r=workingjubilee
Rollup of 5 pull requests

Successful merges:

 - #130648 (move enzyme flags from general cargo to rustc-specific cargo)
 - #130650 (Fixup Apple target's description strings)
 - #130664 (Generate line numbers for non-rust code examples as well)
 - #130665 (Prevent Deduplication of `LongRunningWarn`)
 - #130669 (tests: Test that `extern "C" fn` ptrs lint on slices)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_const_eval')
-rw-r--r--compiler/rustc_const_eval/src/const_eval/machine.rs9
-rw-r--r--compiler/rustc_const_eval/src/errors.rs2
2 files changed, 10 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/const_eval/machine.rs b/compiler/rustc_const_eval/src/const_eval/machine.rs
index 6a691abae02..9daee12ca2e 100644
--- a/compiler/rustc_const_eval/src/const_eval/machine.rs
+++ b/compiler/rustc_const_eval/src/const_eval/machine.rs
@@ -641,7 +641,14 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeMachine<'tcx> {
                 // current number of evaluated terminators is a power of 2. The latter gives us a cheap
                 // way to implement exponential backoff.
                 let span = ecx.cur_span();
-                ecx.tcx.dcx().emit_warn(LongRunningWarn { span, item_span: ecx.tcx.span });
+                // We store a unique number in `force_duplicate` to evade `-Z deduplicate-diagnostics`.
+                // `new_steps` is guaranteed to be unique because `ecx.machine.num_evaluated_steps` is
+                // always increasing.
+                ecx.tcx.dcx().emit_warn(LongRunningWarn {
+                    span,
+                    item_span: ecx.tcx.span,
+                    force_duplicate: new_steps,
+                });
             }
         }
 
diff --git a/compiler/rustc_const_eval/src/errors.rs b/compiler/rustc_const_eval/src/errors.rs
index b66b5c0a00a..06ae5b30be0 100644
--- a/compiler/rustc_const_eval/src/errors.rs
+++ b/compiler/rustc_const_eval/src/errors.rs
@@ -209,6 +209,8 @@ pub struct LongRunningWarn {
     pub span: Span,
     #[help]
     pub item_span: Span,
+    // Used for evading `-Z deduplicate-diagnostics`.
+    pub force_duplicate: usize,
 }
 
 #[derive(Subdiagnostic)]