mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Stop hiding const eval limit in external macros
This commit is contained in:
parent
c55d1ee8d4
commit
aacd702895
@ -3464,7 +3464,8 @@ declare_lint! {
|
||||
/// out an update in your own time.
|
||||
pub LONG_RUNNING_CONST_EVAL,
|
||||
Deny,
|
||||
"detects long const eval operations"
|
||||
"detects long const eval operations",
|
||||
report_in_external_macro
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
|
25
tests/ui/consts/timeout.rs
Normal file
25
tests/ui/consts/timeout.rs
Normal file
@ -0,0 +1,25 @@
|
||||
//! This test checks that external macros don't hide
|
||||
//! the const eval timeout lint and then subsequently
|
||||
//! ICE.
|
||||
|
||||
// compile-flags: --crate-type=lib -Ztiny-const-eval-limit
|
||||
// error-pattern: constant evaluation is taking a long time
|
||||
|
||||
static ROOK_ATTACKS_TABLE: () = {
|
||||
0_u64.count_ones();
|
||||
0_u64.count_ones();
|
||||
0_u64.count_ones();
|
||||
0_u64.count_ones();
|
||||
0_u64.count_ones();
|
||||
0_u64.count_ones();
|
||||
0_u64.count_ones();
|
||||
0_u64.count_ones();
|
||||
0_u64.count_ones();
|
||||
0_u64.count_ones();
|
||||
0_u64.count_ones();
|
||||
0_u64.count_ones();
|
||||
0_u64.count_ones();
|
||||
0_u64.count_ones();
|
||||
0_u64.count_ones();
|
||||
0_u64.count_ones();
|
||||
};
|
15
tests/ui/consts/timeout.stderr
Normal file
15
tests/ui/consts/timeout.stderr
Normal file
@ -0,0 +1,15 @@
|
||||
error: constant evaluation is taking a long time
|
||||
--> $SRC_DIR/core/src/num/mod.rs:LL:COL
|
||||
|
|
||||
= note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
|
||||
If your compilation actually takes a long time, you can safely allow the lint.
|
||||
help: the constant being evaluated
|
||||
--> $DIR/timeout.rs:8:1
|
||||
|
|
||||
LL | static ROOK_ATTACKS_TABLE: () = {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `#[deny(long_running_const_eval)]` on by default
|
||||
= note: this error originates in the macro `uint_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
Reference in New Issue
Block a user