File tree 3 files changed +40
-0
lines changed
tests/ui-toml/array_size_threshold 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ #![ allow( unused) ]
2
+ #![ warn( clippy:: large_const_arrays, clippy:: large_stack_arrays) ]
3
+
4
+ const ABOVE : [ u8 ; 11 ] = [ 0 ; 11 ] ;
5
+ const BELOW : [ u8 ; 10 ] = [ 0 ; 10 ] ;
6
+
7
+ fn main ( ) {
8
+ let above = [ 0u8 ; 11 ] ;
9
+ let below = [ 0u8 ; 10 ] ;
10
+ }
Original file line number Diff line number Diff line change
1
+ error: large array defined as const
2
+ --> $DIR/array_size_threshold.rs:4:1
3
+ |
4
+ LL | const ABOVE: [u8; 11] = [0; 11];
5
+ | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^
6
+ | |
7
+ | help: make this a static item: `static`
8
+ |
9
+ = note: `-D clippy::large-const-arrays` implied by `-D warnings`
10
+
11
+ error: allocating a local array larger than 10 bytes
12
+ --> $DIR/array_size_threshold.rs:4:25
13
+ |
14
+ LL | const ABOVE: [u8; 11] = [0; 11];
15
+ | ^^^^^^^
16
+ |
17
+ = help: consider allocating on the heap with `vec![0; 11].into_boxed_slice()`
18
+ = note: `-D clippy::large-stack-arrays` implied by `-D warnings`
19
+
20
+ error: allocating a local array larger than 10 bytes
21
+ --> $DIR/array_size_threshold.rs:8:17
22
+ |
23
+ LL | let above = [0u8; 11];
24
+ | ^^^^^^^^^
25
+ |
26
+ = help: consider allocating on the heap with `vec![0u8; 11].into_boxed_slice()`
27
+
28
+ error: aborting due to 3 previous errors
29
+
Original file line number Diff line number Diff line change
1
+ array-size-threshold = 10
You can’t perform that action at this time.
0 commit comments