From 9b58369f6ba8e01f1965e8aa39e8c7fc25f861cc Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Tue, 18 Sep 2012 16:28:16 -0700 Subject: [PATCH] Treat static slices and rptrs as sendable. --- src/rustc/middle/ty.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index b3450b922bb..f0f5a4165cd 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -1950,7 +1950,11 @@ fn type_kind(cx: ctxt, ty: t) -> kind { // Trait instances are (for now) like shared boxes, basically ty_trait(_, _, _) => kind_safe_for_default_mode() | kind_owned(), - // Region pointers are copyable but NOT owned nor sendable + // Static region pointers are copyable and sendable, but not owned + ty_rptr(re_static, mt) => + kind_safe_for_default_mode() | mutable_type_kind(cx, mt), + + // General region pointers are copyable but NOT owned nor sendable ty_rptr(_, _) => kind_safe_for_default_mode(), // Unique boxes and vecs have the kind of their contained type, @@ -1972,6 +1976,9 @@ fn type_kind(cx: ctxt, ty: t) -> kind { ty_evec(tm, vstore_box) => { remove_send(kind_safe_for_default_mode() | mutable_type_kind(cx, tm)) } + ty_evec(tm, vstore_slice(re_static)) => { + kind_safe_for_default_mode() | mutable_type_kind(cx, tm) + } ty_evec(tm, vstore_slice(_)) => { remove_owned_send(kind_safe_for_default_mode() | mutable_type_kind(cx, tm)) @@ -1984,6 +1991,9 @@ fn type_kind(cx: ctxt, ty: t) -> kind { ty_estr(vstore_box) => { kind_safe_for_default_mode() | kind_const() | kind_owned() } + ty_estr(vstore_slice(re_static)) => { + kind_safe_for_default_mode() | kind_send_copy() | kind_const() + } ty_estr(vstore_slice(_)) => { kind_safe_for_default_mode() | kind_const() }