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.
This commit is contained in:
parent
0cc64a34e9
commit
a4fbac163e
10 changed files with 132 additions and 6 deletions
|
@ -785,6 +785,14 @@ rustc_queries! {
|
|||
cache_on_disk_if { true }
|
||||
}
|
||||
|
||||
/// Convert an evaluated constant to a type level constant or
|
||||
/// return `None` if that is not possible.
|
||||
query const_to_valtree(
|
||||
key: ty::ParamEnvAnd<'tcx, ConstAlloc<'tcx>>
|
||||
) -> Option<ty::ValTree> {
|
||||
desc { "destructure constant" }
|
||||
}
|
||||
|
||||
/// Destructure a constant ADT or array into its variant index and its
|
||||
/// field values.
|
||||
query destructure_const(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue