Skip to content

Commit 6fa913a

Browse files
committed
---
yaml --- r: 75751 b: refs/heads/master c: 369f7fa h: refs/heads/master i: 75749: 85aaea0 75747: d71d61d 75743: 5ba28a0 v: v3
1 parent fd6d8ce commit 6fa913a

File tree

11 files changed

+341
-387
lines changed

11 files changed

+341
-387
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 67c954e365970e4c2cd06f0c50724656d7010f45
2+
refs/heads/master: 369f7fa169d9f97ac8185105201182781076a90d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 67c954e365970e4c2cd06f0c50724656d7010f45
55
refs/heads/try: 10089455287dcc3652b984ab4bfd6971e1b5f302

trunk/src/librustc/middle/lang_items.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ impl LanguageItems {
158158
}
159159
}
160160

161+
pub fn is_builtin_kind(&self, id: def_id) -> bool {
162+
Some(id) == self.freeze_trait() ||
163+
Some(id) == self.send_trait() ||
164+
Some(id) == self.sized_trait()
165+
}
166+
161167
pub fn freeze_trait(&self) -> Option<def_id> {
162168
self.items[FreezeTraitLangItem as uint]
163169
}

trunk/src/librustc/middle/ty.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3725,6 +3725,12 @@ pub fn impl_trait_ref(cx: ctxt, id: ast::def_id) -> Option<@TraitRef> {
37253725
return ret;
37263726
}
37273727

3728+
pub fn trait_ref_is_builtin_kind(tcx: ctxt, tr: &ast::trait_ref) -> bool {
3729+
let def = tcx.def_map.find(&tr.ref_id).expect("no def-map entry for trait");
3730+
let def_id = ast_util::def_id_of_def(*def);
3731+
tcx.lang_items.is_builtin_kind(def_id)
3732+
}
3733+
37283734
pub fn ty_to_def_id(ty: t) -> Option<ast::def_id> {
37293735
match get(ty).sty {
37303736
ty_trait(id, _, _, _, _) | ty_struct(id, _) | ty_enum(id, _) => Some(id),

trunk/src/librustc/middle/typeck/collect.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,13 @@ pub fn convert(ccx: &CrateCtxt, it: &ast::item) {
869869
&i_ty_generics, generics,
870870
parent_visibility);
871871
for t in opt_trait_ref.iter() {
872+
// Prevent the builtin kind traits from being manually implemented.
873+
if ty::trait_ref_is_builtin_kind(ccx.tcx, t) {
874+
ccx.tcx.sess.span_err(it.span,
875+
"cannot provide an explicit implementation \
876+
for a builtin kind");
877+
}
878+
872879
check_methods_against_trait(ccx, generics, rp, selfty, t, cms);
873880
}
874881
}

trunk/src/libstd/rt/rtio.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,22 @@ pub type RtioTcpStreamObject = uvio::UvTcpStream;
2424
pub type RtioTcpListenerObject = uvio::UvTcpListener;
2525
pub type RtioUdpSocketObject = uvio::UvUdpSocket;
2626
pub type RtioTimerObject = uvio::UvTimer;
27-
pub type PausibleIdleCallback = uvio::UvPausibleIdleCallback;
2827

2928
pub trait EventLoop {
3029
fn run(&mut self);
3130
fn callback(&mut self, ~fn());
32-
fn pausible_idle_callback(&mut self) -> ~PausibleIdleCallback;
3331
fn callback_ms(&mut self, ms: u64, ~fn());
3432
fn remote_callback(&mut self, ~fn()) -> ~RemoteCallbackObject;
3533
/// The asynchronous I/O services. Not all event loops may provide one
3634
fn io<'a>(&'a mut self) -> Option<&'a mut IoFactoryObject>;
3735
}
3836

3937
pub trait RemoteCallback {
40-
/// Trigger the remote callback. Note that the number of times the
41-
/// callback is run is not guaranteed. All that is guaranteed is
42-
/// that, after calling 'fire', the callback will be called at
43-
/// least once, but multiple callbacks may be coalesced and
44-
/// callbacks may be called more often requested. Destruction also
45-
/// triggers the callback.
38+
/// Trigger the remote callback. Note that the number of times the callback
39+
/// is run is not guaranteed. All that is guaranteed is that, after calling 'fire',
40+
/// the callback will be called at least once, but multiple callbacks may be coalesced
41+
/// and callbacks may be called more often requested. Destruction also triggers the
42+
/// callback.
4643
fn fire(&mut self);
4744
}
4845

0 commit comments

Comments
 (0)