Skip to content

Commit 7c2a0b5

Browse files
committed
---
yaml --- r: 148821 b: refs/heads/try2 c: 16f1a72 h: refs/heads/master i: 148819: ac84fcc v: v3
1 parent f900cd1 commit 7c2a0b5

File tree

172 files changed

+2361
-2769
lines changed

Some content is hidden

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

172 files changed

+2361
-2769
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: e704561003311daa5239e796b31bb4ade0a9eb3d
8+
refs/heads/try2: 16f1a72f0ab6ebf9e3279e3dd4873b6dc13220ec
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/rust.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3079,7 +3079,7 @@ A value of type `str` is a Unicode string,
30793079
represented as a vector of 8-bit unsigned bytes holding a sequence of UTF-8 codepoints.
30803080
Since `str` is of unknown size, it is not a _first class_ type,
30813081
but can only be instantiated through a pointer type,
3082-
such as `&str`, `@str` or `~str`.
3082+
such as `&str` or `~str`.
30833083

30843084
### Tuple types
30853085

@@ -3115,7 +3115,7 @@ Such a definite-sized vector type is a first-class type, since its size is known
31153115
A vector without such a size is said to be of _indefinite_ size,
31163116
and is therefore not a _first-class_ type.
31173117
An indefinite-size vector can only be instantiated through a pointer type,
3118-
such as `&[T]`, `@[T]` or `~[T]`.
3118+
such as `&[T]` or `~[T]`.
31193119
The kind of a vector type depends on the kind of its element type,
31203120
as with other simple structural types.
31213121

branches/try2/src/etc/zsh/_rust

Lines changed: 70 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,80 +5,110 @@ local -a _rustc_opts_switches _rustc_opts_lint _rustc_opts_debug
55
typeset -A opt_args
66

