diff options
| author | Oli Scherer <github35764891676564198441@oli-obk.de> | 2021-02-22 14:09:24 +0000 |
|---|---|---|
| committer | Oli Scherer <github35764891676564198441@oli-obk.de> | 2021-03-12 12:16:14 +0000 |
| commit | a4fbac163e7291b052fa5ec64f14cc0a52932ff4 (patch) | |
| tree | a22e430dc163277eee97d277e2278dbf558e4ac2 /compiler/rustc_middle/src/mir | |
| parent | 0cc64a34e9823a4ce6491dc5e13e920cd4f5aa31 (diff) | |
| download | rust-a4fbac163e7291b052fa5ec64f14cc0a52932ff4.tar.gz rust-a4fbac163e7291b052fa5ec64f14cc0a52932ff4.zip | |
Implement valtree
valtree is a version of constants that is inherently safe to be used within types. This is in contrast to ty::Const which can have different representations of the same value. These representation differences can show up in hashing or equality comparisons, breaking type equality of otherwise equal types. valtrees do not have this problem.
Diffstat (limited to 'compiler/rustc_middle/src/mir')
| -rw-r--r-- | compiler/rustc_middle/src/mir/interpret/value.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/mir/interpret/value.rs b/compiler/rustc_middle/src/mir/interpret/value.rs index a07ccd4d2b5..ba9b285e8e6 100644 --- a/compiler/rustc_middle/src/mir/interpret/value.rs +++ b/compiler/rustc_middle/src/mir/interpret/value.rs @@ -13,7 +13,7 @@ use crate::ty::{ParamEnv, ScalarInt, Ty, TyCtxt}; use super::{AllocId, Allocation, InterpResult, Pointer, PointerArithmetic}; /// Represents the result of const evaluation via the `eval_to_allocation` query. -#[derive(Clone, HashStable, TyEncodable, TyDecodable, Debug)] +#[derive(Copy, Clone, HashStable, TyEncodable, TyDecodable, Debug, Hash, Eq, PartialEq)] pub struct ConstAlloc<'tcx> { // the value lives here, at offset 0, and that allocation definitely is a `AllocKind::Memory` // (so you can use `AllocMap::unwrap_memory`). |
