From d7814e72ebe3b4a293a5f91fa1648d2ef72639d3 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 6 May 2024 15:36:46 +1000 Subject: [PATCH] Document `Pu128`. And move the `repr` line after the `derive` line, where it's harder to overlook. (I overlooked it initially, and didn't understand how this type worked.) --- compiler/rustc_data_structures/src/packed.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_data_structures/src/packed.rs b/compiler/rustc_data_structures/src/packed.rs index b8d4b295dfa..0a392d91988 100644 --- a/compiler/rustc_data_structures/src/packed.rs +++ b/compiler/rustc_data_structures/src/packed.rs @@ -3,8 +3,10 @@ use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use std::cmp::Ordering; use std::fmt; -#[repr(packed(8))] +/// A packed 128-bit integer. Useful for reducing the size of structures in +/// some cases. #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[repr(packed(8))] pub struct Pu128(pub u128); impl Pu128 {