77
_rustc_opts_switches=(
8+
--android-cross-path'[The path to the Android NDK]'
9+
--ar'[Program to use for managing archives instead of the default.]'
810
--bin'[Compile an executable crate (default)]'
911
-c'[Compile and assemble, but do not link]'
1012
--cfg'[Configure the compilation environment]'
13+
--crate-id'[Output the crate id and exit]'
14+
--crate-file-name'[Output the file(s) that would be written if compilation continued and exit]'
15+
--crate-name'[Output the crate name and exit]'
16+
--dep-info'[Output dependency info to <filename> after compiling]'
17+
--dylib'[Compile a dynamic library crate]'
1118
--emit-llvm'[Produce an LLVM bitcode file]'
1219
{-h,--help}'[Display this message]'
1320
-L'[Add a directory to the library search path]'
1421
--lib'[Compile a library crate]'
1522
--linker'[Program to use for linking instead of the default.]'
1623
--link-args'[FLAGS is a space-separated list of flags passed to the linker]'
24+
--llvm-args'[A list of arguments to pass to llvm, comma separated]'
1725
--ls'[List the symbols defined by a library crate]'
26+
--no-analysis'[Parse and expand the output, but run no analysis or produce output]'
27+
--no-rpath'[Disables setting the rpath in libs/exes]'
1828
--no-trans'[Run all passes except translation; no output]'
1929
-O'[Equivalent to --opt-level=2]'
2030
-o'[Write output to <filename>]'
2131
--opt-level'[Optimize with possible levels 0-3]'
2232
--out-dir'[Write output to compiler-chosen filename in <dir>]'
2333
--parse-only'[Parse only; do not compile, assemble, or link]'
34+
--passes'[Comma or space separated list of pass names to use]'
2435
--pretty'[Pretty-print the input instead of compiling]'
36+
--rlib'[Compile a rust library crate as an rlib file]'
2537
-S'[Compile only; do not assemble or link]'
2638
--save-temps'[Write intermediate files (.bc, .opt.bc, .o) in addition to normal output]'
39+
--staticlib'[Compile a static library crate]'
2740
--sysroot'[Override the system root]'
2841
--test'[Build a test harness]'
2942
--target'[Target triple cpu-manufacturer-kernel\[-os\] to compile]'
3043
--target-cpu'[Select target processor (llc -mcpu=help for details)]'
3144
--target-feature'[Target specific attributes (llc -mattr=help for details)]'
32-
--android-cross-path'[The path to the Android NDK]'
3345
{-v,--version}'[Print version info and exit]'
3446
)
3547
_rustc_opts_lint=(
36-
'path-statement[path statements with no effect]'
37-
'missing-trait-doc[detects missing documentation for traits]'
38-
'missing-struct-doc[detects missing documentation for structs]'
48+
'attribute-usage[detects bad use of attributes]'
3949
'ctypes[proper use of std::libc types in foreign modules]'
40-
"unused-mut[detect mut variables which don't need to be mutable]"
41-
'unused-imports[imports that are never used]'
42-
'heap-memory[use of any (~ type or @ type) heap memory]'
43-
'default-methods[allow default methods]'
44-
'unused-variable[detect variables which are not used in any way]'
4550
'dead-assignment[detect assignments that will never be read]'
46-
'unrecognized-lint[unrecognized lint attribute]'
47-
'type-limits[comparisons made useless by limits of the types involved]'
48-
'unused-unsafe[unnecessary use of an `unsafe` block]'
49-
'while-true[suggest using loop { } instead of while(true) { }]'
50-
'non-camel-case-types[types, variants and traits should have camel case names]'
51+
'dead-code[detect piece of code that will never be used]'
52+
'default-type-param-usage[prevents explicitly setting a type parameter with a default]'
53+
'deprecated[detects use of #\[deprecated\] items]'
54+
'experimental[detects use of #\[experimental\] items]'
55+
'heap-memory[use of any (~ type or @ type) heap memory]'
5156
'managed-heap-memory[use of managed (@ type) heap memory]'
52-
'unnecessary-allocation[detects unnecessary allocations that can be eliminated]'
57+
'missing-doc[detects missing documentation for public members]'
58+
'non-camel-case-types[types, variants and traits should have camel case names]'
59+
'non-uppercase-pattern-statics[static constants in match patterns should be all caps]'
60+
'non-uppercase-statics[static constants should have uppercase identifiers]'
5361
'owned-heap-memory[use of owned (~ type) heap memory]'
62+
'path-statement[path statements with no effect]'
63+
'type-limits[comparisons made useless by limits of the types involved]'
64+
'type-overflow[literal out of range for its type]'
65+
'unknown-crate-type[unknown crate type found in #\[crate_type\] directive]'
66+
'unknown-features[unknown features found in crate-level #\[feature\] directives]'
67+
'unnecessary-allocation[detects unnecessary allocations that can be eliminated]'
68+
'unnecessary-parens[`if`, `match`, `while` and `return` do not need parentheses]'
69+
'unnecessary-qualification[detects unnecessarily qualified names]'
70+
'unnecessary-typecast[detects unnecessary type casts, that can be removed]'
71+
'unreachable-code[detects unreachable code]'
72+
'unrecognized-lint[unrecognized lint attribute]'
73+
'unsafe-block[usage of an `unsafe` block]'
74+
'unstable[detects use of #\[unstable\] items (incl. items with no stability attribute)]'
75+
'unused-imports[imports that are never used]'
76+
'unused-must-use[unused result of an type flagged as #\[must_use\]]'
77+
"unused-mut[detect mut variables which don't need to be mutable]"
78+
'unused-result[unused result of an expression in a statement]'
79+
'unused-unsafe[unnecessary use of an `unsafe` block]'
80+
'unused-variable[detect variables which are not used in any way]'
81+
'warnings[mass-change the level for lints which produce warnings]'
82+
'while-true[suggest using `loop { }` instead of `while true { }`]'
5483
)
5584

