Skip to content

Commit a8849c0

Browse files
committed
---
yaml --- r: 66171 b: refs/heads/master c: fcf3617 h: refs/heads/master i: 66169: 9259b6f 66167: 3dbe7f6 v: v3
1 parent 63a2628 commit a8849c0

40 files changed

+703
-582
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: ce888a505524937ca9aa91370e204bb28fe6ef7f
2+
refs/heads/master: fcf361745fa2dd2931595265a9f2e8837c2b0fb8
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/src/etc/vim/syntax/rust.vim

Lines changed: 18 additions & 6 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 Dec 25
5+
" Last Change: 2012 Jun 14
66

77
if version < 600
88
syntax clear
@@ -13,13 +13,16 @@ 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\)*!"
1618
syn keyword rustKeyword break copy do drop extern
1719
syn keyword rustKeyword for if impl let log
1820
syn keyword rustKeyword copy do extern
1921
syn keyword rustKeyword for impl let log
2022
syn keyword rustKeyword loop mod once priv pub
2123
syn keyword rustKeyword return
22-
syn keyword rustKeyword unsafe use while
24+
syn keyword rustKeyword unsafe while
25+
syn keyword rustKeyword use nextgroup=rustModPath skipwhite
2326
" FIXME: Scoped impl's name is also fallen in this category
2427
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite
2528
syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite
@@ -45,7 +48,8 @@ syn keyword rustType c_longlong c_ulonglong intptr_t uintptr_t
4548
syn keyword rustType off_t dev_t ino_t pid_t mode_t ssize_t
4649

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

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

7782
syn match rustFuncCall "\w\(\w\)*("he=e-1,me=e-1
7883
syn match rustFuncCall "\w\(\w\)*::<"he=e-3,me=e-3 " foo::<T>();
7984

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

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

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

8995
" Number literals
9096
syn match rustNumber display "\<[0-9][0-9_]*\>"
@@ -143,11 +149,17 @@ hi def link rustMacro Macro
143149
hi def link rustType Type
144150
hi def link rustTodo Todo
145151
hi def link rustAttribute PreProc
152+
hi def link rustDeriving PreProc
146153
hi def link rustStorage StorageClass
147154
hi def link rustLifetime Special
148155

149156
" Other Suggestions:
157+
" hi rustAttribute ctermfg=cyan
158+
" hi rustDeriving ctermfg=cyan
159+
" hi rustAssert ctermfg=yellow
160+
" hi rustFail ctermfg=red
150161
" hi rustMacro ctermfg=magenta
162+
" hi rustModPathSep ctermfg=grey
151163

152164
syn sync minlines=200
153165
syn sync maxlines=500

trunk/src/libextra/arena.rs

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,30 @@ use list::{MutList, MutCons, MutNil};
4141
use core::at_vec;
4242
use core::cast::{transmute, transmute_mut_region};
4343
use core::cast;
44+
use core::libc::size_t;
4445
use core::ptr;
46+
use core::sys::TypeDesc;
4547
use core::sys;
4648
use core::uint;
4749
use core::vec;
4850
use core::unstable::intrinsics;
49-
use core::unstable::intrinsics::{TyDesc};
5051

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

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

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+
5968
// The way arena uses arrays is really deeply awful. The arrays are
6069
// allocated, and have capacities reserved, but the fill for the array
6170
// will always stay at 0.
@@ -115,19 +124,6 @@ fn round_up_to(base: uint, align: uint) -> uint {
115124
(base + (align - 1)) & !(align - 1)
116125
}
117126

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-
131127
// Walk down a chunk, running the destructors for any objects stored
132128
// in it.
133129
unsafe fn destroy_chunk(chunk: &Chunk) {
@@ -140,18 +136,19 @@ unsafe fn destroy_chunk(chunk: &Chunk) {
140136
let (tydesc, is_done) = un_bitpack_tydesc_ptr(*tydesc_data);
141137
let (size, align) = ((*tydesc).size, (*tydesc).align);
142138

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

145141
let start = round_up_to(after_tydesc, align);
146142

147143
//debug!("freeing object: idx = %u, size = %u, align = %u, done = %b",
148144
// start, size, align, is_done);
149145
if is_done {
150-
call_drop_glue(tydesc, ptr::offset(buf, start) as *i8);
146+
rustrt::rust_call_tydesc_glue(
147+
ptr::offset(buf, start), tydesc, tydesc_drop_glue_index);
151148
}
152149

153150
// Find where the next tydesc lives
154-
idx = round_up_to(start + size, sys::pref_align_of::<*TyDesc>());
151+
idx = round_up_to(start + size, sys::pref_align_of::<*TypeDesc>());
155152
}
156153
}
157154

