Skip to content

Commit 9a178dc

Browse files
committed
---
yaml --- r: 63634 b: refs/heads/snap-stage3 c: f8ae3cd h: refs/heads/master v: v3
1 parent 464370a commit 9a178dc

File tree

158 files changed

+2046
-3824
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+2046
-3824
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: ddd6f5928395c67b249ce3ec76a1ff4be303208d
4+
refs/heads/snap-stage3: f8ae3cdcaacb29c7b56e546a9ddab1396b615f8f
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/RELEASES.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ Version 0.7 (July 2013)
7878
* extra: `BigInt`, `BigUint` implement numeric and comparison traits.
7979
* extra: `term` uses terminfo now, is more correct.
8080
* extra: `arc` functions converted to methods.
81-
* extra: Implementation of fixed output size variations of SHA-2.
8281

8382
* Tooling
8483
* `unused_unsafe` lint mode for detecting unnecessary `unsafe` blocks.

branches/snap-stage3/src/etc/vim/syntax/rust.vim

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Language: Rust
33
" Maintainer: Patrick Walton <[email protected]>
44
" Maintainer: Ben Blum <[email protected]>
5-
" Last Change: 2012 Jun 14
5+
" Last Change: 2012 Dec 25
66

77
if version < 600
88
syntax clear
@@ -13,16 +13,13 @@ endif
1313
syn keyword rustConditional match if else
1414
syn keyword rustOperator as
1515

16-
syn match rustAssert "\<assert\(\w\)*!"
17-
syn match rustFail "\<fail\(\w\)*!"
1816
syn keyword rustKeyword break copy do drop extern
1917
syn keyword rustKeyword for if impl let log
2018
syn keyword rustKeyword copy do extern
2119
syn keyword rustKeyword for impl let log
2220
syn keyword rustKeyword loop mod once priv pub
2321
syn keyword rustKeyword return
24-
syn keyword rustKeyword unsafe while
25-
syn keyword rustKeyword use nextgroup=rustModPath skipwhite
22+
syn keyword rustKeyword unsafe use while
2623
" FIXME: Scoped impl's name is also fallen in this category
2724
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite
2825
syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite
@@ -48,8 +45,7 @@ syn keyword rustType c_longlong c_ulonglong intptr_t uintptr_t
4845
syn keyword rustType off_t dev_t ino_t pid_t mode_t ssize_t
4946

5047
syn keyword rustTrait Const Copy Send Owned Sized " inherent traits
51-
syn keyword rustTrait Clone Decodable Encodable IterBytes Rand ToStr
52-
syn keyword rustTrait Eq Ord TotalEq TotalOrd Num Ptr
48+
syn keyword rustTrait Eq Ord Num Ptr
5349
syn keyword rustTrait Drop Add Sub Mul Quot Rem Neg BitAnd BitOr
5450
syn keyword rustTrait BitXor Shl Shr Index
5551

@@ -76,21 +72,19 @@ syn keyword rustConstant STDIN_FILENO STDOUT_FILENO STDERR_FILENO
7672
" If foo::bar changes to foo.bar, change this ("::" to "\.").
7773
" If foo::bar changes to Foo::bar, change this (first "\w" to "\u").
7874
syn match rustModPath "\w\(\w\)*::[^<]"he=e-3,me=e-3
79-
syn match rustModPath "\w\(\w\)*" contained " only for 'use path;'
8075
syn match rustModPathSep "::"
8176

8277
syn match rustFuncCall "\w\(\w\)*("he=e-1,me=e-1
8378
syn match rustFuncCall "\w\(\w\)*::<"he=e-3,me=e-3 " foo::<T>();
8479

85-
syn match rustMacro '\w\(\w\)*!' contains=rustAssert,rustFail
86-
syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustFail
80+
syn match rustMacro '\w\(\w\)*!'
81+
syn match rustMacro '#\w\(\w\)*'
8782

8883
syn match rustFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn?]\|\[\^\=.[^]]*\]\)" contained
8984
syn match rustFormat display "%%" contained
9085
syn region rustString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=rustTodo,rustFormat
9186

92-
syn region rustAttribute start="#\[" end="\]" contains=rustString,rustDeriving
93-
syn region rustDeriving start="deriving(" end=")" contains=rustTrait
87+
syn region rustAttribute start="#\[" end="\]" contains=rustString
9488

9589
" Number literals
9690
syn match rustNumber display "\<[0-9][0-9_]*\>"
@@ -149,17 +143,11 @@ hi def link rustMacro Macro
149143
hi def link rustType Type
150144
hi def link rustTodo Todo
151145
hi def link rustAttribute PreProc
152-
hi def link rustDeriving PreProc
153146
hi def link rustStorage StorageClass
154147
hi def link rustLifetime Special
155148

