File tree 3 files changed +42
-1
lines changed
compiler/rustc_lint_defs/src
3 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -3464,7 +3464,8 @@ declare_lint! {
3464
3464
/// out an update in your own time.
3465
3465
pub LONG_RUNNING_CONST_EVAL ,
3466
3466
Deny ,
3467
- "detects long const eval operations"
3467
+ "detects long const eval operations" ,
3468
+ report_in_external_macro
3468
3469
}
3469
3470
3470
3471
declare_lint ! {
Original file line number Diff line number Diff line change
1
+ //! This test checks that external macros don't hide
2
+ //! the const eval timeout lint and then subsequently
3
+ //! ICE.
4
+
5
+ // compile-flags: --crate-type=lib -Ztiny-const-eval-limit
6
+ // error-pattern: constant evaluation is taking a long time
7
+
8
+ static ROOK_ATTACKS_TABLE : ( ) = {
9
+ 0_u64 . count_ones ( ) ;
10
+ 0_u64 . count_ones ( ) ;
11
+ 0_u64 . count_ones ( ) ;
12
+ 0_u64 . count_ones ( ) ;
13
+ 0_u64 . count_ones ( ) ;
14
+ 0_u64 . count_ones ( ) ;
15
+ 0_u64 . count_ones ( ) ;
16
+ 0_u64 . count_ones ( ) ;
17
+ 0_u64 . count_ones ( ) ;
18
+ 0_u64 . count_ones ( ) ;
19
+ 0_u64 . count_ones ( ) ;
20
+ 0_u64 . count_ones ( ) ;
21
+ 0_u64 . count_ones ( ) ;
22
+ 0_u64 . count_ones ( ) ;
23
+ 0_u64 . count_ones ( ) ;
24
+ 0_u64 . count_ones ( ) ;
25
+ } ;
Original file line number Diff line number Diff line change
1
+ error: constant evaluation is taking a long time
2
+ --> $SRC_DIR/core/src/num/mod.rs:LL:COL
3
+ |
4
+ = note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
5
+ If your compilation actually takes a long time, you can safely allow the lint.
6
+ help: the constant being evaluated
7
+ --> $DIR/timeout.rs:8:1
8
+ |
9
+ LL | static ROOK_ATTACKS_TABLE: () = {
10
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11
+ = note: `#[deny(long_running_const_eval)]` on by default
12
+ = note: this error originates in the macro `uint_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
13
+
14
+ error: aborting due to previous error
15
+
You can’t perform that action at this time.
0 commit comments