]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/large_stack_arrays.rs
Rollup merge of #100462 - zohnannor:master, r=thomcc
[rust.git] / src / tools / clippy / tests / ui / large_stack_arrays.rs
1 #![warn(clippy::large_stack_arrays)]
2 #![allow(clippy::large_enum_variant)]
3
4 #[derive(Clone, Copy)]
5 struct S {
6     pub data: [u64; 32],
7 }
8
9 #[derive(Clone, Copy)]
10 enum E {
11     S(S),
12     T(u32),
13 }
14
15 pub static DOESNOTLINT: [u8; 512_001] = [0; 512_001];
16 pub static DOESNOTLINT2: [u8; 512_001] = {
17     let x = 0;
18     [x; 512_001]
19 };
20
21 fn main() {
22     let bad = (
23         [0u32; 20_000_000],
24         [S { data: [0; 32] }; 5000],
25         [Some(""); 20_000_000],
26         [E::T(0); 5000],
27     );
28
29     let good = (
30         [0u32; 1000],
31         [S { data: [0; 32] }; 1000],
32         [Some(""); 1000],
33         [E::T(0); 1000],
34         [(); 20_000_000],
35     );
36 }