5685
_rustc_opts_debug=(
57-
'verbose:in general, enable more debug printouts'
58-
'time-passes:measure time of each rustc pass'
59-
'count-llvm-insns:count where LLVM instrs originate'
60-
'time-llvm-passes:measure time of each LLVM pass'
61-
'trans-stats:gather trans statistics'
62-
'asm-comments:generate comments into the assembly (may change behavior)'
63-
'no-verify:skip LLVM verification'
64-
'trace:emit trace logs'
65-
'coherence:perform coherence checking'
66-
'borrowck-stats:gather borrowck statistics'
67-
"borrowck-note-pure:note where purity is req'd"
68-
"borrowck-note-loan:note where loans are req'd"
69-
'no-landing-pads:omit landing pads for unwinding'
70-
'debug-llvm:enable debug output from LLVM'
71-
'count-type-sizes:count the sizes of aggregate types'
72-
'meta-stats:gather metadata statistics'
73-
'no-opt:do not optimize, even if -O is passed'
74-
'print-link-args:Print the arguments passed to the linker'
75-
'gc:Garbage collect shared data (experimental)'
76-
'jit:Execute using JIT (experimental)'
77-
'extra-debug-info:Extra debugging info (experimental)'
78-
'debug-info:Produce debug info (experimental)'
79-
'static:Use or produce static libraries or binaries (experimental)'
80-
'no-debug-borrows:do not show where borrow checks fail'
81-
'lint-llvm:Run the LLVM lint pass on the pre-optimization IR'
86+
'asm-comments[generate comments into the assembly (may change behavior)]'
87+
'borrowck-stats[gather borrowck statistics]'
88+
'count-llvm-insns[count where LLVM instrs originate]'
89+
'count-type-sizes[count the sizes of aggregate types]'
90+
'debug-info[Produce debug info (experimental)]'
91+
'debug-llvm[enable debug output from LLVM]'
92+
'extra-debug-info[Extra debugging info (experimental)]'
93+
'gc[Garbage collect shared data (experimental)]'
94+
'gen-crate-map[Force generation of a toplevel crate map]'
95+
'lto[Perform LLVM link-time optimizations]'
96+
'meta-stats[gather metadata statistics]'
97+
"no-integrated-as[Use external assembler rather than LLVM's integrated one]"
98+
'no-landing-pads[omit landing pads for unwinding]'
99+
'no-opt[do not optimize, even if -O is passed]'
100+
"no-prepopulate-passes[Don't pre-populate the pass managers with a list of passes, only use the passes from --passes]"
101+
"no-vectorize-loops[Don't run the loop vectorization optimization passes]"
102+
"no-vectorize-slp[Don't run LLVM's SLP vectorization passes]"
103+
'no-verify[skip LLVM verification]'
104+
'prefer-dynamic[Prefer dynamic linking to static linking]'
105+
'print-link-args[Print the arguments passed to the linker]'
106+
'print-llvm-passes[Prints the llvm optimization passes being run]'
107+
'soft-float[Generate software floating point library calls]'
108+
'time-llvm-passes[measure time of each LLVM pass]'
109+
'time-passes[measure time of each rustc pass]'
110+
'trans-stats[gather trans statistics]'
111+
'verbose[in general, enable more debug printouts]'
82112
)
83113

