Skip to content

Commit f900cd1

Browse files
committed
---
yaml --- r: 148820 b: refs/heads/try2 c: e704561 h: refs/heads/master v: v3
1 parent ac84fcc commit f900cd1

File tree

173 files changed

+2771
-2371
lines changed

Some content is hidden

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

173 files changed

+2771
-2371
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: 3e39e3e80dcf726a96ec0fe778f96e2a9dde620b
8+
refs/heads/try2: e704561003311daa5239e796b31bb4ade0a9eb3d
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` or `~str`.
3082+
such as `&str`, `@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]` or `~[T]`.
3118+
such as `&[T]`, `@[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: 40 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -5,110 +5,80 @@ 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.]'
108
--bin'[Compile an executable crate (default)]'
119
-c'[Compile and assemble, but do not link]'
1210
--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]'
1811
--emit-llvm'[Produce an LLVM bitcode file]'
1912
{-h,--help}'[Display this message]'
2013
-L'[Add a directory to the library search path]'
2114
--lib'[Compile a library crate]'
2215
--linker'[Program to use for linking instead of the default.]'
2316
--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]'
2517
--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]'
2818
--no-trans'[Run all passes except translation; no output]'
2919
-O'[Equivalent to --opt-level=2]'
3020
-o'[Write output to <filename>]'
3121
--opt-level'[Optimize with possible levels 0-3]'
3222
--out-dir'[Write output to compiler-chosen filename in <dir>]'
3323
--parse-only'[Parse only; do not compile, assemble, or link]'
34-
--passes'[Comma or space separated list of pass names to use]'
3524
--pretty'[Pretty-print the input instead of compiling]'
36-
--rlib'[Compile a rust library crate as an rlib file]'
3725
-S'[Compile only; do not assemble or link]'
3826
--save-temps'[Write intermediate files (.bc, .opt.bc, .o) in addition to normal output]'
39-
--staticlib'[Compile a static library crate]'
4027
--sysroot'[Override the system root]'
4128
--test'[Build a test harness]'
4229
--target'[Target triple cpu-manufacturer-kernel\[-os\] to compile]'
4330
--target-cpu'[Select target processor (llc -mcpu=help for details)]'
4431
--target-feature'[Target specific attributes (llc -mattr=help for details)]'
32+
--android-cross-path'[The path to the Android NDK]'
4533
{-v,--version}'[Print version info and exit]'
4634
)
4735
_rustc_opts_lint=(
48-
'attribute-usage[detects bad use of attributes]'
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]'
4939
'ctypes[proper use of std::libc types in foreign modules]'
50-
'dead-assignment[detect assignments that will never be read]'
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]'
40+
"unused-mut[detect mut variables which don't need to be mutable]"
41+
'unused-imports[imports that are never used]'
5542
'heap-memory[use of any (~ type or @ type) heap memory]'
56-
'managed-heap-memory[use of managed (@ type) heap memory]'
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]'
61-
'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]'
43+
'default-methods[allow default methods]'
44+
'unused-variable[detect variables which are not used in any way]'
45+
'dead-assignment[detect assignments that will never be read]'
7246
'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]'
47+
'type-limits[comparisons made useless by limits of the types involved]'
7948
'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 { }`]'
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+
'managed-heap-memory[use of managed (@ type) heap memory]'
52+
'unnecessary-allocation[detects unnecessary allocations that can be eliminated]'
53+
'owned-heap-memory[use of owned (~ type) heap memory]'
8354
)
8455

8556
_rustc_opts_debug=(
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]'
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'
11282
)
11383

11484
_rustc_opts_fun_lint(){

branches/try2/src/libarena/lib.rs

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

30+
use std::at_vec;
3031
use std::cast::{transmute, transmute_mut, transmute_mut_region};
3132
use std::cast;
3233
use std::cell::{Cell, RefCell};
3334
use std::num;
3435
use std::ptr;
3536
use std::kinds::marker;
3637
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;
4342

4443
// The way arena uses arrays is really deeply awful. The arrays are
4544
// allocated, and have capacities reserved, but the fill for the array
4645
// will always stay at 0.
4746
#[deriving(Clone)]
4847
struct Chunk {
49-
data: Rc<RefCell<~[u8]>>,
48+
data: RefCell<@[u8]>,
5049
fill: Cell<uint>,
5150
is_pod: Cell<bool>,
5251
}
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-
}
6252

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

