Skip to content

Commit f0997fa

Browse files
oli-obkRalfJung
andauthored
Update compiler/rustc_mir/src/const_eval/mod.rs
Co-authored-by: Ralf Jung <[email protected]>
1 parent 1ffd21a commit f0997fa

File tree

1 file changed

+4
-5
lines changed
  • compiler/rustc_mir/src/const_eval

1 file changed

+4
-5
lines changed

compiler/rustc_mir/src/const_eval/mod.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,10 @@ fn const_to_valtree_inner<'tcx>(
8484
Some(ty::ValTree::Leaf(val.assert_int()))
8585
}
8686

87-
// Raw pointers are not allowed in type level constants, as raw pointers compare equal if
88-
// their addresses are equal. Since we cannot guarantee any kind of pointer stability in
89-
// the type system.
90-
// Technically we could allow function pointers, but they are not guaranteed to be the
91-
// same as the function pointers at runtime.
87+
// Raw pointers are not allowed in type level constants, as we cannot properly test them for
88+
// equality at compile-time (see `ptr_guaranteed_eq`/`_ne`).
89+
// Technically we could allow function pointers (represented as `ty::Instance`), but this is not guaranteed to
90+
// agree with runtime equality tests.
9291
ty::FnPtr(_) | ty::RawPtr(_) => None,
9392
ty::Ref(..) => unimplemented!("need to use deref_const"),
9493

0 commit comments

Comments
 (0)