156149
" Other Suggestions:
157-
" hi rustAttribute ctermfg=cyan
158-
" hi rustDeriving ctermfg=cyan
159-
" hi rustAssert ctermfg=yellow
160-
" hi rustFail ctermfg=red
161150
" hi rustMacro ctermfg=magenta
162-
" hi rustModPathSep ctermfg=grey
163151

164152
syn sync minlines=200
165153
syn sync maxlines=500

branches/snap-stage3/src/libextra/arena.rs

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -39,32 +39,23 @@ use core::prelude::*;
3939
use list::{MutList, MutCons, MutNil};
4040

4141
use core::at_vec;
42-
use core::cast::{transmute, transmute_mut, transmute_mut_region};
42+
use core::cast::{transmute, transmute_mut_region};
4343
use core::cast;
44-
use core::libc::size_t;
4544
use core::ptr;
46-
use core::sys::TypeDesc;
4745
use core::sys;
4846
use core::uint;
4947
use core::vec;
5048
use core::unstable::intrinsics;
49+
use core::unstable::intrinsics::{TyDesc};
5150

52-
pub mod rustrt {
53-
use core::libc::size_t;
54-
use core::sys::TypeDesc;
51+
#[cfg(not(stage0))]
52+
use core::unstable::intrinsics::{get_tydesc};
5553

56-
pub extern {
57-
#[rust_stack]
58-
unsafe fn rust_call_tydesc_glue(root: *u8,
59-
tydesc: *TypeDesc,
60-
field: size_t);
61-
}
54+
#[cfg(stage0)]
55+
unsafe fn get_tydesc<T>() -> *TyDesc {
56+
intrinsics::get_tydesc::<T>() as *TyDesc
6257
}
6358

64-
// This probably belongs somewhere else. Needs to be kept in sync with
65-
// changes to glue...
66-
static tydesc_drop_glue_index: size_t = 3 as size_t;
67-
6859
// The way arena uses arrays is really deeply awful. The arrays are
6960
// allocated, and have capacities reserved, but the fill for the array
7061
// will always stay at 0.
@@ -74,7 +65,6 @@ struct Chunk {
7465
is_pod: bool,
7566
}
7667

77-
#[mutable]
7868
pub struct Arena {
7969
// The head is separated out from the list as a unbenchmarked
8070
// microoptimization, to avoid needing to case on the list to
@@ -125,6 +115,19 @@ fn round_up_to(base: uint, align: uint) -> uint {
125115
(base + (align - 1)) & !(align - 1)
126116
}
127117

118+
#[inline]
119+
#[cfg(not(stage0))]
120+
unsafe fn call_drop_glue(tydesc: *TyDesc, data: *i8) {
121+
// This function should be inlined when stage0 is gone
122+
((*tydesc).drop_glue)(data);
123+
}
124+
125+
#[inline]
126+
#[cfg(stage0)]
127+
unsafe fn call_drop_glue(tydesc: *TyDesc, data: *i8) {
128+
((*tydesc).drop_glue)(0 as **TyDesc, data);
129+
}
130+
128131
// Walk down a chunk, running the destructors for any objects stored
129132
// in it.
130133
unsafe fn destroy_chunk(chunk: &Chunk) {
@@ -137,19 +140,18 @@ unsafe fn destroy_chunk(chunk: &Chunk) {
137140
let (tydesc, is_done) = un_bitpack_tydesc_ptr(*tydesc_data);
138141
let (size, align) = ((*tydesc).size, (*tydesc).align);
139142

140-
let after_tydesc = idx + sys::size_of::<*TypeDesc>();
143+
let after_tydesc = idx + sys::size_of::<*TyDesc>();
141144

142145
let start = round_up_to(after_tydesc, align);
143146

144147
//debug!("freeing object: idx = %u, size = %u, align = %u, done = %b",
145148
// start, size, align, is_done);
146149
if is_done {
147-
rustrt::rust_call_tydesc_glue(
148-
ptr::offset(buf, start), tydesc, tydesc_drop_glue_index);
150+
call_drop_glue(tydesc, ptr::offset(buf, start) as *i8);
149151
}
150152

151153
// Find where the next tydesc lives
152-
idx = round_up_to(start + size, sys::pref_align_of::<*TypeDesc>());
154+
idx = round_up_to(start + size, sys::pref_align_of::<*TyDesc>());
153155
}
154156
}
155157

@@ -158,12 +160,12 @@ unsafe fn destroy_chunk(chunk: &Chunk) {
158160
// is necessary in order to properly do cleanup if a failure occurs
159161
// during an initializer.
160162
#[inline]
161-
unsafe fn bitpack_tydesc_ptr(p: *TypeDesc, is_done: bool) -> uint {
163+
unsafe fn bitpack_tydesc_ptr(p: *TyDesc, is_done: bool) -> uint {
162164
let p_bits: uint = transmute(p);
163165
p_bits | (is_done as uint)
164166
}
165167
#[inline]
166-
unsafe fn un_bitpack_tydesc_ptr(p: uint) -> (*TypeDesc, bool) {
168+
unsafe fn un_bitpack_tydesc_ptr(p: uint) -> (*TyDesc, bool) {
167169
(transmute(p & !1), p & 1 == 1)
168170
}
169171

@@ -203,7 +205,7 @@ impl Arena {
203205
#[inline]
204206
fn alloc_pod<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
205207
unsafe {
206-
let tydesc = sys::get_type_desc::<T>();
208+
let tydesc = get_tydesc::<T>();
207209
let ptr = self.alloc_pod_inner((*tydesc).size, (*tydesc).align);
208210
let ptr: *mut T = transmute(ptr);
209211
intrinsics::move_val_init(&mut (*ptr), op());
@@ -231,13 +233,13 @@ impl Arena {
231233
let head = transmute_mut_region(&mut self.head);
232234

233235
let tydesc_start = head.fill;
234-
let after_tydesc = head.fill + sys::size_of::<*TypeDesc>();
236+
let after_tydesc = head.fill + sys::size_of::<*TyDesc>();
235237
let start = round_up_to(after_tydesc, align);
236238
let end = start + n_bytes;
237239
if end > at_vec::capacity(head.data) {
238240
return self.alloc_nonpod_grow(n_bytes, align);
239241
}
240-
head.fill = round_up_to(end, sys::pref_align_of::<*TypeDesc>());
242+
head.fill = round_up_to(end, sys::pref_align_of::<*TyDesc>());
241243

242244
//debug!("idx = %u, size = %u, align = %u, fill = %u",
243245
// start, n_bytes, align, head.fill);
@@ -250,7 +252,7 @@ impl Arena {
250252
#[inline]
251253
fn alloc_nonpod<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
252254
unsafe {
253-
let tydesc = sys::get_type_desc::<T>();
255+
let tydesc = get_tydesc::<T>();
254256
let (ty_ptr, ptr) =
255257
self.alloc_nonpod_inner((*tydesc).size, (*tydesc).align);
256258
let ty_ptr: *mut uint = transmute(ty_ptr);
@@ -270,22 +272,23 @@ impl Arena {
270272

271273
// The external interface
272274
#[inline]
273-
pub fn alloc<'a, T>(&'a self, op: &fn() -> T) -> &'a T {
275+
pub fn alloc<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
274276
unsafe {
275277
// XXX: Borrow check
276-
let this = transmute_mut(self);
277-
if intrinsics::needs_drop::<T>() {
278-
this.alloc_nonpod(op)
279-
} else {
280-
this.alloc_pod(op)
278+
let this = transmute_mut_region(self);
279+
if !intrinsics::needs_drop::<T>() {
280+
return this.alloc_pod(op);
281281
}
282+
// XXX: Borrow check
283+
let this = transmute_mut_region(self);
284+
this.alloc_nonpod(op)
282285
}
283286
}
284287
}
285288

286289
#[test]
287290
fn test_arena_destructors() {
288-
let arena = Arena();
291+
let mut arena = Arena();
289292
for uint::range(0, 10) |i| {
290293
// Arena allocate something with drop glue to make sure it
291294
// doesn't leak.
@@ -300,7 +303,7 @@ fn test_arena_destructors() {
300303
#[should_fail]
301304
#[ignore(cfg(windows))]
302305
fn test_arena_destructors_fail() {
303-
let arena = Arena();
306+
let mut arena = Arena();
304307
// Put some stuff in the arena.
305308
for uint::range(0, 10) |i| {
306309
// Arena allocate something with drop glue to make sure it

branches/snap-stage3/src/libextra/bitv.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,12 @@ impl BitvSet {
666666
pub fn symmetric_difference_with(&mut self, other: &BitvSet) {
667667
self.other_op(other, |w1, w2| w1 ^ w2);
668668
}
669+
}
670+
671+
impl BaseIter<uint> for BitvSet {
672+
fn size_hint(&self) -> Option<uint> { Some(self.len()) }
669673

670-
pub fn each(&self, blk: &fn(v: &uint) -> bool) -> bool {
674+
fn each(&self, blk: &fn(v: &uint) -> bool) -> bool {
671675
for self.bitv.storage.iter().enumerate().advance |(i, &w)| {
672676
if !iterate_bits(i * uint::bits, w, |b| blk(&b)) {
673677
return false;

branches/snap-stage3/src/libextra/crypto/digest.rs

Lines changed: 0 additions & 88 deletions
This file was deleted.

0 commit comments

Comments
 (0)