10999
fn chunk(size: uint, is_pod: bool) -> Chunk {
100+
let mut v: @[u8] = @[];
101+
unsafe { at_vec::raw::reserve(&mut v, size); }
110102
Chunk {
111-
data: Rc::new(RefCell::new(vec::with_capacity(size))),
103+
data: RefCell::new(unsafe { cast::transmute(v) }),
112104
fill: Cell::new(0u),
113105
is_pod: Cell::new(is_pod),
114106
}
@@ -139,7 +131,10 @@ fn round_up(base: uint, align: uint) -> uint {
139131
// in it.
140132
unsafe fn destroy_chunk(chunk: &Chunk) {
141133
let mut idx = 0;
142-
let buf = chunk.as_ptr();
134+
let buf = {
135+
let data = chunk.data.borrow();
136+
data.get().as_ptr()
137+
};
143138
let fill = chunk.fill.get();
144139

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

179174
impl Arena {
180-
fn chunk_size(&self) -> uint {
181-
self.pod_head.capacity()
182-
}
183175
// Functions for the POD part of the arena
184176
fn alloc_pod_grow(&mut self, n_bytes: uint, align: uint) -> *u8 {
185177
// Allocate a new chunk.
186-
let new_min_chunk_size = num::max(n_bytes, self.chunk_size());
178+
let chunk_size = at_vec::capacity(self.pod_head.data.get());
179+
let new_min_chunk_size = num::max(n_bytes, chunk_size);
187180
self.chunks.set(@Cons(self.pod_head.clone(), self.chunks.get()));
188181
self.pod_head =
189182
chunk(num::next_power_of_two(new_min_chunk_size + 1u), true);
@@ -197,15 +190,15 @@ impl Arena {
197190
let this = transmute_mut_region(self);
198191
let start = round_up(this.pod_head.fill.get(), align);
199192
let end = start + n_bytes;
200-
if end > self.chunk_size() {
193+
if end > at_vec::capacity(this.pod_head.data.get()) {
201194
return this.alloc_pod_grow(n_bytes, align);
202195
}
203196
this.pod_head.fill.set(end);
204197

205198
//debug!("idx = {}, size = {}, align = {}, fill = {}",
206199
// start, n_bytes, align, head.fill.get());
207200

208-
this.pod_head.as_ptr().offset(start as int)
201+
ptr::offset(this.pod_head.data.get().as_ptr(), start as int)
209202
}
210203
}
211204

@@ -224,7 +217,8 @@ impl Arena {
224217
fn alloc_nonpod_grow(&mut self, n_bytes: uint, align: uint)
225218
-> (*u8, *u8) {
226219
// Allocate a new chunk.
227-
let new_min_chunk_size = num::max(n_bytes, self.chunk_size());
220+
let chunk_size = at_vec::capacity(self.head.data.get());
221+
let new_min_chunk_size = num::max(n_bytes, chunk_size);
228222
self.chunks.set(@Cons(self.head.clone(), self.chunks.get()));
229223
self.head =
230224
chunk(num::next_power_of_two(new_min_chunk_size + 1u), false);
@@ -250,7 +244,7 @@ impl Arena {
250244
end = start + n_bytes;
251245
}
252246

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

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

263-
let buf = self.head.as_ptr();
257+
let buf = self.head.data.get().as_ptr();
264258
return (ptr::offset(buf, tydesc_start as int), ptr::offset(buf, start as int));
265259
}
266260
}
@@ -612,3 +606,5 @@ mod test {
612606
})
613607
}
614608
}
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().unwrap().get_mut_ref())
306+
Some(r.mut_shift_ref().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().unwrap().get_mut_ref())
328+
Some(r.mut_pop_ref().get_mut_ref())
329329
}
330330
}
331331

branches/try2/src/libextra/serialize.rs

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

2020

21+
use std::at_vec;
2122
use std::hashmap::{HashMap, HashSet};
2223
use std::rc::Rc;
2324
use std::trie::{TrieMap, TrieSet};
@@ -309,6 +310,18 @@ impl<D:Decoder> Decodable<D> for ~str {
309310
}
310311
}
311312

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+
312325
impl<S:Encoder> Encodable<S> for f32 {
313326
fn encode(&self, s: &mut S) {
314327
s.emit_f32(*self)
@@ -443,6 +456,26 @@ impl<D:Decoder,T:Decodable<D>> Decodable<D> for ~[T] {
443456
}
444457
}
445458

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+
446479
impl<S:Encoder,T:Encodable<S>> Encodable<S> for Option<T> {
447480
fn encode(&self, s: &mut S) {
448481
s.emit_option(|s| {

0 commit comments

Comments
 (0)