Skip to content

Commit d9f5eab

Browse files
committed
---
yaml --- r: 151927 b: refs/heads/try2 c: e5d8831 h: refs/heads/master i: 151925: 5d2557f 151923: 2c17a1f 151919: 7edd11c v: v3
1 parent 3a4965c commit d9f5eab

File tree

33 files changed

+116
-528
lines changed

33 files changed

+116
-528
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 9ac9148bbddcaeaf6c1b6b8f2e8bae75b038f234
8+
refs/heads/try2: e5d883101c27ab7c7a232337ffebaa85edc9d64f
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/guide-ffi.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ are:
493493
* `rust-intrinsic`
494494
* `system`
495495
* `C`
496+
* `win64`
496497

497498
Most of the abis in this list are self-explanatory, but the `system` abi may
498499
seem a little odd. This constraint selects whatever the appropriate ABI is for

branches/try2/src/etc/vim/syntax/rust.vim

Lines changed: 25 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,30 @@ syn keyword rustOperator as
1818

1919
syn match rustAssert "\<assert\(\w\)*!" contained
2020
syn match rustFail "\<fail\(\w\)*!" contained
21-
syn keyword rustKeyword break
22-
syn keyword rustKeyword box nextgroup=rustBoxPlacement skipwhite skipempty
23-
syn keyword rustKeyword continue
24-
syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite skipempty
25-
syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite skipempty
21+
syn keyword rustKeyword break box continue
22+
syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite
2623
syn keyword rustKeyword for in if impl let
27-
syn keyword rustKeyword loop once proc pub
28-
syn keyword rustKeyword return super
29-
syn keyword rustKeyword unsafe virtual while
30-
syn keyword rustKeyword use nextgroup=rustModPath skipwhite skipempty
24+
syn keyword rustKeyword loop once priv pub
25+
syn keyword rustKeyword return
26+
syn keyword rustKeyword unsafe while
27+
syn keyword rustKeyword use nextgroup=rustModPath skipwhite
3128
" FIXME: Scoped impl's name is also fallen in this category
32-
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite skipempty
29+
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite
30+
syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite
31+
syn keyword rustKeyword proc
3332
syn keyword rustStorage mut ref static
3433
syn keyword rustObsoleteStorage const
3534

3635
syn keyword rustInvalidBareKeyword crate
3736

38-
syn keyword rustExternCrate crate contained nextgroup=rustIdentifier skipwhite skipempty
39-
syn keyword rustObsoleteExternMod mod contained nextgroup=rustIdentifier skipwhite skipempty
37+
syn keyword rustExternCrate crate contained nextgroup=rustIdentifier skipwhite
38+
syn keyword rustObsoleteExternMod mod contained nextgroup=rustIdentifier skipwhite
4039

4140
syn match rustIdentifier contains=rustIdentifierPrime "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
4241
syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
4342

44-
syn region rustBoxPlacement matchgroup=rustBoxPlacementParens start="(" end=")" contains=TOP contained
45-
syn keyword rustBoxPlacementExpr GC containedin=rustBoxPlacement
46-
" Ideally we'd have syntax rules set up to match arbitrary expressions. Since
47-
" we don't, we'll just define temporary contained rules to handle balancing
48-
" delimiters.
49-
syn region rustBoxPlacementBalance start="(" end=")" containedin=rustBoxPlacement transparent
50-
syn region rustBoxPlacementBalance start="\[" end="\]" containedin=rustBoxPlacement transparent
51-
" {} are handled by rustFoldBraces
52-
5343
" Reserved (but not yet used) keywords {{{2
54-
syn keyword rustReservedKeyword alignof be do offsetof priv pure sizeof typeof unsized yield
44+
syn keyword rustReservedKeyword alignof be do offsetof pure sizeof typeof yield
5545

5646
" Built-in types {{{2
5747
syn keyword rustType int uint float char bool u8 u16 u32 u64 f32
@@ -62,10 +52,10 @@ syn keyword rustType f64 i8 i16 i32 i64 str Self
6252
" to make it easy to update.
6353

