Skip to content

Commit d1a6cf6

Browse files
committed
---
yaml --- r: 54417 b: refs/heads/snap-stage3 c: 810c4d8 h: refs/heads/master i: 54415: 37f267a v: v3
1 parent ff1c244 commit d1a6cf6

Some content is hidden

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

87 files changed

+1196
-1642
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: 5f13e9ccc2e3328d4cd8ca49f84e6840dd998346
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 0224eb3d3273519ed82404b711f8cb0bbab05c95
4+
refs/heads/snap-stage3: 810c4d8a1e0bdae3c2aba86a8b93e20faecba283
55
refs/heads/try: 8eb2bab100b42f0ba751552d8eff00eb2134c55a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ elseif exists("b:current_syntax")
1010
finish
1111
endif
1212

13+
syn match rustAssert "\<assert\(\w\)*"
1314
syn keyword rustKeyword as break
1415
syn keyword rustKeyword copy do drop else extern
1516
syn keyword rustKeyword for if impl let log
16-
syn keyword rustKeyword loop match mod once priv pub
17+
syn keyword rustKeyword loop match mod once priv pub pure
1718
syn keyword rustKeyword ref return static
1819
syn keyword rustKeyword unsafe use while
1920
" FIXME: Scoped impl's name is also fallen in this category
@@ -70,8 +71,8 @@ syn keyword rustConstant STDIN_FILENO STDOUT_FILENO STDERR_FILENO
7071
syn match rustModPath "\w\(\w\)*::[^<]"he=e-3,me=e-3
7172
syn match rustModPathSep "::"
7273

73-
syn match rustFuncCall "\w\(\w\)*("he=e-1,me=e-1
74-
syn match rustFuncCall "\w\(\w\)*::<"he=e-3,me=e-3 " foo::<T>();
74+
syn match rustFuncCall "\w\(\w\)*("he=e-1,me=e-1 contains=rustAssert
75+
syn match rustFuncCall "\w\(\w\)*::<"he=e-3,me=e-3 contains=rustAssert " foo::<T>();
7576

7677
syn match rustMacro '\w\(\w\)*!'
7778
syn match rustMacro '#\w\(\w\)*'
@@ -125,6 +126,7 @@ hi def link rustBoolean Boolean
125126
hi def link rustConstant Constant
126127
hi def link rustSelf Constant
127128
hi def link rustFloat Float
129+
hi def link rustAssert Keyword
128130
hi def link rustKeyword Keyword
129131
hi def link rustIdentifier Identifier
130132
hi def link rustModPath Include
@@ -138,6 +140,7 @@ hi def link rustStorage StorageClass
138140
hi def link rustLifetime Special
139141

140142
" Other Suggestions:
143+
" hi rustAssert ctermfg=yellow
141144
" hi rustMacro ctermfg=magenta
142145

143146
syn sync minlines=200

