File tree Expand file tree Collapse file tree 3 files changed +5
-17
lines changed
branches/dist-snap/src/libcore Expand file tree Collapse file tree 3 files changed +5
-17
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9
9
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10
- refs/heads/dist-snap: b2aeb314519f69bc949327123d2f6ec4dcd0b9ec
10
+ refs/heads/dist-snap: c87e9a5815ba4084ca2419eb39786b9bf6d45319
11
11
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
12
12
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -52,14 +52,8 @@ pure fn capacity<T>(&&v: @[const T]) -> uint {
52
52
#[ inline( always) ]
53
53
pure fn build_sized < A > ( size : uint , builder : fn ( push : pure fn( +A ) ) ) -> @[ A ] {
54
54
let mut vec = @[ ] ;
55
- unsafe {
56
- unsafe :: reserve ( vec, size) ;
57
- // This is an awful hack to be able to make the push function
58
- // pure. Is there a better way?
59
- :: unsafe:: reinterpret_cast ::
60
- < fn ( push : pure fn( +A ) ) , fn ( push : fn ( +A ) ) >
61
- ( builder) ( |+x| unsafe :: push ( vec, x) ) ;
62
- }
55
+ unsafe { unsafe :: reserve ( vec, size) ; }
56
+ builder ( |+x| unsafe { unsafe :: push ( vec, x) } ) ;
63
57
return vec;
64
58
}
65
59
Original file line number Diff line number Diff line change @@ -234,14 +234,8 @@ pure fn from_slice<T: copy>(t: &[T]) -> ~[T] {
234
234
#[ inline( always) ]
235
235
pure fn build_sized < A > ( size : uint , builder : fn ( push : pure fn( +A ) ) ) -> ~[ A ] {
236
236
let mut vec = ~[ ] ;
237
- unsafe {
238
- reserve ( vec, size) ;
239
- // This is an awful hack to be able to make the push function
240
- // pure. Is there a better way?
241
- :: unsafe:: reinterpret_cast ::
242
- < fn ( push : pure fn( +A ) ) , fn ( push : fn ( +A ) ) >
243
- ( builder) ( |+x| push ( vec, x) ) ;
244
- }
237
+ unchecked { reserve( vec, size) ; }
238
+ builder ( |+x| unchecked { push( vec, x) } ) ;
245
239
return vec;
246
240
}
247
241
You can’t perform that action at this time.
0 commit comments