6454
" Core operators {{{3
65-
syn keyword rustTrait Copy Send Sized Share
55+
syn keyword rustTrait Share Copy Send Sized
6656
syn keyword rustTrait Add Sub Mul Div Rem Neg Not
6757
syn keyword rustTrait BitAnd BitOr BitXor
68-
syn keyword rustTrait Drop Deref DerefMut
58+
syn keyword rustTrait Drop
6959
syn keyword rustTrait Shl Shr Index
7060
syn keyword rustEnum Option
7161
syn keyword rustEnumVariant Some None
@@ -78,6 +68,7 @@ syn keyword rustEnumVariant Ok Err
7868
"syn keyword rustFunction drop
7969

8070
" Types and traits {{{3
71+
syn keyword rustTrait Any AnyOwnExt AnyRefExt AnyMutRefExt
8172
syn keyword rustTrait Ascii AsciiCast OwnedAsciiCast AsciiStr IntoBytes
8273
syn keyword rustTrait ToCStr
8374
syn keyword rustTrait Char
@@ -89,31 +80,24 @@ syn keyword rustTrait FromIterator Extendable
8980
syn keyword rustTrait Iterator DoubleEndedIterator RandomAccessIterator CloneableIterator
9081
syn keyword rustTrait OrdIterator MutableDoubleEndedIterator ExactSize
9182
syn keyword rustTrait Num NumCast CheckedAdd CheckedSub CheckedMul
92-
syn keyword rustTrait Signed Unsigned
93-
syn keyword rustTrait Primitive Int Float FloatMath ToPrimitive FromPrimitive
94-
"syn keyword rustTrait Expect
95-
syn keyword rustTrait Box
83+
syn keyword rustTrait Signed Unsigned Round
84+
syn keyword rustTrait Primitive Int Float ToPrimitive FromPrimitive
9685
syn keyword rustTrait GenericPath Path PosixPath WindowsPath
9786
syn keyword rustTrait RawPtr
9887
syn keyword rustTrait Buffer Writer Reader Seek
99-
syn keyword rustTrait Str StrVector StrSlice OwnedStr IntoMaybeOwned
100-
syn keyword rustTrait StrAllocating
88+
syn keyword rustTrait Str StrVector StrSlice OwnedStr IntoMaybeOwned StrBuf
10189
syn keyword rustTrait ToStr IntoStr
10290
syn keyword rustTrait Tuple1 Tuple2 Tuple3 Tuple4
10391
syn keyword rustTrait Tuple5 Tuple6 Tuple7 Tuple8
10492
syn keyword rustTrait Tuple9 Tuple10 Tuple11 Tuple12
105-
syn keyword rustTrait CloneableVector ImmutableCloneableVector MutableCloneableVector
106-
syn keyword rustTrait ImmutableVector MutableVector
107-
syn keyword rustTrait ImmutableEqVector ImmutableTotalOrdVector MutableTotalOrdVector
108-
syn keyword rustTrait Vector VectorVector OwnedVector MutableVectorAllocating
109-
syn keyword rustTrait StrBuf
110-
syn keyword rustTrait Vec
111-
112-
"syn keyword rustFunction sync_channel channel
113-
syn keyword rustTrait SyncSender Sender Receiver
114-
"syn keyword rustFunction spawn
93+
syn keyword rustTrait ImmutableEqVector ImmutableTotalOrdVector ImmutableCloneableVector
94+
syn keyword rustTrait OwnedVector OwnedCloneableVector OwnedEqVector
95+
syn keyword rustTrait MutableVector MutableTotalOrdVector
96+
syn keyword rustTrait Vector VectorVector CloneableVector ImmutableVector
11597

116-
"syn keyword rustConstant GC
98+
"syn keyword rustFunction stream
99+
syn keyword rustTrait Sender Receiver
100+
"syn keyword rustFunction spawn
117101

118102
syn keyword rustSelf self
119103
syn keyword rustBoolean true false
@@ -255,8 +239,6 @@ hi def link rustLifetime Special
255239
hi def link rustInvalidBareKeyword Error
256240
hi def link rustExternCrate rustKeyword
257241
hi def link rustObsoleteExternMod Error
258-
hi def link rustBoxPlacementParens Delimiter
259-
hi def link rustBoxPlacementExpr rustKeyword
260242

261243
" Other Suggestions:
262244
" hi rustAttribute ctermfg=cyan

