about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorwoppopo <woppopo@protonmail.com>2022-01-26 13:06:09 +0900
committerwoppopo <woppopo@protonmail.com>2022-01-26 13:06:09 +0900
commit29932db09bb985072dc68d9d4e4acab09e69562a (patch)
tree6f0e8d2b0a52aabfc67996bc5ed4fe0ef9bd162b /compiler/rustc_codegen_ssa/src
parentaa6795e2d4cdae6af2ea854744c3bec2eb30d16e (diff)
downloadrust-29932db09bb985072dc68d9d4e4acab09e69562a.tar.gz
rust-29932db09bb985072dc68d9d4e4acab09e69562a.zip
`const_deallocate`: Don't deallocate memory allocated in an another const. Does nothing at runtime.
`const_allocate`:  Returns a null pointer at runtime.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/intrinsic.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
index 3657f80c2de..c654232c10a 100644
--- a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
@@ -369,6 +369,16 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                 }
             }
 
+            sym::const_allocate => {
+                // returns a null pointer at runtime.
+                bx.const_null(bx.type_i8p())
+            }
+
+            sym::const_deallocate => {
+                // nop at runtime.
+                return;
+            }
+
             // This requires that atomic intrinsics follow a specific naming pattern:
             // "atomic_<operation>[_<ordering>]", and no ordering means SeqCst
             name if name_str.starts_with("atomic_") => {