File tree Expand file tree Collapse file tree 3 files changed +5
-17
lines changed Expand file tree Collapse file tree 3 files changed +5
-17
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: b2aeb314519f69bc949327123d2f6ec4dcd0b9ec
2
+ refs/heads/master: c87e9a5815ba4084ca2419eb39786b9bf6d45319
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5
5
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
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