branches/try2/src/liballoc/heap.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
// FIXME: #13994: port to the sized deallocation API when available
12-
// FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias` and `nonnull`
12+
// FIXME: #13996: need a way to mark the `allocate` and `reallocate` return values as `noalias`
1313

1414
use core::intrinsics::{abort, cttz32};
1515
use core::option::{None, Option};
@@ -119,8 +119,14 @@ pub fn stats_print() {
119119
/// The allocator for unique pointers.
120120
#[cfg(not(test))]
121121
#[lang="exchange_malloc"]
122+
#[inline(always)]
123+
pub unsafe fn exchange_malloc_(size: uint, align: uint) -> *mut u8 {
124+
exchange_malloc(size, align)
125+
}
126+
127+
/// The allocator for unique pointers.
122128
#[inline]
123-
unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
129+
pub unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
124130
// The compiler never calls `exchange_free` on ~ZeroSizeType, so zero-size
125131
// allocations can point to this `static`. It would be incorrect to use a null
126132
// pointer, due to enums assuming types like unique pointers are never null.
@@ -133,20 +139,14 @@ unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
133139
}
134140
}
135141

136-
#[cfg(not(test), stage0)]
142+
#[cfg(not(test))]
137143
#[lang="exchange_free"]
138144
#[inline]
145+
// FIXME: #13994 (rustc should pass align and size here)
139146
unsafe fn exchange_free(ptr: *mut u8) {
140147
deallocate(ptr, 0, 8);
141148
}
142149

