diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-11-21 18:42:34 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-11-22 18:38:20 +1100 |
| commit | 0991374bd1c99e1e64f47a884b10932b39ad61c2 (patch) | |
| tree | 46fbfa0c34c64f26fa62eba49bcd49fa0a33ed80 | |
| parent | 7060fc8327f457882823fcc1737a964407eed0d6 (diff) | |
| download | rust-0991374bd1c99e1e64f47a884b10932b39ad61c2.tar.gz rust-0991374bd1c99e1e64f47a884b10932b39ad61c2.zip | |
Document `newtype_index` attributes.
| -rw-r--r-- | compiler/rustc_index_macros/src/lib.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/compiler/rustc_index_macros/src/lib.rs b/compiler/rustc_index_macros/src/lib.rs index f6a6175374a..13500949a22 100644 --- a/compiler/rustc_index_macros/src/lib.rs +++ b/compiler/rustc_index_macros/src/lib.rs @@ -18,8 +18,19 @@ mod newtype; /// to create/return a value. /// /// Internally, the index uses a u32, so the index must not exceed -/// `u32::MAX`. You can also customize things like the `Debug` impl, -/// what traits are derived, and so forth via the macro. +/// `u32::MAX`. +/// +/// The impls provided by default are Clone, Copy, PartialEq, Eq, and Hash. +/// +/// Accepted attributes for customization: +/// - #[derive(HashStable_Generic)]/#[derive(HashStable)]: derives +/// `HashStable`, as normal. +/// - #[encodable]: derives `Encodable`/`Decodable`. +/// - #[orderable]: derives `PartialOrd`/`Ord`, plus step-related methods. +/// - #[debug_format = "Foo({})"]: derives `Debug` with particular output. +/// - #[max = 0xFFFF_FFFD]: specifies the max value, which allows niche +/// optimizations. The default max value is 0xFFFF_FF00. +/// - #[gate_rustc_only]: makes parts of the generated code nightly-only. #[proc_macro] #[cfg_attr( feature = "nightly", |
