about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <github35764891676564198441@oli-obk.de>2021-03-16 18:26:09 +0100
committerGitHub <noreply@github.com>2021-03-16 18:26:09 +0100
commitf0997fa1e85d305afef2b5b4e74c4a9b1a043ec2 (patch)
tree1ff2d358c31c81e1363916a142d27eda6434123b
parent1ffd21a15c19121e46f931f44e8442e4a31df236 (diff)
downloadrust-f0997fa1e85d305afef2b5b4e74c4a9b1a043ec2.tar.gz
rust-f0997fa1e85d305afef2b5b4e74c4a9b1a043ec2.zip
Update compiler/rustc_mir/src/const_eval/mod.rs
Co-authored-by: Ralf Jung <post@ralfj.de>
-rw-r--r--compiler/rustc_mir/src/const_eval/mod.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rustc_mir/src/const_eval/mod.rs b/compiler/rustc_mir/src/const_eval/mod.rs
index c45c29ccdcf..77531ae2c5f 100644
--- a/compiler/rustc_mir/src/const_eval/mod.rs
+++ b/compiler/rustc_mir/src/const_eval/mod.rs
@@ -84,11 +84,10 @@ fn const_to_valtree_inner<'tcx>(
             Some(ty::ValTree::Leaf(val.assert_int()))
         }
 
-        // Raw pointers are not allowed in type level constants, as raw pointers compare equal if
-        // their addresses are equal. Since we cannot guarantee any kind of pointer stability in
-        // the type system.
-        // Technically we could allow function pointers, but they are not guaranteed to be the
-        // same as the function pointers at runtime.
+        // Raw pointers are not allowed in type level constants, as we cannot properly test them for
+        // equality at compile-time (see `ptr_guaranteed_eq`/`_ne`).
+        // Technically we could allow function pointers (represented as `ty::Instance`), but this is not guaranteed to
+        // agree with runtime equality tests.
         ty::FnPtr(_) | ty::RawPtr(_) => None,
         ty::Ref(..) => unimplemented!("need to use deref_const"),