From 37abcda42b5060eafd65bf9fe6a6861efa5f0c15 Mon Sep 17 00:00:00 2001
From: Patrick Walton <pcwalton@mimiga.net>
Date: Thu, 17 May 2012 17:20:58 -0700
Subject: [PATCH] rustc: Make type_is_pod class-aware

---
 src/rustc/middle/ty.rs | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs
index 0501a6fa815..3b8fe334dc4 100644
--- a/src/rustc/middle/ty.rs
+++ b/src/rustc/middle/ty.rs
@@ -1686,6 +1686,13 @@ fn type_is_pod(cx: ctxt, ty: t) -> bool {
       ty_constr(subt, _) { result = type_is_pod(cx, subt); }
       ty_param(_, _) { result = false; }
       ty_opaque_closure_ptr(_) { result = true; }
+      ty_class(did, substs) {
+        result = vec::any(lookup_class_fields(cx, did)) { |f|
+            let fty = ty::lookup_item_type(cx, f.id);
+            let sty = subst(cx, substs, fty.ty);
+            type_is_pod(cx, sty)
+        };
+      }
       _ { cx.sess.bug("unexpected type in type_is_pod"); }
     }