提交 9ae144f0 编写于 作者: F Flavio Percoco

Add default impls for Send/Sync

上级 cbc660bd
......@@ -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 { }
......
......@@ -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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册