about summary refs log tree commit diff
path: root/src/librustc/metadata
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-03-20 05:51:48 -0700
committerbors <bors@rust-lang.org>2014-03-20 05:51:48 -0700
commit8e285208d550c41d5060bbc4a614c9b63c3bff6a (patch)
tree8c4ca58b43010ac4bb619df96c7425247e9ba55a /src/librustc/metadata
parent95ee0a04fd78deb773da2d1b2544696c4f0278c7 (diff)
parent7b19574a2c2faac766c5192b243e5c361e449f3b (diff)
downloadrust-8e285208d550c41d5060bbc4a614c9b63c3bff6a.tar.gz
rust-8e285208d550c41d5060bbc4a614c9b63c3bff6a.zip
auto merge of #12686 : FlaPer87/rust/shared, r=nikomatsakis
`Share` implies that all *reachable* content is *threadsafe*.

Threadsafe is defined as "exposing no operation that permits a data race if multiple threads have access to a &T pointer simultaneously". (NB: the type system should guarantee that if you have access to memory via a &T pointer, the only other way to gain access to that memory is through another &T pointer)...

Fixes #11781
cc #12577 

What this PR will do
================

- [x] Add Share kind and
- [x]  Replace usages of Freeze with Share in bounds.
- [x] Add Unsafe<T> #12577
- [x] Forbid taking the address of a immutable static item with `Unsafe<T>` interior

What's left to do in a separate PR (after the snapshot)?
===========================================

- Remove `Freeze` completely 
Diffstat (limited to 'src/librustc/metadata')
-rw-r--r--src/librustc/metadata/tydecode.rs3
-rw-r--r--src/librustc/metadata/tyencode.rs1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs
index 029edd73e9f..a990310a648 100644
--- a/src/librustc/metadata/tydecode.rs
+++ b/src/librustc/metadata/tydecode.rs
@@ -603,6 +603,9 @@ fn parse_bounds(st: &mut PState, conv: conv_did) -> ty::ParamBounds {
             'P' => {
                 param_bounds.builtin_bounds.add(ty::BoundPod);
             }
+            'T' => {
+                param_bounds.builtin_bounds.add(ty::BoundShare);
+            }
             'I' => {
                 param_bounds.trait_bounds.push(@parse_trait_ref(st, |x,y| conv(x,y)));
             }
diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs
index 7cec6532699..911729cd68a 100644
--- a/src/librustc/metadata/tyencode.rs
+++ b/src/librustc/metadata/tyencode.rs
@@ -410,6 +410,7 @@ fn enc_bounds(w: &mut MemWriter, cx: &ctxt, bs: &ty::ParamBounds) {
             ty::BoundStatic => mywrite!(w, "O"),
             ty::BoundSized => mywrite!(w, "Z"),
             ty::BoundPod => mywrite!(w, "P"),
+            ty::BoundShare => mywrite!(w, "T"),
         }
     }