Skip to content

Commit 71c77fc

Browse files
committed
---
yaml --- r: 34334 b: refs/heads/snap-stage3 c: 5b2b13b h: refs/heads/master v: v3
1 parent fc28bde commit 71c77fc

File tree

277 files changed

+2950
-882
lines changed

Some content is hidden

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

277 files changed

+2950
-882
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: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 5ec3aba8cc977f5b396a8e2636bd0ddbbfa9af66
4+
refs/heads/snap-stage3: 5b2b13bff81d341f243a9a902d8779ef82e2d7fd
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## Pull request procedure
2+
3+
Pull requests should be targeted at Rust's `incoming` branch (note that by default Github will aim them at the `master` branch) -- see "Changing The Commit Range and Destination Repository" in Github's documentation on [pull requests](https://help.github.com/articles/using-pull-requests). Before pushing to your Github repo and issuing the pull request, please do two things:
4+
5+
1. [Rebase](http://git-scm.com/book/en/Git-Branching-Rebasing) your local changes against the `incoming` branch. Resolve any conflicts that arise.
6+
2. Run the full Rust test suite with the `make check` command. You're not off the hook even if you just stick to documentation; code examples in the docs are tested as well!
7+
8+
Pull requests will be treated as "review requests", and we will give feedback we expect to see corrected on [style](https://github.com/mozilla/rust/wiki/Note-style-guide) and substance before pulling. Changes contributed via pull request should focus on a single issue at a time, like any other. We will not look kindly on pull-requests that try to "sneak" unrelated changes in.
9+
10+
Normally, all pull requests must include regression tests (see [[Note-testsuite]]) that test your change. Occasionally, a change will be very difficult to test for. In those cases, please include a note in your commit message explaining why.
11+
12+
For more details, please refer to [[Note-development-policy]].

branches/snap-stage3/doc/rust.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,19 @@ let mut a: Animal = Dog;
11071107
a = Cat;
11081108
~~~~
11091109

1110+
Enumeration constructors can have either named or unnamed fields:
1111+
~~~~
1112+
enum Animal {
1113+
Dog (~str, float),
1114+
Cat { name: ~str, weight: float }
1115+
}
1116+
1117+
let mut a: Animal = Dog(~"Cocoa", 37.2);
1118+
a = Cat{ name: ~"Spotty", weight: 2.7 };
1119+
~~~~
1120+
1121+
In this example, `Cat` is a _struct-like enum variant_,
1122+
whereas `Dog` is simply called an enum variant.
11101123
### Constants
11111124

11121125
~~~~~~~~ {.ebnf .gram}

branches/snap-stage3/doc/tutorial.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,24 @@ fn point_from_direction(dir: Direction) -> Point {
733733
}
734734
~~~~
735735

736+
A special kind of enum variant, called _struct-like enums_,
737+
can have its fields extracted with dot notation and not just destructuring.
738+
For example:
739+
740+
~~~~
741+
# struct Point {x: float, y: float}
742+
# fn square(x: float) -> float { x * x }
743+
enum Shape {
744+
Circle { center: Point, radius: float },
745+
Rectangle { left: Point, right: Point }
746+
}
747+
fn area(sh: Shape) -> float {
748+
match sh {
749+
Circle(c) => float::consts::pi * square(c.radius),
750+
Rectangle(r) => r.right.x - r.left.x * r.right.y - r.right.y
751+
}
752+
}
753+
~~~~
736754
## Tuples
737755

738756
Tuples in Rust behave exactly like structs, except that their fields

branches/snap-stage3/src/compiletest/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ fn parse_expected(line_num: uint, line: ~str) -> ~[expected_error] unsafe {
3333
let error_tag = ~"//~";
3434
let mut idx;
3535
match str::find_str(line, error_tag) {
36-
option::None => return ~[],
37-
option::Some(nn) => { idx = (nn as uint) + str::len(error_tag); }
36+
None => return ~[],
37+
Some(nn) => { idx = (nn as uint) + str::len(error_tag); }
3838
}
3939

4040
// "//~^^^ kind msg" denotes a message expected

branches/snap-stage3/src/compiletest/header.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ fn load_props(testfile: &Path) -> test_props {
3434
let mut error_patterns = ~[];
3535
let mut aux_builds = ~[];
3636
let mut exec_env = ~[];
37-
let mut compile_flags = option::None;
38-
let mut pp_exact = option::None;
37+
let mut compile_flags = None;
38+
let mut pp_exact = None;
3939
for iter_header(testfile) |ln| {
4040
match parse_error_pattern(ln) {
41-
option::Some(ep) => error_patterns.push(ep),
42-
option::None => ()
41+
Some(ep) => error_patterns.push(ep),
42+
None => ()
4343
};
4444

4545
if compile_flags.is_none() {
@@ -124,12 +124,12 @@ fn parse_exec_env(line: ~str) -> Option<(~str, ~str)> {
124124

125125
fn parse_pp_exact(line: ~str, testfile: &Path) -> Option<Path> {
126126
match parse_name_value_directive(line, ~"pp-exact") {
127-
option::Some(s) => option::Some(Path(s)),
128-
option::None => {
127+
Some(s) => Some(Path(s)),
128+
None => {
129129
if parse_name_directive(line, ~"pp-exact") {
130-
option::Some(testfile.file_path())
130+
Some(testfile.file_path())
131131
} else {
132-
option::None
132+
None
133133
}
134134
}
135135
}
@@ -143,12 +143,12 @@ fn parse_name_value_directive(line: ~str,
143143
directive: ~str) -> Option<~str> unsafe {
144144
let keycolon = directive + ~":";
145145
match str::find_str(line, keycolon) {
146-
option::Some(colon) => {
146+
Some(colon) => {
147147
let value = str::slice(line, colon + str::len(keycolon),
148148
str::len(line));
149149
debug!("%s: %s", directive, value);
150-
option::Some(value)
150+
Some(value)
151151
}
152-
option::None => option::None
152+
None => None
153153
}
154154
}

branches/snap-stage3/src/compiletest/runtest.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ fn run_pretty_test(config: config, props: test_props, testfile: &Path) {
117117
} else { logv(config, ~"testing for converging pretty-printing"); }
118118

119119
let rounds =
120-
match props.pp_exact { option::Some(_) => 1, option::None => 2 };
120+
match props.pp_exact { Some(_) => 1, None => 2 };
121121

122122
let mut srcs = ~[io::read_whole_file_str(testfile).get()];
123123

@@ -137,11 +137,11 @@ fn run_pretty_test(config: config, props: test_props, testfile: &Path) {
137137

138138
let mut expected =
139139
match props.pp_exact {
140-
option::Some(file) => {
140+
Some(file) => {
141141
let filepath = testfile.dir_path().push_rel(&file);
142142
io::read_whole_file_str(&filepath).get()
143143
}
144-
option::None => { srcs[vec::len(srcs) - 2u] }
144+
None => { srcs[vec::len(srcs) - 2u] }
145145
};
146146
let mut actual = srcs[vec::len(srcs) - 1u];
147147

@@ -165,7 +165,7 @@ fn run_pretty_test(config: config, props: test_props, testfile: &Path) {
165165

166166
fn print_source(config: config, testfile: &Path, src: ~str) -> procres {
167167
compose_and_run(config, testfile, make_pp_args(config, testfile),
168-
~[], config.compile_lib_path, option::Some(src))
168+
~[], config.compile_lib_path, Some(src))
169169
}
170170

171171
fn make_pp_args(config: config, _testfile: &Path) -> procargs {
@@ -199,7 +199,7 @@ actual:\n\
199199
compose_and_run_compiler(
200200
config, props, testfile,
201201
make_typecheck_args(config, testfile),
202-
option::Some(src))
202+
Some(src))
203203
}
204204

205205
fn make_typecheck_args(config: config, testfile: &Path) -> procargs {
@@ -418,7 +418,7 @@ fn exec_compiled_test(config: config, props: test_props,
418418
compose_and_run(config, testfile,
419419
make_run_args(config, props, testfile),
420420
props.exec_env,
421-
config.run_lib_path, option::None)
421+
config.run_lib_path, None)
422422
}
423423

424424
fn compose_and_run_compiler(
@@ -441,7 +441,7 @@ fn compose_and_run_compiler(
441441
make_compile_args(config, props, ~[~"--lib"] + extra_link_args,
442442
|a,b| make_lib_name(a, b, testfile), &abs_ab);
443443
let auxres = compose_and_run(config, &abs_ab, aux_args, ~[],
444-
config.compile_lib_path, option::None);
444+
config.compile_lib_path, None);
445445
if auxres.status != 0 {
446446
fatal_procres(
447447
fmt!("auxiliary build of %s failed to compile: ",
@@ -501,8 +501,8 @@ fn make_run_args(config: config, _props: test_props, testfile: &Path) ->
501501
// then split apart its command
502502
let runtool =
503503
match config.runtool {
504-
option::Some(s) => option::Some(s),
505-
option::None => option::None
504+
Some(s) => Some(s),
505+
None => None
506506
};
507507
split_maybe_args(runtool)
508508
};
@@ -517,8 +517,8 @@ fn split_maybe_args(argstr: Option<~str>) -> ~[~str] {
517517
}
518518

519519
match argstr {
520-
option::Some(s) => rm_whitespace(str::split_char(s, ' ')),
521-
option::None => ~[]
520+
Some(s) => rm_whitespace(str::split_char(s, ' ')),
521+
None => ~[]
522522
}
523523
}
524524

branches/snap-stage3/src/compiletest/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ fn make_new_path(path: ~str) -> ~str {
1717
// Windows just uses PATH as the library search path, so we have to
1818
// maintain the current value while adding our own
1919
match getenv(lib_path_env_var()) {
20-
option::Some(curr) => {
20+
Some(curr) => {
2121
fmt!("%s%s%s", path, path_div(), curr)
2222
}
23-
option::None => path
23+
None => path
2424
}
2525
}
2626

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
extern mod core(vers = "0.6");
1313

1414
#[cfg(cargo)]
15-
extern mod self(name = "cargo", vers = "0.6");
15+
extern mod this(name = "cargo", vers = "0.6");
1616

1717
#[cfg(fuzzer)]
18-
extern mod self(name = "fuzzer", vers = "0.6");
18+
extern mod this(name = "fuzzer", vers = "0.6");
1919

2020
#[cfg(rustdoc)]
21-
extern mod self(name = "rustdoc", vers = "0.6");
21+
extern mod this(name = "rustdoc", vers = "0.6");
2222

2323
#[cfg(rusti)]
24-
extern mod self(name = "rusti", vers = "0.6");
24+
extern mod this(name = "rusti", vers = "0.6");
2525

2626
#[cfg(rustc)]
27-
extern mod self(name = "rustc", vers = "0.6");
27+
extern mod this(name = "rustc", vers = "0.6");
2828

29-
fn main() { self::main() }
29+
fn main() { this::main() }

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

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

77
if version < 600
88
syntax clear
@@ -44,8 +44,8 @@ syn keyword rustType off_t dev_t ino_t pid_t mode_t ssize_t
4444

4545
syn keyword rustTrait Const Copy Send Owned " inherent traits
4646
syn keyword rustTrait Eq Ord Num Ptr
47-
syn keyword rustTrait Add Sub Mul Div Modulo Neg BitAnd BitOr BitXor
48-
syn keyword rustTrait Shl Shr Index
47+
syn keyword rustTrait Drop Add Sub Mul Div Modulo Neg BitAnd BitOr
48+
syn keyword rustTrait BitXor Shl Shr Index
4949

5050
syn keyword rustSelf self
5151
syn keyword rustBoolean true false

branches/snap-stage3/src/libcargo/pgp.rs

Lines changed: 3 additions & 0 deletions
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+
use core::os;
12+
use core::run;
13+
1114
fn gpgv(args: ~[~str]) -> { status: int, out: ~str, err: ~str } {
1215
return run::program_output(~"gpgv", args);
1316
}

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,26 @@
1515
#[forbid(deprecated_pattern)];
1616

1717
use cast::transmute;
18+
use iter;
19+
use libc;
1820
use ptr::addr_of;
21+
use sys;
22+
use uint;
23+
use vec;
1924

2025
/// Code for dealing with @-vectors. This is pretty incomplete, and
2126
/// contains a bunch of duplication from the code for ~-vectors.
2227
2328
#[abi = "cdecl"]
24-
extern mod rustrt {
29+
pub extern mod rustrt {
2530
#[legacy_exports];
2631
fn vec_reserve_shared_actual(++t: *sys::TypeDesc,
2732
++v: **vec::raw::VecRepr,
2833
++n: libc::size_t);
2934
}
3035

3136
#[abi = "rust-intrinsic"]
32-
extern mod rusti {
37+
pub extern mod rusti {
3338
#[legacy_exports];
3439
fn move_val_init<T>(dst: &mut T, -src: T);
3540
}
@@ -157,6 +162,13 @@ pub mod traits {
157162
pub mod traits {}
158163

159164
pub mod raw {
165+
use at_vec::{rusti, rustrt};
166+
use libc;
167+
use ptr;
168+
use sys;
169+
use uint;
170+
use vec;
171+
160172
pub type VecRepr = vec::raw::VecRepr;
161173
pub type SliceRepr = vec::raw::SliceRepr;
162174

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
//! Boolean logic
1818
19+
use bool;
20+
use cmp;
1921
use cmp::Eq;
2022

2123
/// Negation / inverse

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@
1414
#[forbid(deprecated_mode)];
1515
#[forbid(deprecated_pattern)];
1616

17+
use char;
1718
use cmp::Eq;
19+
use str;
20+
use u32;
21+
use uint;
22+
use unicode;
1823

1924
/*
2025
Lu Uppercase_Letter an uppercase letter

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

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

11+
use task;
12+
1113
// helper for transmutation, shown below.
1214
type RustClosure = (int,int);
1315
pub struct Handler<T, U> {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ mod stackwalk;
235235
// 'core' so that macro-expanded references to core::error and such
236236
// can be resolved within libcore.
237237
#[doc(hidden)] // FIXME #3538
238-
mod core {
238+
pub mod core {
239239
pub const error : u32 = 1_u32;
240240
pub const warn : u32 = 2_u32;
241241
pub const info : u32 = 3_u32;

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ Do not use ==, !=, <, etc on doubly-linked lists -- it may not terminate.
2222
#[forbid(deprecated_mode)];
2323
#[forbid(deprecated_pattern)];
2424

25+
use managed;
26+
use option;
27+
use vec;
28+
2529
type DListLink<T> = Option<DListNode<T>>;
2630

2731
enum DListNode<T> = @{
@@ -469,6 +473,10 @@ impl<T: Copy> DList<T> {
469473
#[cfg(test)]
470474
mod tests {
471475
#[legacy_exports];
476+
477+
use iter;
478+
use vec;
479+
472480
#[test]
473481
fn test_dlist_concat() {
474482
let a = from_vec(~[1,2]);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ Note that recursive use is not permitted.
2323
#[forbid(deprecated_mode)];
2424
#[forbid(deprecated_pattern)];
2525

26+
use cast;
2627
use cast::reinterpret_cast;
2728
use ptr::null;
29+
use vec;
2830

2931
/**
3032
* A growable, modifiable vector type that accumulates elements into a

0 commit comments

Comments
 (0)