Skip to content

Commit bae2d20

Browse files
committed
---
yaml --- r: 62710 b: refs/heads/snap-stage3 c: cf34f9f h: refs/heads/master v: v3
1 parent 87ea0e7 commit bae2d20

File tree

42 files changed

+1529
-1636
lines changed

Some content is hidden

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

42 files changed

+1529
-1636
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: df1814ba089e8b86bd7e191afa99c7bd10e05d4f
4+
refs/heads/snap-stage3: cf34f9f9a9503ac8852f6ac7426388734eb867b5
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ src/.DS_Store
7373
/doc/html
7474
/doc/latex
7575
/doc/std
76+
/doc/extra
7677
/nd/
7778
/llvm/
7879
version.md
@@ -81,7 +82,6 @@ keywords.md
8182
x86_64-apple-darwin/
8283
x86_64-unknown-linux-gnu/
8384
i686-unknown-linux-gnu/
84-
doc/core/
8585
tmp.*.rs
8686
config.stamp
8787
.DS_Store

branches/snap-stage3/mk/platform.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ $(foreach t,$(CFG_TARGET_TRIPLES),$(info cfg: os for $(t) is $(OSTYPE_$(t))))
2929
# FIXME: no-omit-frame-pointer is just so that task_start_wrapper
3030
# has a frame pointer and the stack walker can understand it. Turning off
3131
# frame pointers everywhere is overkill
32-
CFG_GCCISH_CFLAGS += -fno-omit-frame-pointer
32+
CFG_GCCISH_CFLAGS += -fno-omit-frame-pointer -DUSE_UTF8
3333

3434
# On Darwin, we need to run dsymutil so the debugging information ends
3535
# up in the right place. On other platforms, it automatically gets

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

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub impl<'self> Condvar<'self> {
107107
****************************************************************************/
108108

109109
/// An atomically reference counted wrapper for shared immutable state.
110-
struct ARC<T> { x: UnsafeAtomicRcBox<T> }
110+
pub struct ARC<T> { x: UnsafeAtomicRcBox<T> }
111111

112112
/// Create an atomically reference counted wrapper.
113113
pub fn ARC<T:Const + Owned>(data: T) -> ARC<T> {
@@ -118,29 +118,22 @@ pub fn ARC<T:Const + Owned>(data: T) -> ARC<T> {
118118
* Access the underlying data in an atomically reference counted
119119
* wrapper.
120120
*/
121-
pub fn get<'a, T:Const + Owned>(rc: &'a ARC<T>) -> &'a T {
122-
rc.get()
123-
}
124-
125-
impl<T:Const+Owned> ARC<T> {
126-
pub fn get<'a>(&'a self) -> &'a T {
121+
pub impl<T:Const+Owned> ARC<T> {
122+
fn get<'a>(&'a self) -> &'a T {
127123
unsafe { &*self.x.get_immut() }
128124
}
129125
}
126+
130127
/**
131128
* Duplicate an atomically reference counted wrapper.
132129
*
133130
* The resulting two `arc` objects will point to the same underlying data
134131
* object. However, one of the `arc` objects can be sent to another task,
135132
* allowing them to share the underlying data.
136133
*/
137-
pub fn clone<T:Const + Owned>(rc: &ARC<T>) -> ARC<T> {
138-
ARC { x: rc.x.clone() }
139-
}
140-
141134
impl<T:Const + Owned> Clone for ARC<T> {
142135
fn clone(&self) -> ARC<T> {
143-
clone(self)
136+
ARC { x: self.x.clone() }
144137
}
145138
}
146139

