Add negative impls for *const T and *mut T
This commit is contained in:
@@ -68,6 +68,7 @@
|
|||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
#![feature(unboxed_closures)]
|
#![feature(unboxed_closures)]
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
|
#![feature(optin_builtin_traits)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod macros;
|
mod macros;
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ pub unsafe trait Send : MarkerTrait {
|
|||||||
// empty.
|
// empty.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T> !Send for *const T { }
|
||||||
|
impl<T> !Send for *mut T { }
|
||||||
|
|
||||||
/// Types with a constant size known at compile-time.
|
/// Types with a constant size known at compile-time.
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[lang="sized"]
|
#[lang="sized"]
|
||||||
@@ -214,6 +217,9 @@ pub unsafe trait Sync : MarkerTrait {
|
|||||||
// Empty
|
// 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
|
/// A type which is considered "not POD", meaning that it is not
|
||||||
/// implicitly copyable. This is typically embedded in other types to
|
/// implicitly copyable. This is typically embedded in other types to
|
||||||
/// ensure that they are never copied, even if they lack a destructor.
|
/// ensure that they are never copied, even if they lack a destructor.
|
||||||
|
|||||||
@@ -1377,8 +1377,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
|
|
||||||
ty::BoundSync |
|
ty::BoundSync |
|
||||||
ty::BoundSend => {
|
ty::BoundSend => {
|
||||||
// sync and send are not implemented for *const, *mut
|
self.tcx().sess.bug(
|
||||||
Err(Unimplemented)
|
&format!(
|
||||||
|
"raw pointers should have a negative \
|
||||||
|
impl for `Send` and `Sync`")[]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user