From a7e0eb35819bb9171b60f2854753f7784da6a087 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 3 May 2012 17:07:57 -0700 Subject: [PATCH] allow enums that ref themselves via unsafe pointers --- src/rustc/middle/ty.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index cf8f223afd9..a64c1a5a777 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -1475,11 +1475,14 @@ fn is_instantiable(cx: ctxt, r_ty: t) -> bool { ty_box(mt) | ty_uniq(mt) | - ty_ptr(mt) | ty_rptr(_, mt) { be type_requires(cx, seen, r_ty, mt.ty); } + ty_ptr(mt) { + false // unsafe ptrs can always be NULL + } + ty_rec(fields) { vec::any(fields) {|field| type_requires(cx, seen, r_ty, field.mt.ty)