Index: src/prelude/builtins.c
===================================================================
--- src/prelude/builtins.c	(revision cdbfab0d9666b55e218af2f33951428230e8b826)
+++ src/prelude/builtins.c	(revision 9c3543102dd7ddc536fce11908c849a078505fc7)
@@ -96,4 +96,25 @@
 static inline unsigned int ?\=?( unsigned int & x, unsigned long int y ) { x = x \ y; return x; }
 
+// type that wraps a pointer and a destructor-like function - used in generating implicit destructor calls for struct members in user-defined functions
+forall(dtype T)
+struct __Destructor {
+  T * object;
+  void (*dtor)(T *);
+};
+
+// defined destructor in the case that non-generated code wants to use __Destructor
+forall(dtype T)
+static inline void ^?{}(__Destructor(T) & x) {
+  x.dtor(x.object);
+}
+
+// easy interface into __Destructor's destructor for easy codegen purposes
+extern "C" {
+  forall(dtype T)
+  static inline void __destroy_Destructor(__Destructor(T) * dtor) {
+    ^(*dtor){};
+  }
+}
+
 // Local Variables: //
 // mode: c //
