1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// This file is part of ICU4X. For terms of use, please see the file
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
/*************************************************************************************
* NOTE: PLEASE KEEP THIS FILE IN SYNC WITH ALL OTHER FILES NAMED size_test_macro.rs *
* TODO(#4467): Copy this file automatically *
*************************************************************************************/
/// Generates a test that checks the stack size of an item and a macro
/// that should be used with `#[doc]` to document it.
///
/// ```text
/// size_test!(MyType, my_type_size, 32);
///
/// // Add this annotation to the type's docs:
/// #[doc = my_type_size!()]
/// ```
///
/// The size should correspond to the Rust version in rust-toolchain.toml.
///
/// If the size on latest beta differs from rust-toolchain.toml, use the
/// named arguments version of this macro to specify both sizes:
///
/// ```text
/// size_test!(MyType, my_type_size, pinned = 32, beta = 24, nightly = 24);
/// ```
///
/// The test is ignored by default but runs in CI. To run the test locally,
/// run `cargo test -- --include-ignored`
pub use size_test;