@@ -512,34 +505,31 @@ pub impl<'self, T:Const + Owned> RWReadMode<'self, T> {
512505
#[cfg(test)]
513506
mod tests {
514507
use core::prelude::*;
515-
508+
use core::cell::Cell;
516509
use arc::*;
517510
use arc;
518511

519-
use core::cell::Cell;
520-
use core::task;
521-
522512
#[test]
523513
fn manually_share_arc() {
524514
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
525-
let arc_v = arc::ARC(v);
515+
let arc_v = ARC(v);
526516

527517
let (p, c) = comm::stream();
528518

529519
do task::spawn() || {
530520
let p = comm::PortSet::new();
531521
c.send(p.chan());
532522

533-
let arc_v = p.recv();
523+
let arc_v : ARC<~[int]> = p.recv();
534524

535-
let v = copy *arc::get::<~[int]>(&arc_v);
525+
let v = copy (*arc_v.get());
536526
assert_eq!(v[3], 4);
537527
};
538528

539529
let c = p.recv();
540-
c.send(arc::clone(&arc_v));
530+
c.send(arc_v.clone());
541531

542-
assert_eq!((*arc::get(&arc_v))[2], 3);
532+
assert_eq!(arc_v.get()[2], 3);
543533
assert_eq!(arc_v.get()[4], 5);
544534

545535
info!(arc_v);

branches/snap-stage3/src/librust/rust.rc

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,17 @@ extern mod rustc;
3232
use core::prelude::*;
3333

3434
use core::run;
35+
use core::libc::exit;
3536

3637
enum ValidUsage {
37-
Valid, Invalid
38+
Valid(int), Invalid
3839
}
3940

4041
impl ValidUsage {
4142
fn is_valid(&self) -> bool {
4243
match *self {
43-
Valid => true,
44-
Invalid => false
44+
Valid(_) => true,
45+
Invalid => false
4546
}
4647
}
4748
}
@@ -144,7 +145,7 @@ fn cmd_help(args: &[~str]) -> ValidUsage {
144145
UsgStr(msg) => io::println(fmt!("%s\n", msg)),
145146
UsgCall(f) => f(),
146147
}
147-
Valid
148+
Valid(0)
148149
},
149150
None => Invalid
150151
}
@@ -162,8 +163,8 @@ fn cmd_test(args: &[~str]) -> ValidUsage {
162163
let test_exec = Path(filename).filestem().unwrap() + "test~";
163164
invoke("rustc", &[~"--test", filename.to_owned(),
164165
~"-o", test_exec.to_owned()], rustc::main);
165-
run::run_program(~"./" + test_exec, []);
166-
Valid
166+
let exit_code = run::run_program(~"./" + test_exec, []);
167+
Valid(exit_code)
167168
}
168169
_ => Invalid
169170
}
@@ -175,8 +176,8 @@ fn cmd_run(args: &[~str]) -> ValidUsage {
175176
let exec = Path(filename).filestem().unwrap() + "~";
176177
invoke("rustc", &[filename.to_owned(), ~"-o", exec.to_owned()],
177178
rustc::main);
178-
run::run_program(~"./"+exec, prog_args);
179-
Valid
179+
let exit_code = run::run_program(~"./"+exec, prog_args);
180+
Valid(exit_code)
180181
}
181182
_ => Invalid
182183
}
@@ -194,7 +195,7 @@ fn do_command(command: &Command, args: &[~str]) -> ValidUsage {
194195
Call(f) => f(args),
195196
CallMain(prog, f) => {
196197
invoke(prog, args, f);
197-
Valid
198+
Valid(0)
198199
}
199200
}
200201
}
@@ -233,7 +234,10 @@ pub fn main() {
233234
if !args.is_empty() {
234235
for find_cmd(*args.head()).each |command| {
235236
let result = do_command(command, args.tail());
236-
if result.is_valid() { return; }
237+
match result {
238+
Valid(exit_code) => unsafe { exit(exit_code.to_i32()) },
239+
_ => loop
240+
}
237241
}
238242
}
239243

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,10 @@ fn fold_block(
136136
) -> ast::blk_ {
137137
let filtered_stmts =
138138
b.stmts.filter_mapped(|a| filter_stmt(cx, *a));
139+
let filtered_view_items =
140+
b.view_items.filter_mapped(|a| filter_view_item(cx, *a));
139141
ast::blk_ {
140-
view_items: /*bad*/copy b.view_items,
142+
view_items: vec::map(filtered_view_items, |x| fld.fold_view_item(*x)),
141143
stmts: vec::map(filtered_stmts, |x| fld.fold_stmt(*x)),
142144
expr: b.expr.map(|x| fld.fold_expr(*x)),
143145
id: b.id,

branches/snap-stage3/src/librustc/middle/trans/base.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,9 +2329,7 @@ pub fn create_entry_wrapper(ccx: @CrateContext,
23292329
llvm::LLVMPositionBuilderAtEnd(bld, llbb);
23302330
23312331
let start_def_id = ccx.tcx.lang_items.start_fn();
2332-
if start_def_id.crate == ast::local_crate {
2333-
ccx.sess.bug("start lang item is never in the local crate")
2334-
} else {
2332+
if start_def_id.crate != ast::local_crate {
23352333
let start_fn_type = csearch::get_type(ccx.tcx,
23362334
start_def_id).ty;
23372335
trans_external_path(ccx, start_def_id, start_fn_type);
@@ -2348,8 +2346,7 @@ pub fn create_entry_wrapper(ccx: @CrateContext,
23482346
let (start_fn, args) = if use_start_lang_item {
23492347
let start_def_id = ccx.tcx.lang_items.start_fn();
23502348
let start_fn = if start_def_id.crate == ast::local_crate {
2351-
ccx.sess.bug("start lang item is never in the local \
2352-
crate")
2349+
get_item_val(ccx, start_def_id.node)
23532350
} else {
23542351
let start_fn_type = csearch::get_type(ccx.tcx,
23552352
start_def_id).ty;

branches/snap-stage3/src/libstd/core.rc

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -88,34 +88,24 @@ pub mod prelude;
8888

8989
/* Primitive types */
9090

91-
#[path = "num/int-template.rs"] #[merge = "num/int-template/int.rs"]
92-
pub mod int;
93-
#[path = "num/int-template.rs"] #[merge = "num/int-template/i8.rs"]
94-
pub mod i8;
95-
#[path = "num/int-template.rs"] #[merge = "num/int-template/i16.rs"]
96-
pub mod i16;
97-
#[path = "num/int-template.rs"] #[merge = "num/int-template/i32.rs"]
98-
pub mod i32;
99-
#[path = "num/int-template.rs"] #[merge = "num/int-template/i64.rs"]
100-
pub mod i64;
101-
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/uint.rs"]
102-
pub mod uint;
103-
104-
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/u8.rs"]
105-
pub mod u8;
106-
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/u16.rs"]
107-
pub mod u16;
108-
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/u32.rs"]
109-
pub mod u32;
110-
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/u64.rs"]
111-
pub mod u64;
112-
113-
#[path = "num/float.rs"]
114-
pub mod float;
115-
#[path = "num/f32.rs"]
116-
pub mod f32;
117-
#[path = "num/f64.rs"]
118-
pub mod f64;
91+
#[path = "num/int_macros.rs"] mod int_macros;
92+
#[path = "num/uint_macros.rs"] mod uint_macros;
93+
94+
#[path = "num/int.rs"] pub mod int;
95+
#[path = "num/i8.rs"] pub mod i8;
96+
#[path = "num/i16.rs"] pub mod i16;
97+
#[path = "num/i32.rs"] pub mod i32;
98+
#[path = "num/i64.rs"] pub mod i64;
99+
100+
#[path = "num/uint.rs"] pub mod uint;
101+
#[path = "num/u8.rs"] pub mod u8;
102+
#[path = "num/u16.rs"] pub mod u16;
103+
#[path = "num/u32.rs"] pub mod u32;
104+
#[path = "num/u64.rs"] pub mod u64;
105+
106+
#[path = "num/float.rs"] pub mod float;
107+
#[path = "num/f32.rs"] pub mod f32;
108+
#[path = "num/f64.rs"] pub mod f64;
119109

120110
pub mod nil;
121111
pub mod bool;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! Operations and constants for `i16`
12+
13+
use num::BitCount;
14+
use unstable::intrinsics;
15+
16+
pub use self::generated::*;
17+
18+
int_module!(i16, 16)
19+
20+
impl BitCount for i16 {
21+
/// Counts the number of bits set. Wraps LLVM's `ctpop` intrinsic.
22+
#[inline(always)]
23+
fn population_count(&self) -> i16 { unsafe { intrinsics::ctpop16(*self) } }
24+
25+
/// Counts the number of leading zeros. Wraps LLVM's `ctlz` intrinsic.
26+
#[inline(always)]
27+
fn leading_zeros(&self) -> i16 { unsafe { intrinsics::ctlz16(*self) } }
28+
29+
/// Counts the number of trailing zeros. Wraps LLVM's `cttz` intrinsic.
30+
#[inline(always)]
31+
fn trailing_zeros(&self) -> i16 { unsafe { intrinsics::cttz16(*self) } }
32+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! Operations and constants for `i32`
12+
13+
use num::BitCount;
14+
use unstable::intrinsics;
15+
16+
pub use self::generated::*;
17+
18+
int_module!(i32, 32)
19+
20+
impl BitCount for i32 {
21+
/// Counts the number of bits set. Wraps LLVM's `ctpop` intrinsic.
22+
#[inline(always)]
23+
fn population_count(&self) -> i32 { unsafe { intrinsics::ctpop32(*self) } }
24+
25+
/// Counts the number of leading zeros. Wraps LLVM's `ctlz` intrinsic.
26+
#[inline(always)]
27+
fn leading_zeros(&self) -> i32 { unsafe { intrinsics::ctlz32(*self) } }
28+
29+
/// Counts the number of trailing zeros. Wraps LLVM's `cttz` intrinsic.
30+
#[inline(always)]
31+
fn trailing_zeros(&self) -> i32 { unsafe { intrinsics::cttz32(*self) } }
32+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! Operations and constants for `i64`
12+
13+
use num::BitCount;
14+
use unstable::intrinsics;
15+
16+
pub use self::generated::*;
17+
18+
int_module!(i64, 64)
19+
20+
impl BitCount for i64 {
21+
/// Counts the number of bits set. Wraps LLVM's `ctpop` intrinsic.
22+
#[inline(always)]
23+
fn population_count(&self) -> i64 { unsafe { intrinsics::ctpop64(*self) } }
24+
25+
/// Counts the number of leading zeros. Wraps LLVM's `ctlz` intrinsic.
26+
#[inline(always)]
27+
fn leading_zeros(&self) -> i64 { unsafe { intrinsics::ctlz64(*self) } }
28+
29+
/// Counts the number of trailing zeros. Wraps LLVM's `cttz` intrinsic.
30+
#[inline(always)]
31+
fn trailing_zeros(&self) -> i64 { unsafe { intrinsics::cttz64(*self) } }
32+
}

0 commit comments

Comments
 (0)