File tree Expand file tree Collapse file tree 6 files changed +26
-5
lines changed Expand file tree Collapse file tree 6 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
5
5
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
- refs/heads/try2: 836d4b96a91cd6a36228d757004655e26e3f2c46
8
+ refs/heads/try2: 5b75e44fb01f0eda10ce8d8df92b80945d894768
9
9
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
10
10
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
11
11
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ A quick refresher on memory ordering:
41
41
42
42
*/
43
43
44
+ #![ experimental]
44
45
#![ allow( missing_doc) ]
45
46
46
47
// This is needed to prevent duplicate lang item definitions.
@@ -470,7 +471,7 @@ extern "rust-intrinsic" {
470
471
/// `TypeId` represents a globally unique identifier for a type
471
472
#[ lang="type_id" ] // This needs to be kept in lockstep with the code in trans/intrinsic.rs and
472
473
// middle/lang_items.rs
473
- #[ deriving( Eq , Hash , Show , TotalEq ) ]
474
+ #[ deriving( Eq , TotalEq ) ]
474
475
#[ cfg( not( test) ) ]
475
476
pub struct TypeId {
476
477
t : u64 ,
@@ -482,4 +483,5 @@ impl TypeId {
482
483
pub fn of < T : ' static > ( ) -> TypeId {
483
484
unsafe { type_id :: < T > ( ) }
484
485
}
486
+ pub fn hash ( & self ) -> u64 { self . t }
485
487
}
Original file line number Diff line number Diff line change 20
20
#![ no_std]
21
21
#![ feature( globs, macro_rules, managed_boxes) ]
22
22
#![ deny( missing_doc) ]
23
+
24
+ /* Core modules for ownership management */
25
+
26
+ pub mod intrinsics;
Original file line number Diff line number Diff line change @@ -499,6 +499,7 @@ use str::StrSlice;
499
499
use str;
500
500
use slice:: { Vector , ImmutableVector } ;
501
501
use slice;
502
+ use intrinsics:: TypeId ;
502
503
503
504
pub use self :: num:: radix;
504
505
pub use self :: num:: Radix ;
@@ -1241,5 +1242,11 @@ impl<T> Show for *mut T {
1241
1242
fn fmt ( & self , f : & mut Formatter ) -> Result { secret_pointer ( self , f) }
1242
1243
}
1243
1244
1245
+ impl Show for TypeId {
1246
+ fn fmt ( & self , f : & mut Formatter ) -> Result {
1247
+ write ! ( f. buf, "TypeId \\ { {} \\ }" , self . hash( ) )
1248
+ }
1249
+ }
1250
+
1244
1251
// If you expected tests to be here, look instead at the run-pass/ifmt.rs test,
1245
1252
// it's a lot easier than creating all of the rt::Piece structures here.
Original file line number Diff line number Diff line change 64
64
#![ allow( unused_must_use) ]
65
65
66
66
use container:: Container ;
67
+ use intrinsics:: TypeId ;
67
68
use io:: Writer ;
68
69
use iter:: Iterator ;
69
70
use option:: { Option , Some , None } ;
@@ -284,6 +285,13 @@ impl<S: Writer, T> Hash<S> for *mut T {
284
285
}
285
286
}
286
287
288
+ impl < S : Writer > Hash < S > for TypeId {
289
+ #[ inline]
290
+ fn hash ( & self , state : & mut S ) {
291
+ self . hash ( ) . hash ( state)
292
+ }
293
+ }
294
+
287
295
//////////////////////////////////////////////////////////////////////////////
288
296
289
297
#[ cfg( test) ]
Original file line number Diff line number Diff line change 122
122
// Make and rand accessible for benchmarking/testcases
123
123
#[ cfg( test) ] extern crate rand;
124
124
125
- // we wrap some libc stuff
126
125
extern crate libc;
126
+ extern crate core;
127
127
128
128
// Make std testable by not duplicating lang items. See #2912
129
129
#[ cfg( test) ] extern crate realstd = "std" ;
@@ -133,6 +133,8 @@ extern crate libc;
133
133
#[ cfg( test) ] pub use ty = realstd:: ty;
134
134
#[ cfg( test) ] pub use owned = realstd:: owned;
135
135
136
+ pub use core:: intrinsics;
137
+
136
138
// Run tests with libgreen instead of libnative.
137
139
//
138
140
// FIXME: This egregiously hacks around starting the test runner in a different
@@ -255,8 +257,6 @@ pub mod reflect;
255
257
#[ unstable]
256
258
pub mod unstable;
257
259
#[ experimental]
258
- pub mod intrinsics;
259
- #[ experimental]
260
260
pub mod raw;
261
261
262
262
/* For internal use, not exported */
You can’t perform that action at this time.
0 commit comments