84114
_rustc_opts_fun_lint(){

branches/try2/src/libarena/lib.rs

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,38 @@ extern mod extra;
2727
use extra::list::{List, Cons, Nil};
2828
use extra::list;
2929

30-
use std::at_vec;
3130
use std::cast::{transmute, transmute_mut, transmute_mut_region};
3231
use std::cast;
3332
use std::cell::{Cell, RefCell};
3433
use std::num;
3534
use std::ptr;
3635
use std::kinds::marker;
3736
use std::mem;
37+
use std::rc::Rc;
3838
use std::rt::global_heap;
3939
use std::unstable::intrinsics::{TyDesc, get_tydesc};
4040
use std::unstable::intrinsics;
4141
use std::util;
42+
use std::vec;
4243

4344
// The way arena uses arrays is really deeply awful. The arrays are
4445
// allocated, and have capacities reserved, but the fill for the array
4546
// will always stay at 0.
4647
#[deriving(Clone)]
4748
struct Chunk {
48-
data: RefCell<@[u8]>,
49+
data: Rc<RefCell<~[u8]>>,
4950
fill: Cell<uint>,
5051
is_pod: Cell<bool>,
5152
}
53+
impl Chunk {
54+
fn capacity(&self) -> uint {
55+
self.data.borrow().borrow().get().capacity()
56+
}
57+
58+
unsafe fn as_ptr(&self) -> *u8 {
59+
self.data.borrow().borrow().get().as_ptr()
60+
}
61+
}
5262

5363
// Arenas are used to quickly allocate objects that share a
5464
// lifetime. The arena uses ~[u8] vectors as a backing store to
@@ -97,10 +107,8 @@ impl Arena {
97107
}
98108

99109
fn chunk(size: uint, is_pod: bool) -> Chunk {
100-
let mut v: @[u8] = @[];
101-
unsafe { at_vec::raw::reserve(&mut v, size); }
102110
Chunk {
103-
data: RefCell::new(unsafe { cast::transmute(v) }),
111+
data: Rc::new(RefCell::new(vec::with_capacity(size))),
104112
fill: Cell::new(0u),
105113
is_pod: Cell::new(is_pod),
106114
}
@@ -131,10 +139,7 @@ fn round_up(base: uint, align: uint) -> uint {
131139
// in it.
132140
unsafe fn destroy_chunk(chunk: &Chunk) {
133141
let mut idx = 0;
134-
let buf = {
135-
let data = chunk.data.borrow();
136-
data.get().as_ptr()
137-
};
142+
let buf = chunk.as_ptr();
138143
let fill = chunk.fill.get();
139144

140145
while idx < fill {
@@ -172,11 +177,13 @@ unsafe fn un_bitpack_tydesc_ptr(p: uint) -> (*TyDesc, bool) {
172177
}
173178

174179
impl Arena {
180+
fn chunk_size(&self) -> uint {
181+
self.pod_head.capacity()
182+
}
175183
// Functions for the POD part of the arena
176184
fn alloc_pod_grow(&mut self, n_bytes: uint, align: uint) -> *u8 {
177185
// Allocate a new chunk.
178-
let chunk_size = at_vec::capacity(self.pod_head.data.get());
179-
let new_min_chunk_size = num::max(n_bytes, chunk_size);
186+
let new_min_chunk_size = num::max(n_bytes, self.chunk_size());
180187
self.chunks.set(@Cons(self.pod_head.clone(), self.chunks.get()));
181188
self.pod_head =
182189
chunk(num::next_power_of_two(new_min_chunk_size + 1u), true);
@@ -190,15 +197,15 @@ impl Arena {
190197
let this = transmute_mut_region(self);
191198
let start = round_up(this.pod_head.fill.get(), align);
192199
let end = start + n_bytes;
193-
if end > at_vec::capacity(this.pod_head.data.get()) {
200+
if end > self.chunk_size() {
194201
return this.alloc_pod_grow(n_bytes, align);
195202
}
196203
this.pod_head.fill.set(end);
197204

198205
//debug!("idx = {}, size = {}, align = {}, fill = {}",
199206
// start, n_bytes, align, head.fill.get());
200207

201-
ptr::offset(this.pod_head.data.get().as_ptr(), start as int)
208+
this.pod_head.as_ptr().offset(start as int)
202209
}
203210
}
204211

@@ -217,8 +224,7 @@ impl Arena {
217224
fn alloc_nonpod_grow(&mut self, n_bytes: uint, align: uint)
218225
-> (*u8, *u8) {
219226
// Allocate a new chunk.
220-
let chunk_size = at_vec::capacity(self.head.data.get());
221-
let new_min_chunk_size = num::max(n_bytes, chunk_size);
227+
let new_min_chunk_size = num::max(n_bytes, self.chunk_size());
222228
self.chunks.set(@Cons(self.head.clone(), self.chunks.get()));
223229
self.head =
224230
chunk(num::next_power_of_two(new_min_chunk_size + 1u), false);
@@ -244,7 +250,7 @@ impl Arena {
244250
end = start + n_bytes;
245251
}
246252

247-
if end > at_vec::capacity(self.head.data.get()) {
253+
if end > self.head.capacity() {
248254
return self.alloc_nonpod_grow(n_bytes, align);
249255
}
250256

@@ -254,7 +260,7 @@ impl Arena {
254260
//debug!("idx = {}, size = {}, align = {}, fill = {}",
255261
// start, n_bytes, align, head.fill);
256262

257-
let buf = self.head.data.get().as_ptr();
263+
let buf = self.head.as_ptr();
258264
return (ptr::offset(buf, tydesc_start as int), ptr::offset(buf, start as int));
259265
}
260266
}
@@ -606,5 +612,3 @@ mod test {
606612
})
607613
}
608614
}
609-
610-

branches/try2/src/libextra/num/bigint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub mod BigDigit {
8080
/**
8181
A big unsigned integer type.
8282
83-
A `BigUint`-typed value `BigUint { data: @[a, b, c] }` represents a number
83+
A `BigUint`-typed value `BigUint { data: ~[a, b, c] }` represents a number
8484
`(a + b * BigDigit::base + c * BigDigit::base^2)`.
8585
*/
8686
#[deriving(Clone)]

branches/try2/src/libextra/ringbuf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl<'a, T> Iterator<&'a mut T> for MutItems<'a, T> {
303303
&mut self.remaining2
304304
};
305305
self.nelts -= 1;
306-
Some(r.mut_shift_ref().get_mut_ref())
306+
Some(r.mut_shift_ref().unwrap().get_mut_ref())
307307
}
308308

309309
#[inline]
@@ -325,7 +325,7 @@ impl<'a, T> DoubleEndedIterator<&'a mut T> for MutItems<'a, T> {
325325
&mut self.remaining1
326326
};
327327
self.nelts -= 1;
328-
Some(r.mut_pop_ref().get_mut_ref())
328+
Some(r.mut_pop_ref().unwrap().get_mut_ref())
329329
}
330330
}
331331

branches/try2/src/libextra/serialize.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Core encoding and decoding interfaces.
1818
#[forbid(non_camel_case_types)];
1919

2020

21-
use std::at_vec;
2221
use std::hashmap::{HashMap, HashSet};
2322
use std::rc::Rc;
2423
use std::trie::{TrieMap, TrieSet};
@@ -310,18 +309,6 @@ impl<D:Decoder> Decodable<D> for ~str {
310309
}
311310
}
312311

313-
impl<S:Encoder> Encodable<S> for @str {
314-
fn encode(&self, s: &mut S) {
315-
s.emit_str(*self)
316-
}
317-
}
318-
319-
impl<D:Decoder> Decodable<D> for @str {
320-
fn decode(d: &mut D) -> @str {
321-
d.read_str().to_managed()
322-
}
323-
}
324-
325312
impl<S:Encoder> Encodable<S> for f32 {
326313
fn encode(&self, s: &mut S) {
327314
s.emit_f32(*self)
@@ -456,26 +443,6 @@ impl<D:Decoder,T:Decodable<D>> Decodable<D> for ~[T] {
456443
}
457444
}
458445

459-
impl<S:Encoder,T:Encodable<S>> Encodable<S> for @[T] {
460-
fn encode(&self, s: &mut S) {
461-
s.emit_seq(self.len(), |s| {
462-
for (i, e) in self.iter().enumerate() {
463-
s.emit_seq_elt(i, |s| e.encode(s))
464-
}
465-
})
466-
}
467-
}
468-
469-
impl<D:Decoder,T:Decodable<D>> Decodable<D> for @[T] {
470-
fn decode(d: &mut D) -> @[T] {
471-
d.read_seq(|d, len| {
472-
at_vec::from_fn(len, |i| {
473-
d.read_seq_elt(i, |d| Decodable::decode(d))
474-
})
475-
})
476-
}
477-
}
478-
479446
impl<S:Encoder,T:Encodable<S>> Encodable<S> for Option<T> {
480447
fn encode(&self, s: &mut S) {
481448
s.emit_option(|s| {

0 commit comments

Comments
 (0)