about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2023-09-16 09:41:46 +0200
committerRalf Jung <post@ralfj.de>2023-09-19 11:11:03 +0200
commitd14e601661e221be8f11ea7077d23edcbd0d0036 (patch)
tree87aff1740d52a9d90904445dd3eab08de89e8223
parent5a0a1ff0cdb37ffb5fe970a4bcbde9df4ef1d602 (diff)
downloadrust-d14e601661e221be8f11ea7077d23edcbd0d0036.tar.gz
rust-d14e601661e221be8f11ea7077d23edcbd0d0036.zip
comment on the difference between mir::ConstantKind::Unevaluated and mir::ConstantKind::Ty(ty::ConstKind::Unevaluated)
-rw-r--r--compiler/rustc_middle/src/mir/consts.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/mir/consts.rs b/compiler/rustc_middle/src/mir/consts.rs
index 8ea951d0c6e..9e86eb214c1 100644
--- a/compiler/rustc_middle/src/mir/consts.rs
+++ b/compiler/rustc_middle/src/mir/consts.rs
@@ -200,6 +200,11 @@ pub enum ConstantKind<'tcx> {
     Ty(ty::Const<'tcx>),
 
     /// An unevaluated mir constant which is not part of the type system.
+    ///
+    /// Note that `Ty(ty::ConstKind::Unevaluated)` and this variant are *not* identical! `Ty` will
+    /// always flow through a valtree, so all data not captured in the valtree is lost. This variant
+    /// directly uses the evaluated result of the given constant, including e.g. data stored in
+    /// padding.
     Unevaluated(UnevaluatedConst<'tcx>, Ty<'tcx>),
 
     /// This constant cannot go back into the type system, as it represents