about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFlavio Percoco <flaper87@gmail.com>2015-01-26 21:30:56 +0100
committerFlavio Percoco <flaper87@gmail.com>2015-02-22 02:14:24 +0100
commitbd511f73be526640ae98012d302201a019f9b458 (patch)
tree35957397e49f86cab40b4e90c9eb879e98c77e35 /src
parentad3e748128dc52d55820acc07aa034f61f90006d (diff)
downloadrust-bd511f73be526640ae98012d302201a019f9b458.tar.gz
rust-bd511f73be526640ae98012d302201a019f9b458.zip
Add negative impls for `*const T` and `*mut T`
Diffstat (limited to 'src')
-rw-r--r--src/libcore/lib.rs1
-rw-r--r--src/libcore/marker.rs6
-rw-r--r--src/librustc/middle/traits/select.rs6
3 files changed, 11 insertions, 2 deletions
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 3c58480ff0c..0370d6473d7 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -68,6 +68,7 @@
 #![feature(staged_api)]
 #![feature(unboxed_closures)]
 #![feature(rustc_attrs)]
+#![feature(optin_builtin_traits)]
 
 #[macro_use]
 mod macros;
diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs
index d284eb34179..eefb6ef7703 100644
--- a/src/libcore/marker.rs
+++ b/src/libcore/marker.rs
@@ -49,6 +49,9 @@ pub unsafe trait Send : MarkerTrait {
     // empty.
 }
 
+impl<T> !Send for *const T { }
+impl<T> !Send for *mut T { }
+
 /// Types with a constant size known at compile-time.
 #[stable(feature = "rust1", since = "1.0.0")]
 #[lang="sized"]
@@ -214,6 +217,9 @@ pub unsafe trait Sync : MarkerTrait {
     // Empty
 }
 
+impl<T> !Sync for *const T { }
+impl<T> !Sync for *mut T { }
+
 /// A type which is considered "not POD", meaning that it is not
 /// implicitly copyable. This is typically embedded in other types to
 /// ensure that they are never copied, even if they lack a destructor.
diff --git a/src/librustc/middle/traits/select.rs b/src/librustc/middle/traits/select.rs
index b670c9cb1e1..53fdab1cd07 100644
--- a/src/librustc/middle/traits/select.rs
+++ b/src/librustc/middle/traits/select.rs
@@ -1377,8 +1377,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
 
                     ty::BoundSync |
                     ty::BoundSend => {
-                        // sync and send are not implemented for *const, *mut
-                        Err(Unimplemented)
+                        self.tcx().sess.bug(
+                            &format!(
+                                "raw pointers should have a negative \
+                                 impl for `Send` and `Sync`")[]);
                     }
                 }
             }