about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/src/builder.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-03-06 22:37:54 +0000
committerbors <bors@rust-lang.org>2022-03-06 22:37:54 +0000
commit8876ca3dd46b99fe7e6ad937f11493d37996231e (patch)
treecf019658fc97dc581e45f15d0ca2a67cbfa9c7ef /compiler/rustc_codegen_gcc/src/builder.rs
parent38a0b81b1c32764d6a583a5efb6f306b8c44c503 (diff)
parent4852291417127d86c3f8404ef03cb1706d89a3e6 (diff)
downloadrust-8876ca3dd46b99fe7e6ad937f11493d37996231e.tar.gz
rust-8876ca3dd46b99fe7e6ad937f11493d37996231e.zip
Auto merge of #94597 - nnethercote:ConstAllocation, r=fee1-dead
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.

r? `@fee1-dead`
Diffstat (limited to 'compiler/rustc_codegen_gcc/src/builder.rs')
0 files changed, 0 insertions, 0 deletions