diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-03-02 07:15:04 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-03-07 08:25:50 +1100 |
| commit | 92d1850f17f8a2f0e300e2350cc9a53463d0f23a (patch) | |
| tree | 4a86249815f23b1b3463da8531048c2bc4eee021 /library/std/src/sys/unix/stack_overflow.rs | |
| parent | 8238b914028fddeeb89d2df84988c97dc89fccfb (diff) | |
| download | rust-92d1850f17f8a2f0e300e2350cc9a53463d0f23a.tar.gz rust-92d1850f17f8a2f0e300e2350cc9a53463d0f23a.zip | |
Introduce `ConstAllocation`.
Currently some `Allocation`s are interned, some are not, and it's very hard to tell at a use point which is which. This commit introduces `ConstAllocation` for the known-interned ones, which makes the division much clearer. `ConstAllocation::inner()` is used to get the underlying `Allocation`. In some places it's natural to use an `Allocation`, in some it's natural to use a `ConstAllocation`, and in some places there's no clear choice. I've tried to make things look as nice as possible, while generally favouring `ConstAllocation`, which is the type that embodies more information. This does require quite a few calls to `inner()`. The commit also tweaks how `PartialOrd` works for `Interned`. The previous code was too clever by half, building on `T: Ord` to make the code shorter. That caused problems with deriving `PartialOrd` and `Ord` for `ConstAllocation`, so I changed it to build on `T: PartialOrd`, which is slightly more verbose but much more standard and avoided the problems.
Diffstat (limited to 'library/std/src/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