143-
#[cfg(not(test), not(stage0))]
144-
#[lang="exchange_free"]
145-
#[inline]
146-
unsafe fn exchange_free(ptr: *mut u8, size: uint, align: uint) {
147-
deallocate(ptr, size, align);
148-
}
149-
150150
// FIXME: #7496
151151
#[cfg(not(test))]
152152
#[lang="closure_exchange_malloc"]
@@ -167,16 +167,16 @@ unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint, align: uin
167167
#[doc(hidden)]
168168
#[deprecated]
169169
#[cfg(not(test))]
170-
pub unsafe extern "C" fn rust_allocate(size: uint, align: uint) -> *mut u8 {
171-
allocate(size, align)
170+
pub unsafe extern "C" fn rust_malloc(size: uint, align: uint) -> *mut u8 {
171+
exchange_malloc(size, align)
172172
}
173173

174174
// hack for libcore
175175
#[no_mangle]
176176
#[doc(hidden)]
177177
#[deprecated]
178178
#[cfg(not(test))]
179-
pub unsafe extern "C" fn rust_deallocate(ptr: *mut u8, size: uint, align: uint) {
179+
pub unsafe extern "C" fn rust_free(ptr: *mut u8, size: uint, align: uint) {
180180
deallocate(ptr, size, align)
181181
}
182182

branches/try2/src/libarena/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use std::mem;
3838
use std::num;
3939
use std::ptr::read;
4040
use std::rc::Rc;
41-
use std::rt::heap::allocate;
41+
use std::rt::heap::exchange_malloc;
4242

4343
// The way arena uses arrays is really deeply awful. The arrays are
4444
// allocated, and have capacities reserved, but the fill for the array
@@ -358,7 +358,8 @@ impl<T> TypedArenaChunk<T> {
358358
size = size.checked_add(&elems_size).unwrap();
359359

360360
let mut chunk = unsafe {
361-
let chunk = allocate(size, mem::min_align_of::<TypedArenaChunk<T>>());
361+
let chunk = exchange_malloc(size,
362+
mem::min_align_of::<TypedArenaChunk<T>>());
362363
let mut chunk: Box<TypedArenaChunk<T>> = mem::transmute(chunk);
363364
mem::overwrite(&mut chunk.next, next);
364365
chunk

branches/try2/src/libcore/should_not_exist.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ use str::StrSlice;
4444

4545
#[allow(ctypes)]
4646
extern {
47-
fn rust_allocate(size: uint, align: uint) -> *u8;
48-
fn rust_deallocate(ptr: *u8, size: uint, align: uint);
47+
fn rust_malloc(size: uint, align: uint) -> *u8;
48+
fn rust_free(ptr: *u8, size: uint, align: uint);
4949
}
5050

5151
unsafe fn alloc(cap: uint) -> *mut Vec<()> {
5252
let cap = cap.checked_add(&mem::size_of::<Vec<()>>()).unwrap();
5353
// this should use the real alignment, but the new representation will take care of that
54-
let ret = rust_allocate(cap, 8) as *mut Vec<()>;
54+
let ret = rust_malloc(cap, 8) as *mut Vec<()>;
5555
if ret.is_null() {
5656
intrinsics::abort();
5757
}
@@ -119,7 +119,7 @@ impl FromIterator<char> for ~str {
119119
&(*ptr).data,
120120
len);
121121
// FIXME: #13994: port to the sized deallocation API when available
122-
rust_deallocate(ptr as *u8, 0, 8);
122+
rust_free(ptr as *u8, 0, 8);
123123
mem::forget(ret);
124124
ret = mem::transmute(ptr2);
125125
ptr = ptr2;
@@ -191,7 +191,7 @@ impl<A: Clone> Clone for ~[A] {
191191
for j in range(0, *i as int) {
192192
ptr::read(&*p.offset(j));
193193
}
194-
rust_deallocate(ret as *u8, 0, 8);
194+
rust_free(ret as *u8, 0, 8);
195195
});
196196
mem::transmute(ret)
197197
}

branches/try2/src/libcore/str.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,9 +1112,6 @@ pub trait StrSlice<'a> {
11121112
///
11131113
/// let v: Vec<&str> = "lionXXtigerXleopard".split('X').collect();
11141114
/// assert_eq!(v, vec!["lion", "", "tiger", "leopard"]);
1115-
///
1116-
/// let v: Vec<&str> = "".split('X').collect();
1117-
/// assert_eq!(v, vec![""]);
11181115
/// ```
11191116
fn split<Sep: CharEq>(&self, sep: Sep) -> CharSplits<'a, Sep>;
11201117

@@ -1133,12 +1130,6 @@ pub trait StrSlice<'a> {
11331130
///
11341131
/// let v: Vec<&str> = "lionXXtigerXleopard".splitn('X', 2).collect();
11351132
/// assert_eq!(v, vec!["lion", "", "tigerXleopard"]);
1136-
///
1137-
/// let v: Vec<&str> = "abcXdef".splitn('X', 0).collect();
1138-
/// assert_eq!(v, vec!["abcXdef"]);
1139-
///
1140-
/// let v: Vec<&str> = "".splitn('X', 1).collect();
1141-
/// assert_eq!(v, vec![""]);
11421133
/// ```
11431134
fn splitn<Sep: CharEq>(&self, sep: Sep, count: uint) -> CharSplitsN<'a, Sep>;
11441135

branches/try2/src/librustc/middle/check_match.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ fn is_useful(cx: &MatchCheckCtxt, m: &matrix, v: &[@Pat]) -> useful {
247247
_ => *r.get(0)
248248
}
249249
}
250-
None if v.len() == 0 => return not_useful,
251250
None => v[0]
252251
};
253252
let left_ty = if real_pat.id == 0 { ty::mk_nil() }
@@ -342,10 +341,8 @@ fn is_useful_specialized(cx: &MatchCheckCtxt,
342341
let ms = m.iter().filter_map(|r| {
343342
specialize(cx, r.as_slice(), &ctor, arity, lty)
344343
}).collect::<matrix>();
345-
let could_be_useful = match specialize(cx, v, &ctor, arity, lty) {
346-
Some(v) => is_useful(cx, &ms, v.as_slice()),
347-
None => return not_useful,
348-
};
344+
let could_be_useful = is_useful(
345+
cx, &ms, specialize(cx, v, &ctor, arity, lty).unwrap().as_slice());
349346
match could_be_useful {
350347
useful_ => useful(lty, ctor),
351348
u => u,

branches/try2/src/librustc/middle/resolve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2040,7 +2040,7 @@ impl<'a> Resolver<'a> {
20402040
return;
20412041
}
20422042

2043-
let imports = module.imports.borrow();
2043+
let mut imports = module.imports.borrow_mut();
20442044
let import_count = imports.len();
20452045
while module.resolved_import_count.get() < import_count {
20462046
let import_index = module.resolved_import_count.get();

branches/try2/src/librustc/middle/trans/cleanup.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,13 @@ impl<'a> CleanupMethods<'a> for FunctionContext<'a> {
278278
fn schedule_free_value(&self,
279279
cleanup_scope: ScopeId,
280280
val: ValueRef,
281-
heap: Heap,
282-
content_ty: ty::t) {
281+
heap: Heap) {
283282
/*!
284283
* Schedules a call to `free(val)`. Note that this is a shallow
285284
* operation.
286285
*/
287286

288-
let drop = box FreeValue { ptr: val, heap: heap, content_ty: content_ty };
287+
let drop = box FreeValue { ptr: val, heap: heap };
289288

290289
debug!("schedule_free_value({:?}, val={}, heap={:?})",
291290
cleanup_scope,
@@ -848,7 +847,6 @@ pub enum Heap {
848847
pub struct FreeValue {
849848
ptr: ValueRef,
850849
heap: Heap,
851-
content_ty: ty::t
852850
}
853851

854852
impl Cleanup for FreeValue {
@@ -862,7 +860,7 @@ impl Cleanup for FreeValue {
862860
glue::trans_free(bcx, self.ptr)
863861
}
864862
HeapExchange => {
865-
glue::trans_exchange_free_ty(bcx, self.ptr, self.content_ty)
863+
glue::trans_exchange_free(bcx, self.ptr)
866864
}
867865
}
868866
}
@@ -933,8 +931,7 @@ pub trait CleanupMethods<'a> {
933931
fn schedule_free_value(&self,
934932
cleanup_scope: ScopeId,
935933
val: ValueRef,
936-
heap: Heap,
937-
content_ty: ty::t);
934+
heap: Heap);
938935
fn schedule_clean(&self,
939936
cleanup_scope: ScopeId,
940937
cleanup: Box<Cleanup>);

branches/try2/src/librustc/middle/trans/expr.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,7 +1183,7 @@ fn trans_uniq_expr<'a>(bcx: &'a Block<'a>,
11831183
} else {
11841184
let custom_cleanup_scope = fcx.push_custom_cleanup_scope();
11851185
fcx.schedule_free_value(cleanup::CustomScope(custom_cleanup_scope),
1186-
val, cleanup::HeapExchange, contents_ty);
1186+
val, cleanup::HeapExchange);
11871187
let bcx = trans_into(bcx, contents, SaveIn(val));
11881188
fcx.pop_custom_cleanup_scope(custom_cleanup_scope);
11891189
bcx
@@ -1205,7 +1205,7 @@ fn trans_managed_expr<'a>(bcx: &'a Block<'a>,
12051205

12061206
let custom_cleanup_scope = fcx.push_custom_cleanup_scope();
12071207
fcx.schedule_free_value(cleanup::CustomScope(custom_cleanup_scope),
1208-
bx, cleanup::HeapManaged, contents_ty);
1208+
bx, cleanup::HeapManaged);
12091209
let bcx = trans_into(bcx, contents, SaveIn(body));
12101210
fcx.pop_custom_cleanup_scope(custom_cleanup_scope);
12111211
immediate_rvalue_bcx(bcx, bx, box_ty).to_expr_datumblock()
@@ -1789,14 +1789,13 @@ fn deref_once<'a>(bcx: &'a Block<'a>,
17891789
let scope = cleanup::temporary_scope(bcx.tcx(), expr.id);
17901790
let ptr = Load(bcx, datum.val);
17911791
if !type_is_zero_size(bcx.ccx(), content_ty) {
1792-
bcx.fcx.schedule_free_value(scope, ptr, cleanup::HeapExchange, content_ty);
1792+
bcx.fcx.schedule_free_value(scope, ptr, cleanup::HeapExchange);
17931793
}
17941794
}
17951795
RvalueExpr(Rvalue { mode: ByValue }) => {
17961796
let scope = cleanup::temporary_scope(bcx.tcx(), expr.id);
17971797
if !type_is_zero_size(bcx.ccx(), content_ty) {
1798-
bcx.fcx.schedule_free_value(scope, datum.val, cleanup::HeapExchange,
1799-
content_ty);
1798+
bcx.fcx.schedule_free_value(scope, datum.val, cleanup::HeapExchange);
18001799
}
18011800
}
18021801
LvalueExpr => { }

0 commit comments

Comments
 (0)