granite-rust/compiler/rustc_middle/src
Nicholas Nethercote 4852291417 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.
2022-03-07 08:25:50 +11:00
..
dep_graph Adopt let_else in even more places 2022-02-16 22:43:39 +01:00
hir resolve: Fix incorrect results of opt_def_kind query for some built-in macros 2022-02-24 22:54:36 +03:00
infer Inline UnifyKey::index and UnifyKey::from_index 2022-02-15 19:07:06 +01:00
middle Remove useless map. 2022-03-03 18:14:34 +01:00
mir Introduce ConstAllocation. 2022-03-07 08:25:50 +11:00
query rename ErrorReported -> ErrorGuaranteed 2022-03-02 09:45:25 -06:00
thir rename ErrorReported -> ErrorGuaranteed 2022-03-02 09:45:25 -06:00
traits rename ErrorReported -> ErrorGuaranteed 2022-03-02 09:45:25 -06:00
ty Introduce ConstAllocation. 2022-03-07 08:25:50 +11:00
util Use AddAssign impl 2021-11-09 23:47:36 +01:00
arena.rs Overhaul Const. 2022-02-15 16:19:59 +11:00
lib.rs Add helper function to suggest multiple constraints 2022-03-01 13:43:11 +03:00
lint.rs Use Vec for expectations to have a constant order (RFC-2383) 2022-03-02 18:10:07 +01:00
macros.rs Rename TypeFolderFallible to FallibleTypeFolder 2021-12-02 16:14:18 +00:00
metadata.rs resolve/metadata: Stop encoding macros as reexports 2022-02-24 22:55:40 +03:00
tests.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
thir.rs Revert "Auto merge of #93800 - b-naber:static-initializers-mir-val, r=oli-obk" 2022-02-20 21:56:20 -05:00