@@ -160,12 +157,12 @@ unsafe fn destroy_chunk(chunk: &Chunk) {
160157
// is necessary in order to properly do cleanup if a failure occurs
161158
// during an initializer.
162159
#[inline]
163-
unsafe fn bitpack_tydesc_ptr(p: *TyDesc, is_done: bool) -> uint {
160+
unsafe fn bitpack_tydesc_ptr(p: *TypeDesc, is_done: bool) -> uint {
164161
let p_bits: uint = transmute(p);
165162
p_bits | (is_done as uint)
166163
}
167164
#[inline]
168-
unsafe fn un_bitpack_tydesc_ptr(p: uint) -> (*TyDesc, bool) {
165+
unsafe fn un_bitpack_tydesc_ptr(p: uint) -> (*TypeDesc, bool) {
169166
(transmute(p & !1), p & 1 == 1)
170167
}
171168

@@ -205,7 +202,7 @@ impl Arena {
205202
#[inline]
206203
fn alloc_pod<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
207204
unsafe {
208-
let tydesc = get_tydesc::<T>();
205+
let tydesc = sys::get_type_desc::<T>();
209206
let ptr = self.alloc_pod_inner((*tydesc).size, (*tydesc).align);
210207
let ptr: *mut T = transmute(ptr);
211208
intrinsics::move_val_init(&mut (*ptr), op());
@@ -233,13 +230,13 @@ impl Arena {
233230
let head = transmute_mut_region(&mut self.head);
234231

235232
let tydesc_start = head.fill;
236-
let after_tydesc = head.fill + sys::size_of::<*TyDesc>();
233+
let after_tydesc = head.fill + sys::size_of::<*TypeDesc>();
237234
let start = round_up_to(after_tydesc, align);
238235
let end = start + n_bytes;
239236
if end > at_vec::capacity(head.data) {
240237
return self.alloc_nonpod_grow(n_bytes, align);
241238
}
242-
head.fill = round_up_to(end, sys::pref_align_of::<*TyDesc>());
239+
head.fill = round_up_to(end, sys::pref_align_of::<*TypeDesc>());
243240

244241
//debug!("idx = %u, size = %u, align = %u, fill = %u",
245242
// start, n_bytes, align, head.fill);
@@ -252,7 +249,7 @@ impl Arena {
252249
#[inline]
253250
fn alloc_nonpod<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
254251
unsafe {
255-
let tydesc = get_tydesc::<T>();
252+
let tydesc = sys::get_type_desc::<T>();
256253
let (ty_ptr, ptr) =
257254
self.alloc_nonpod_inner((*tydesc).size, (*tydesc).align);
258255
let ty_ptr: *mut uint = transmute(ty_ptr);

trunk/src/libextra/dbg.rs

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,62 +13,56 @@
1313
#[allow(missing_doc)];
1414

1515
use core::cast::transmute;
16-
#[cfg(stage0)]
17-
use intrinsic::{get_tydesc};
18-
#[cfg(not(stage0))]
19-
use core::unstable::intrinsics::{get_tydesc};
16+
use core::sys;
2017

2118
pub mod rustrt {
22-
#[cfg(stage0)]
23-
use intrinsic::{TyDesc};
24-
#[cfg(not(stage0))]
25-
use core::unstable::intrinsics::{TyDesc};
19+
use core::sys;
2620

2721
#[abi = "cdecl"]
2822
pub extern {
29-
pub unsafe fn debug_tydesc(td: *TyDesc);
30-
pub unsafe fn debug_opaque(td: *TyDesc, x: *());
31-
pub unsafe fn debug_box(td: *TyDesc, x: *());
32-
pub unsafe fn debug_tag(td: *TyDesc, x: *());
33-
pub unsafe fn debug_fn(td: *TyDesc, x: *());
34-
pub unsafe fn debug_ptrcast(td: *TyDesc, x: *()) -> *();
23+
pub unsafe fn debug_tydesc(td: *sys::TypeDesc);
24+
pub unsafe fn debug_opaque(td: *sys::TypeDesc, x: *());
25+
pub unsafe fn debug_box(td: *sys::TypeDesc, x: *());
26+
pub unsafe fn debug_tag(td: *sys::TypeDesc, x: *());
27+
pub unsafe fn debug_fn(td: *sys::TypeDesc, x: *());
28+
pub unsafe fn debug_ptrcast(td: *sys::TypeDesc, x: *()) -> *();
3529
pub unsafe fn rust_dbg_breakpoint();
3630
}
3731
}
3832

3933
pub fn debug_tydesc<T>() {
4034
unsafe {
41-
rustrt::debug_tydesc(get_tydesc::<T>());
35+
rustrt::debug_tydesc(sys::get_type_desc::<T>());
4236
}
4337
}
4438

4539
pub fn debug_opaque<T>(x: T) {
4640
unsafe {
47-
rustrt::debug_opaque(get_tydesc::<T>(), transmute(&x));
41+
rustrt::debug_opaque(sys::get_type_desc::<T>(), transmute(&x));
4842
}
4943
}
5044

5145
pub fn debug_box<T>(x: @T) {
5246
unsafe {
53-
rustrt::debug_box(get_tydesc::<T>(), transmute(&x));
47+
rustrt::debug_box(sys::get_type_desc::<T>(), transmute(&x));
5448
}
5549
}
5650

5751
pub fn debug_tag<T>(x: T) {
5852
unsafe {
59-
rustrt::debug_tag(get_tydesc::<T>(), transmute(&x));
53+
rustrt::debug_tag(sys::get_type_desc::<T>(), transmute(&x));
6054
}
6155
}
6256

6357
pub fn debug_fn<T>(x: T) {
6458
unsafe {
65-
rustrt::debug_fn(get_tydesc::<T>(), transmute(&x));
59+
rustrt::debug_fn(sys::get_type_desc::<T>(), transmute(&x));
6660
}
6761
}
6862

6963
pub unsafe fn ptr_cast<T, U>(x: @T) -> @U {
7064
transmute(
71-
rustrt::debug_ptrcast(get_tydesc::<T>(), transmute(x)))
65+
rustrt::debug_ptrcast(sys::get_type_desc::<T>(), transmute(x)))
7266
}
7367

7468
/// Triggers a debugger breakpoint

trunk/src/libextra/time.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,9 @@ mod tests {
11421142
assert!(result::unwrap(strptime("-0800", "%z")).tm_gmtoff ==
11431143
0);
11441144
assert!(test("%", "%%"));
1145+
1146+
// Test for #7256
1147+
assert_eq!(strptime("360", "%Y-%m-%d"), Err(~"Invalid year"))
11451148
}
11461149
11471150
fn test_ctime() {

trunk/src/librustc/back/abi.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
12+
13+
1114
pub static rc_base_field_refcnt: uint = 0u;
1215

1316
pub static task_field_refcnt: uint = 0u;
@@ -46,7 +49,9 @@ pub static tydesc_field_take_glue: uint = 2u;
4649
pub static tydesc_field_drop_glue: uint = 3u;
4750
pub static tydesc_field_free_glue: uint = 4u;
4851
pub static tydesc_field_visit_glue: uint = 5u;
49-
pub static n_tydesc_fields: uint = 6u;
52+
pub static tydesc_field_shape: uint = 6u;
53+
pub static tydesc_field_shape_tables: uint = 7u;
54+
pub static n_tydesc_fields: uint = 8u;
5055

5156
// The two halves of a closure: code and environment.
5257
pub static fn_field_code: uint = 0u;
@@ -66,4 +71,14 @@ pub static vec_elt_elems: uint = 2u;
6671
pub static slice_elt_base: uint = 0u;
6772
pub static slice_elt_len: uint = 1u;
6873

74+
pub static worst_case_glue_call_args: uint = 7u;
75+
6976
pub static abi_version: uint = 1u;
77+
78+
pub fn memcpy_glue_name() -> ~str { return ~"rust_memcpy_glue"; }
79+
80+
pub fn bzero_glue_name() -> ~str { return ~"rust_bzero_glue"; }
81+
82+
pub fn yield_glue_name() -> ~str { return ~"rust_yield_glue"; }
83+
84+
pub fn no_op_type_glue_name() -> ~str { return ~"rust_no_op_type_glue"; }

trunk/src/librustc/driver/driver.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ pub fn compile_rest(sess: Session,
206206
let mut crate = crate_opt.unwrap();
207207

208208
let (llcx, llmod, link_meta) = {
209+
crate = time(time_passes, ~"intrinsic injection", ||
210+
front::intrinsic_inject::inject_intrinsic(sess, crate));
211+
209212
crate = time(time_passes, ~"extra injection", ||
210213
front::std_inject::maybe_inject_libstd_ref(sess, crate));
211214

0 commit comments

Comments
 (0)