Skip to content

Commit

Permalink
Document newtype_index attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed Nov 21, 2023
1 parent 587a542 commit e55e28b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions compiler/rustc_index_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit e55e28b

Please sign in to comment.