branches/snap-stage3/src/libcore/cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
pub mod rusti {
1414
#[abi = "rust-intrinsic"]
1515
#[link_name = "rusti"]
16-
pub extern "rust-intrinsic" {
16+
pub extern {
1717
fn forget<T>(+x: T);
1818
fn reinterpret_cast<T, U>(&&e: T) -> U;
1919
}

branches/snap-stage3/src/libcore/hashmap.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,10 +393,16 @@ pub mod linear {
393393
}
394394
}
395395
396-
pub impl<K:Hash + IterBytes + Eq,V> LinearMap<K, V> {
396+
pub impl<K: Hash + IterBytes + Eq, V> LinearMap<K, V> {
397397
/// Create an empty LinearMap
398398
fn new() -> LinearMap<K, V> {
399-
linear_map_with_capacity(INITIAL_CAPACITY)
399+
LinearMap::with_capacity(INITIAL_CAPACITY)
400+
}
401+
402+
/// Create an empty LinearMap with space for at least `n` elements in
403+
/// the hash table.
404+
fn with_capacity(capacity: uint) -> LinearMap<K, V> {
405+
linear_map_with_capacity(capacity)
400406
}
401407
402408
/// Reserve space for at least `n` elements in the hash table.
@@ -652,7 +658,15 @@ pub mod linear {
652658

653659
pub impl <T:Hash + IterBytes + Eq> LinearSet<T> {
654660
/// Create an empty LinearSet
655-
fn new() -> LinearSet<T> { LinearSet{map: LinearMap::new()} }
661+
fn new() -> LinearSet<T> {
662+
LinearSet::with_capacity(INITIAL_CAPACITY)
663+
}
664+
665+
/// Create an empty LinearSet with space for at least `n` elements in
666+
/// the hash table.
667+
fn with_capacity(capacity: uint) -> LinearSet<T> {
668+
LinearSet { map: LinearMap::with_capacity(capacity) }
669+
}
656670

657671
/// Reserve space for at least `n` elements in the hash table.
658672
fn reserve_at_least(&mut self, n: uint) {

branches/snap-stage3/src/libcore/libc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,7 @@ pub mod funcs {
16171617
use libc::types::os::arch::extra::{HANDLE};
16181618

16191619
#[abi = "stdcall"]
1620-
pub extern "stdcall" {
1620+
pub extern {
16211621
unsafe fn GetEnvironmentVariableW(n: LPCWSTR,
16221622
v: LPWSTR,
16231623
nsize: DWORD)

branches/snap-stage3/src/libcore/os.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ pub fn errno() -> uint {
942942
943943
#[link_name = "kernel32"]
944944
#[abi = "stdcall"]
945-
extern "stdcall" {
945+
extern {
946946
unsafe fn GetLastError() -> DWORD;
947947
}
948948
@@ -1004,7 +1004,7 @@ pub fn last_os_error() -> ~str {
10041004
10051005
#[link_name = "kernel32"]
10061006
#[abi = "stdcall"]
1007-
extern "stdcall" {
1007+
extern {
10081008
unsafe fn FormatMessageA(flags: DWORD, lpSrc: LPVOID,
10091009
msgId: DWORD, langId: DWORD,
10101010
buf: LPSTR, nsize: DWORD,
@@ -1118,15 +1118,15 @@ type LPCWSTR = *u16;
11181118
#[cfg(windows)]
11191119
#[link_name="kernel32"]
11201120
#[abi="stdcall"]
1121-
extern "stdcall" {
1121+
extern {
11221122
fn GetCommandLineW() -> LPCWSTR;
11231123
fn LocalFree(ptr: *c_void);
11241124
}
11251125
11261126
#[cfg(windows)]
11271127
#[link_name="shell32"]
11281128
#[abi="stdcall"]
1129-
extern "stdcall" {
1129+
extern {
11301130
fn CommandLineToArgvW(lpCmdLine: LPCWSTR, pNumArgs: *mut c_int) -> **u16;
11311131
}
11321132

branches/snap-stage3/src/libcore/ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub mod libc_ {
4343

4444
pub mod rusti {
4545
#[abi = "rust-intrinsic"]
46-
pub extern "rust-intrinsic" {
46+
pub extern {
4747
fn addr_of<T>(&&val: T) -> *T;
4848
}
4949
}

branches/snap-stage3/src/libcore/rt/thread_local_storage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub unsafe fn get(key: Key) -> *mut c_void {
7373

7474
#[cfg(windows)]
7575
#[abi = "stdcall"]
76-
extern "stdcall" {
76+
extern {
7777
fn TlsAlloc() -> DWORD;
7878
fn TlsSetValue(dwTlsIndex: DWORD, lpTlsvalue: LPVOID) -> BOOL;
7979
fn TlsGetValue(dwTlsIndex: DWORD) -> LPVOID;

branches/snap-stage3/src/libcore/stackwalk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub mod rustrt {
9494

9595
pub mod rusti {
9696
#[abi = "rust-intrinsic"]
97-
pub extern "rust-intrinsic" {
97+
pub extern {
9898
pub fn frame_address(f: &once fn(x: *u8));
9999
}
100100
}

branches/snap-stage3/src/libcore/sys.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub struct Closure {
3939

4040
pub mod rusti {
4141
#[abi = "rust-intrinsic"]
42-
pub extern "rust-intrinsic" {
42+
pub extern {
4343
fn get_tydesc<T>() -> *();
4444
fn size_of<T>() -> uint;
4545
fn pref_align_of<T>() -> uint;

branches/snap-stage3/src/libcore/unstable/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The intrinsics are defined in librustc/middle/trans/foreign.rs.
1515
*/
1616

1717
#[abi = "rust-intrinsic"]
18-
pub extern "rust-intrinsic" {
18+
pub extern {
1919
pub fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
2020
pub fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
2121
pub fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;

branches/snap-stage3/src/libcore/vec.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,28 @@ pub fn consume<T>(mut v: ~[T], f: &fn(uint, v: T)) {
560560
}
561561
}
562562
563+
pub fn consume_reverse<T>(mut v: ~[T], f: &fn(uint, v: T)) {
564+
unsafe {
565+
do as_mut_buf(v) |p, ln| {
566+
let mut i = ln;
567+
while i > 0 {
568+
i -= 1;
569+
570+
// NB: This unsafe operation counts on init writing 0s to the
571+
// holes we create in the vector. That ensures that, if the
572+
// iterator fails then we won't try to clean up the consumed
573+
// elements during unwinding
574+
let mut x = intrinsics::init();
575+
let p = ptr::mut_offset(p, i);
576+
x <-> *p;
577+
f(i, x);
578+
}
579+
}
580+
581+
raw::set_len(&mut v, 0);
582+
}
583+
}
584+
563585
/// Remove the last element from a vector and return it
564586
pub fn pop<T>(v: &mut ~[T]) -> T {
565587
let ln = v.len();
@@ -1985,6 +2007,7 @@ pub trait OwnedVector<T> {
19852007
fn truncate(&mut self, newlen: uint);
19862008
fn retain(&mut self, f: &fn(t: &T) -> bool);
19872009
fn consume(self, f: &fn(uint, v: T));
2010+
fn consume_reverse(self, f: &fn(uint, v: T));
19882011
fn filter(self, f: &fn(t: &T) -> bool) -> ~[T];
19892012
fn partition(self, f: &fn(&T) -> bool) -> (~[T], ~[T]);
19902013
fn grow_fn(&mut self, n: uint, op: iter::InitOp<T>);
@@ -2046,6 +2069,11 @@ impl<T> OwnedVector<T> for ~[T] {
20462069
consume(self, f)
20472070
}
20482071

2072+
#[inline]
2073+
fn consume_reverse(self, f: &fn(uint, v: T)) {
2074+
consume_reverse(self, f)
2075+
}
2076+
20492077
#[inline]
20502078
fn filter(self, f: &fn(&T) -> bool) -> ~[T] {
20512079
filter(self, f)

branches/snap-stage3/src/librustc/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pub mod jit {
9797
pub mod rusti {
9898
#[nolink]
9999
#[abi = "rust-intrinsic"]
100-
pub extern "rust-intrinsic" {
100+
pub extern {
101101
pub fn morestack_addr() -> *();
102102
}
103103
}

branches/snap-stage3/src/librustc/driver/driver.rs

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ use std::getopts::groups::{optopt, optmulti, optflag, optflagopt, getopts};
3333
use std::getopts::{opt_present};
3434
use std::getopts;
3535
use syntax::ast;
36-
use syntax::abi;
3736
use syntax::attr;
3837
use syntax::codemap;
3938
use syntax::diagnostic;
@@ -86,10 +85,10 @@ pub fn default_configuration(sess: Session, +argv0: ~str, input: input) ->
8685
// ARM is bi-endian, however using NDK seems to default
8786
// to little-endian unless a flag is provided.
8887
let (end,arch,wordsz) = match sess.targ_cfg.arch {
89-
abi::X86 => (~"little",~"x86",~"32"),
90-
abi::X86_64 => (~"little",~"x86_64",~"64"),
91-
abi::Arm => (~"little",~"arm",~"32"),
92-
abi::Mips => (~"little",~"arm",~"32")
88+
session::arch_x86 => (~"little",~"x86",~"32"),
89+
session::arch_x86_64 => (~"little",~"x86_64",~"64"),
90+
session::arch_arm => (~"little",~"arm",~"32"),
91+
session::arch_mips => (~"little",~"arm",~"32")
9392
};
9493

9594
return ~[ // Target bindings.
@@ -309,7 +308,7 @@ pub fn compile_rest(sess: Session, cfg: ast::crate_cfg,
309308
};
310309

311310
// NOTE: Android hack
312-
if sess.targ_cfg.arch == abi::Arm &&
311+
if sess.targ_cfg.arch == session::arch_arm &&
313312
(sess.opts.output_type == link::output_type_object ||
314313
sess.opts.output_type == link::output_type_exe) {
315314
let output_type = link::output_type_assembly;
@@ -454,20 +453,20 @@ pub fn get_os(triple: &str) -> Option<session::os> {
454453
} else { None }
455454
}
456455

457-
pub fn get_arch(triple: &str) -> Option<abi::Architecture> {
456+
pub fn get_arch(triple: &str) -> Option<session::arch> {
458457
if str::contains(triple, ~"i386") ||
459458
str::contains(triple, ~"i486") ||
460459
str::contains(triple, ~"i586") ||
461460
str::contains(triple, ~"i686") ||
462461
str::contains(triple, ~"i786") {
463-
Some(abi::X86)
462+
Some(session::arch_x86)
464463
} else if str::contains(triple, ~"x86_64") {
465-
Some(abi::X86_64)
464+
Some(session::arch_x86_64)
466465
} else if str::contains(triple, ~"arm") ||
467466
str::contains(triple, ~"xscale") {
468-
Some(abi::Arm)
467+
Some(session::arch_arm)
469468
} else if str::contains(triple, ~"mips") {
470-
Some(abi::Mips)
469+
Some(session::arch_mips)
471470
} else { None }
472471
}
473472

@@ -484,16 +483,16 @@ pub fn build_target_config(sopts: @session::options,
484483
~"unknown architecture: " + sopts.target_triple)
485484
};
486485
let (int_type, uint_type, float_type) = match arch {
487-
abi::X86 => (ast::ty_i32, ast::ty_u32, ast::ty_f64),
488-
abi::X86_64 => (ast::ty_i64, ast::ty_u64, ast::ty_f64),
489-
abi::Arm => (ast::ty_i32, ast::ty_u32, ast::ty_f64),
490-
abi::Mips => (ast::ty_i32, ast::ty_u32, ast::ty_f64)
486+
session::arch_x86 => (ast::ty_i32, ast::ty_u32, ast::ty_f64),
487+
session::arch_x86_64 => (ast::ty_i64, ast::ty_u64, ast::ty_f64),
488+
session::arch_arm => (ast::ty_i32, ast::ty_u32, ast::ty_f64),
489+
session::arch_mips => (ast::ty_i32, ast::ty_u32, ast::ty_f64)
491490
};
492491
let target_strs = match arch {
493-
abi::X86 => x86::get_target_strs(os),
494-
abi::X86_64 => x86_64::get_target_strs(os),
495-
abi::Arm => arm::get_target_strs(os),
496-
abi::Mips => mips::get_target_strs(os)
492+
session::arch_x86 => x86::get_target_strs(os),
493+
session::arch_x86_64 => x86_64::get_target_strs(os),
494+
session::arch_arm => arm::get_target_strs(os),
495+
session::arch_mips => mips::get_target_strs(os)
497496
};
498497
let target_cfg = @session::config {
499498
os: os,

branches/snap-stage3/src/librustc/driver/session.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,19 @@ use syntax::codemap::span;
2525
use syntax::diagnostic;
2626
use syntax::parse::ParseSess;
2727
use syntax::{ast, codemap};
28-
use syntax::abi;
2928
use syntax;
3029

3130
#[deriving(Eq)]
3231
pub enum os { os_win32, os_macos, os_linux, os_android, os_freebsd, }
3332

33+
#[deriving(Eq)]
34+
pub enum arch { arch_x86, arch_x86_64, arch_arm, arch_mips, }
35+
3436
pub enum crate_type { bin_crate, lib_crate, unknown_crate, }
3537

3638
pub struct config {
3739
os: os,
38-
arch: abi::Architecture,
40+
arch: arch,
3941
target_strs: target_strs::t,
4042
int_type: int_ty,
4143
uint_type: uint_ty,

branches/snap-stage3/src/librustc/front/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn fold_foreign_mod(
9292
nm.view_items.filter_mapped(|a| filter_view_item(cx, *a));
9393
ast::foreign_mod {
9494
sort: nm.sort,
95-
abis: nm.abis,
95+
abi: nm.abi,
9696
view_items: vec::map(filtered_view_items, |x| fld.fold_view_item(*x)),
9797
items: filtered_items
9898
}

branches/snap-stage3/src/librustc/front/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub mod intrinsic {
126126
use super::{TyDesc, TyVisitor};
127127

128128
#[abi = "rust-intrinsic"]
129-
pub extern "rust-intrinsic" {
129+
pub extern {
130130
pub fn get_tydesc<T>() -> *();
131131
pub fn visit_tydesc(++td: *TyDesc, &&tv: @TyVisitor);
132132
}

branches/snap-stage3/src/librustc/front/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ fn fold_item(cx: @mut TestCtxt, &&i: @ast::item, fld: @fold::ast_fold)
146146

147147
if is_test_fn(i) || is_bench_fn(i) {
148148
match i.node {
149-
ast::item_fn(_, purity, _, _, _) if purity == ast::unsafe_fn => {
149+
ast::item_fn(_, purity, _, _) if purity == ast::unsafe_fn => {
150150
let sess = cx.sess;
151151
sess.span_fatal(
152152
i.span,
@@ -178,7 +178,7 @@ fn is_test_fn(i: @ast::item) -> bool {
178178

179179
fn has_test_signature(i: @ast::item) -> bool {
180180
match &i.node {
181-
&ast::item_fn(ref decl, _, _, ref generics, _) => {
181+
&ast::item_fn(ref decl, _, ref generics, _) => {
182182
let no_output = match decl.output.node {
183183
ast::ty_nil => true,
184184
_ => false
@@ -200,7 +200,7 @@ fn is_bench_fn(i: @ast::item) -> bool {
200200

201201
fn has_test_signature(i: @ast::item) -> bool {
202202
match i.node {
203-
ast::item_fn(ref decl, _, _, ref generics, _) => {
203+
ast::item_fn(ref decl, _, ref generics, _) => {
204204
let input_cnt = vec::len(decl.inputs);
205205
let no_output = match decl.output.node {
206206
ast::ty_nil => true,

0 commit comments

Comments
 (0)