Prevent Deduplication of LongRunningWarn
This commit is contained in:
parent
a35da65409
commit
669f610f74
@ -641,7 +641,14 @@ fn increment_const_eval_counter(ecx: &mut InterpCx<'tcx, Self>) -> InterpResult<
|
|||||||
// current number of evaluated terminators is a power of 2. The latter gives us a cheap
|
// current number of evaluated terminators is a power of 2. The latter gives us a cheap
|
||||||
// way to implement exponential backoff.
|
// way to implement exponential backoff.
|
||||||
let span = ecx.cur_span();
|
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,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,6 +243,8 @@ pub struct LongRunningWarn {
|
|||||||
pub span: Span,
|
pub span: Span,
|
||||||
#[help]
|
#[help]
|
||||||
pub item_span: Span,
|
pub item_span: Span,
|
||||||
|
// Used for evading `-Z deduplicate-diagnostics`.
|
||||||
|
pub force_duplicate: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subdiagnostic)]
|
#[derive(Subdiagnostic)]
|
||||||
|
@ -16,5 +16,77 @@ help: the constant being evaluated
|
|||||||
LL | const FOO: () = {
|
LL | const FOO: () = {
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
warning: 1 warning emitted
|
warning: constant evaluation is taking a long time
|
||||||
|
--> $DIR/evade-deduplication-issue-118612.rs:8:5
|
||||||
|
|
|
||||||
|
LL | / loop {
|
||||||
|
LL | |
|
||||||
|
LL | |
|
||||||
|
LL | |
|
||||||
|
... |
|
||||||
|
LL | | }
|
||||||
|
LL | | }
|
||||||
|
| |_____^ the const evaluator is currently interpreting this expression
|
||||||
|
|
|
||||||
|
help: the constant being evaluated
|
||||||
|
--> $DIR/evade-deduplication-issue-118612.rs:6:1
|
||||||
|
|
|
||||||
|
LL | const FOO: () = {
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
warning: constant evaluation is taking a long time
|
||||||
|
--> $DIR/evade-deduplication-issue-118612.rs:8:5
|
||||||
|
|
|
||||||
|
LL | / loop {
|
||||||
|
LL | |
|
||||||
|
LL | |
|
||||||
|
LL | |
|
||||||
|
... |
|
||||||
|
LL | | }
|
||||||
|
LL | | }
|
||||||
|
| |_____^ the const evaluator is currently interpreting this expression
|
||||||
|
|
|
||||||
|
help: the constant being evaluated
|
||||||
|
--> $DIR/evade-deduplication-issue-118612.rs:6:1
|
||||||
|
|
|
||||||
|
LL | const FOO: () = {
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
warning: constant evaluation is taking a long time
|
||||||
|
--> $DIR/evade-deduplication-issue-118612.rs:8:5
|
||||||
|
|
|
||||||
|
LL | / loop {
|
||||||
|
LL | |
|
||||||
|
LL | |
|
||||||
|
LL | |
|
||||||
|
... |
|
||||||
|
LL | | }
|
||||||
|
LL | | }
|
||||||
|
| |_____^ the const evaluator is currently interpreting this expression
|
||||||
|
|
|
||||||
|
help: the constant being evaluated
|
||||||
|
--> $DIR/evade-deduplication-issue-118612.rs:6:1
|
||||||
|
|
|
||||||
|
LL | const FOO: () = {
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
warning: constant evaluation is taking a long time
|
||||||
|
--> $DIR/evade-deduplication-issue-118612.rs:8:5
|
||||||
|
|
|
||||||
|
LL | / loop {
|
||||||
|
LL | |
|
||||||
|
LL | |
|
||||||
|
LL | |
|
||||||
|
... |
|
||||||
|
LL | | }
|
||||||
|
LL | | }
|
||||||
|
| |_____^ the const evaluator is currently interpreting this expression
|
||||||
|
|
|
||||||
|
help: the constant being evaluated
|
||||||
|
--> $DIR/evade-deduplication-issue-118612.rs:6:1
|
||||||
|
|
|
||||||
|
LL | const FOO: () = {
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
warning: 5 warnings emitted
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user