]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_const_eval/src/transform/promote_consts.rs
add cast kind of from_exposed_addr (int-to-ptr casts)
[rust.git] / compiler / rustc_const_eval / src / transform / promote_consts.rs
index ea23bd14d2538fe03f285e62a20374ab5d55b2fd..4879e8de10000f4f2ee44eefff13419bba0a5a69 100644 (file)
@@ -502,9 +502,10 @@ fn validate_rvalue(&mut self, rvalue: &Rvalue<'tcx>) -> Result<(), Unpromotable>
             Rvalue::ThreadLocalRef(_) => return Err(Unpromotable),
 
             // ptr-to-int casts are not possible in consts and thus not promotable
-            Rvalue::Cast(CastKind::PointerAddress, _, _) => return Err(Unpromotable),
+            Rvalue::Cast(CastKind::PointerExposeAddress, _, _) => return Err(Unpromotable),
 
-            // int-to-ptr casts are fine, they just use the integer value at pointer type.
+            // all ohter casts including int-to-ptr casts are fine, they just use the integer value
+            // at pointer type.
             Rvalue::Cast(_, operand, _) => {
                 self.validate_operand(operand)?;
             }