Add default impls for Send/Sync

This commit is contained in:
Flavio Percoco 2015-03-08 22:32:57 -04:30
parent cbc660bd1c
commit 9ae144f055
2 changed files with 5 additions and 4 deletions

View file

@ -39,6 +39,8 @@ pub unsafe trait Send : MarkerTrait {
// empty.
}
impl Send for .. { }
impl<T> !Send for *const T { }
impl<T> !Send for *mut T { }
impl !Send for Managed { }
@ -203,6 +205,8 @@ pub unsafe trait Sync : MarkerTrait {
// Empty
}
impl Sync for .. { }
impl<T> !Sync for *const T { }
impl<T> !Sync for *mut T { }
impl !Sync for Managed { }

View file

@ -5980,10 +5980,7 @@ pub fn item_variances(tcx: &ctxt, item_id: ast::DefId) -> Rc<ItemVariances> {
pub fn trait_has_default_impl(tcx: &ctxt, trait_def_id: DefId) -> bool {
populate_implementations_for_trait_if_necessary(tcx, trait_def_id);
match tcx.lang_items.to_builtin_kind(trait_def_id) {
Some(BoundSend) | Some(BoundSync) => true,
_ => tcx.traits_with_default_impls.borrow().contains_key(&trait_def_id),
}
tcx.traits_with_default_impls.borrow().contains_key(&trait_def_id)
}
/// Records a trait-to-implementation mapping.