Skip to content

Commit af576f6

Browse files
author
Jakub Bukaj
committed
---
yaml --- r: 159453 b: refs/heads/master c: 6309d6e h: refs/heads/master i: 159451: 481608a v: v3
1 parent 9e9aa34 commit af576f6

File tree

709 files changed

+5904
-4701
lines changed

Some content is hidden

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

709 files changed

+5904
-4701
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: eb9684ee19e1d79999b9809704fbffe072332e7b
2+
refs/heads/master: 6309d6e66ee7d1d2f7b0304714012350555c319b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 9c96a79a74f10bed18b031ce0ac4126c56d6cfb3
55
refs/heads/try: f58aad6dce273570fb130b4df008ef9acd5a5be2

trunk/src/compiletest/common.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10+
pub use self::Mode::*;
1011

11-
use std::from_str::FromStr;
1212
use std::fmt;
13+
use std::str::FromStr;
1314
use regex::Regex;
1415

1516
#[deriving(Clone, PartialEq)]

trunk/src/compiletest/compiletest.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
#![crate_type = "bin"]
12-
#![feature(phase, slicing_syntax)]
12+
#![feature(phase, slicing_syntax, globs)]
1313

1414
#![deny(warnings)]
1515

@@ -22,7 +22,7 @@ extern crate regex;
2222
use std::os;
2323
use std::io;
2424
use std::io::fs;
25-
use std::from_str::FromStr;
25+
use std::str::FromStr;
2626
use getopts::{optopt, optflag, reqopt};
2727
use common::Config;
2828
use common::{Pretty, DebugInfoGdb, DebugInfoLldb, Codegen};

trunk/src/compiletest/header.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ use common::Config;
1212
use common;
1313
use util;
1414

15-
use std::from_str::FromStr;
16-
1715
pub struct TestProps {
1816
// Lines that should be expected, in order, on standard out
1917
pub error_patterns: Vec<String> ,
@@ -353,8 +351,8 @@ pub fn gdb_version_to_int(version_string: &str) -> int {
353351
panic!("{}", error_string);
354352
}
355353

356-
let major: int = FromStr::from_str(components[0]).expect(error_string);
357-
let minor: int = FromStr::from_str(components[1]).expect(error_string);
354+
let major: int = from_str(components[0]).expect(error_string);
355+
let minor: int = from_str(components[1]).expect(error_string);
358356

359357
return major * 1000 + minor;
360358
}
@@ -364,6 +362,6 @@ pub fn lldb_version_to_int(version_string: &str) -> int {
364362
"Encountered LLDB version string with unexpected format: {}",
365363
version_string);
366364
let error_string = error_string.as_slice();
367-
let major: int = FromStr::from_str(version_string).expect(error_string);
365+
let major: int = from_str(version_string).expect(error_string);
368366
return major;
369367
}

trunk/src/compiletest/runtest.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10+
#[cfg(not(stage0))]
11+
use self::TargetLocation::*;
1012

1113
use common::Config;
1214
use common::{CompileFail, Pretty, RunFail, RunPass, RunPassValgrind, DebugInfoGdb};
@@ -399,7 +401,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
399401
procsrv::run("",
400402
config.adb_path.as_slice(),
401403
None,
402-
[
404+
&[
403405
"push".to_string(),
404406
exe_file.as_str().unwrap().to_string(),
405407
config.adb_test_dir.clone()
@@ -411,7 +413,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
411413
procsrv::run("",
412414
config.adb_path.as_slice(),
413415
None,
414-
[
416+
&[
415417
"forward".to_string(),
416418
"tcp:5039".to_string(),
417419
"tcp:5039".to_string()
@@ -432,7 +434,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
432434
config.adb_path
433435
.as_slice(),
434436
None,
435-
[
437+
&[
436438
"shell".to_string(),
437439
adb_arg.clone()
438440
],
@@ -746,7 +748,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
746748
cmd.arg(lldb_script_path)
747749
.arg(test_executable)
748750
.arg(debugger_script)
749-
.env_set_all([("PYTHONPATH", config.lldb_python_dir.clone().unwrap().as_slice())]);
751+
.env_set_all(&[("PYTHONPATH", config.lldb_python_dir.clone().unwrap().as_slice())]);
750752

751753
let (status, out, err) = match cmd.spawn() {
752754
Ok(process) => {
@@ -1142,11 +1144,11 @@ struct ProcRes {
11421144

11431145
fn compile_test(config: &Config, props: &TestProps,
11441146
testfile: &Path) -> ProcRes {
1145-
compile_test_(config, props, testfile, [])
1147+
compile_test_(config, props, testfile, &[])
11461148
}
11471149

11481150
fn jit_test(config: &Config, props: &TestProps, testfile: &Path) -> ProcRes {
1149-
compile_test_(config, props, testfile, ["--jit".to_string()])
1151+
compile_test_(config, props, testfile, &["--jit".to_string()])
11501152
}
11511153

11521154
fn compile_test_(config: &Config, props: &TestProps,
@@ -1507,7 +1509,7 @@ fn _arm_exec_compiled_test(config: &Config,
15071509
let copy_result = procsrv::run("",
15081510
config.adb_path.as_slice(),
15091511
None,
1510-
[
1512+
&[
15111513
"push".to_string(),
15121514
args.prog.clone(),
15131515
config.adb_test_dir.clone()
@@ -1624,7 +1626,7 @@ fn _arm_push_aux_shared_library(config: &Config, testfile: &Path) {
16241626
let copy_result = procsrv::run("",
16251627
config.adb_path.as_slice(),
16261628
None,
1627-
[
1629+
&[
16281630
"push".to_string(),
16291631
file.as_str()
16301632
.unwrap()

trunk/src/doc/complement-design-faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ code should need to run is a stack.
9595
`match` being exhaustive has some useful properties. First, if every
9696
possibility is covered by the `match`, adding further variants to the `enum`
9797
in the future will prompt a compilation failure, rather than runtime panic.
98-
Second, it makes cost explicit. In general, only safe way to have a
98+
Second, it makes cost explicit. In general, the only safe way to have a
9999
non-exhaustive match would be to panic the task if nothing is matched, though
100100
it could fall through if the type of the `match` expression is `()`. This sort
101101
of hidden cost and special casing is against the language's philosophy. It's

trunk/src/doc/guide-lifetimes.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ copying.
308308
# }
309309
fn compute_area(shape: &Shape) -> f64 {
310310
match *shape {
311-
Circle(_, radius) => std::f64::consts::PI * radius * radius,
312-
Rectangle(_, ref size) => size.w * size.h
311+
Shape::Circle(_, radius) => std::f64::consts::PI * radius * radius,
312+
Shape::Rectangle(_, ref size) => size.w * size.h
313313
}
314314
}
315315
~~~
@@ -478,14 +478,14 @@ example:
478478
# a: &'r T, b: &'r T) -> &'r T {
479479
# if compute_area(shape) > threshold {a} else {b}
480480
# }
481-
// -+ r
482-
fn select_based_on_unit_circle<'r, T>( // |-+ B
483-
threshold: f64, a: &'r T, b: &'r T) -> &'r T { // | |
484-
// | |
485-
let shape = Circle(Point {x: 0., y: 0.}, 1.); // | |
486-
select(&shape, threshold, a, b) // | |
487-
} // |-+
488-
// -+
481+
// -+ r
482+
fn select_based_on_unit_circle<'r, T>( // |-+ B
483+
threshold: f64, a: &'r T, b: &'r T) -> &'r T { // | |
484+
// | |
485+
let shape = Shape::Circle(Point {x: 0., y: 0.}, 1.); // | |
486+
select(&shape, threshold, a, b) // | |
487+
} // |-+
488+
// -+
489489
~~~
490490

491491
In this call to `select()`, the lifetime of the first parameter shape

trunk/src/doc/guide-macros.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ doing nothing otherwise:
2222
~~~~
2323
# enum T { SpecialA(uint), SpecialB(uint) }
2424
# fn f() -> uint {
25-
# let input_1 = SpecialA(0);
26-
# let input_2 = SpecialA(0);
25+
# let input_1 = T::SpecialA(0);
26+
# let input_2 = T::SpecialA(0);
2727
match input_1 {
28-
SpecialA(x) => { return x; }
28+
T::SpecialA(x) => { return x; }
2929
_ => {}
3030
}
3131
// ...
3232
match input_2 {
33-
SpecialB(x) => { return x; }
33+
T::SpecialB(x) => { return x; }
3434
_ => {}
3535
}
3636
# return 0u;
@@ -49,20 +49,20 @@ the pattern in the above code:
4949
# #![feature(macro_rules)]
5050
# enum T { SpecialA(uint), SpecialB(uint) }
5151
# fn f() -> uint {
52-
# let input_1 = SpecialA(0);
53-
# let input_2 = SpecialA(0);
52+
# let input_1 = T::SpecialA(0);
53+
# let input_2 = T::SpecialA(0);
5454
macro_rules! early_return(
55-
($inp:expr $sp:ident) => ( // invoke it like `(input_5 SpecialE)`
55+
($inp:expr $sp:path) => ( // invoke it like `(input_5 SpecialE)`
5656
match $inp {
5757
$sp(x) => { return x; }
5858
_ => {}
5959
}
6060
);
6161
)
6262
// ...
63-
early_return!(input_1 SpecialA);
63+
early_return!(input_1 T::SpecialA);
6464
// ...
65-
early_return!(input_2 SpecialB);
65+
early_return!(input_2 T::SpecialB);
6666
# return 0;
6767
# }
6868
# fn main() {}
@@ -169,10 +169,10 @@ instead of `*` to mean "at least one".
169169
# #![feature(macro_rules)]
170170
# enum T { SpecialA(uint),SpecialB(uint),SpecialC(uint),SpecialD(uint)}
171171
# fn f() -> uint {
172-
# let input_1 = SpecialA(0);
173-
# let input_2 = SpecialA(0);
172+
# let input_1 = T::SpecialA(0);
173+
# let input_2 = T::SpecialA(0);
174174
macro_rules! early_return(
175-
($inp:expr, [ $($sp:ident)|+ ]) => (
175+
($inp:expr, [ $($sp:path)|+ ]) => (
176176
match $inp {
177177
$(
178178
$sp(x) => { return x; }
@@ -182,9 +182,9 @@ macro_rules! early_return(
182182
);
183183
)
184184
// ...
185-
early_return!(input_1, [SpecialA|SpecialC|SpecialD]);
185+
early_return!(input_1, [T::SpecialA|T::SpecialC|T::SpecialD]);
186186
// ...
187-
early_return!(input_2, [SpecialB]);
187+
early_return!(input_2, [T::SpecialB]);
188188
# return 0;
189189
# }
190190
# fn main() {}
@@ -234,9 +234,9 @@ Now consider code like the following:
234234
# enum T3 { Good2(uint), Bad2}
235235
# fn f(x: T1) -> uint {
236236
match x {
237-
Good1(g1, val) => {
237+
T1::Good1(g1, val) => {
238238
match g1.body {
239-
Good2(result) => {
239+
T3::Good2(result) => {
240240
// complicated stuff goes here
241241
return result + val;
242242
},
@@ -281,9 +281,9 @@ macro_rules! biased_match (
281281
# struct T2 { body: T3 }
282282
# enum T3 { Good2(uint), Bad2}
283283
# fn f(x: T1) -> uint {
284-
biased_match!((x) ~ (Good1(g1, val)) else { return 0 };
284+
biased_match!((x) ~ (T1::Good1(g1, val)) else { return 0 };
285285
binds g1, val )
286-
biased_match!((g1.body) ~ (Good2(result) )
286+
biased_match!((g1.body) ~ (T3::Good2(result) )
287287
else { panic!("Didn't get good_2") };
288288
binds result )
289289
// complicated stuff goes here
@@ -396,8 +396,8 @@ macro_rules! biased_match (
396396
# enum T3 { Good2(uint), Bad2}
397397
# fn f(x: T1) -> uint {
398398
biased_match!(
399-
(x) ~ (Good1(g1, val)) else { return 0 };
400-
(g1.body) ~ (Good2(result) ) else { panic!("Didn't get Good2") };
399+
(x) ~ (T1::Good1(g1, val)) else { return 0 };
400+
(g1.body) ~ (T3::Good2(result) ) else { panic!("Didn't get Good2") };
401401
binds val, result )
402402
// complicated stuff goes here
403403
return result + val;

trunk/src/doc/guide-pointers.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@ pass-by-reference. Basically, languages can make two choices (this is made
133133
up syntax, it's not Rust):
134134

135135
```{notrust,ignore}
136-
fn foo(x) {
136+
func foo(x) {
137137
x = 5
138138
}
139139
140-
fn main() {
140+
func main() {
141141
i = 1
142142
foo(i)
143143
// what is the value of i here?
@@ -153,11 +153,11 @@ So what do pointers have to do with this? Well, since pointers point to a
153153
location in memory...
154154

155155
```{notrust,ignore}
156-
fn foo(&int x) {
156+
func foo(&int x) {
157157
*x = 5
158158
}
159159
160-
fn main() {
160+
func main() {
161161
i = 1
162162
foo(&i)
163163
// what is the value of i here?
@@ -192,13 +192,13 @@ When you combine pointers and functions, it's easy to accidentally invalidate
192192
the memory the pointer is pointing to. For example:
193193

194194
```{notrust,ignore}
195-
fn make_pointer(): &int {
195+
func make_pointer(): &int {
196196
x = 5;
197197
198198
return &x;
199199
}
200200
201-
fn main() {
201+
func main() {
202202
&int i = make_pointer();
203203
*i = 5; // uh oh!
204204
}
@@ -214,11 +214,11 @@ issue. Two pointers are said to alias when they point at the same location
214214
in memory. Like this:
215215

216216
```{notrust,ignore}
217-
fn mutate(&int i, int j) {
217+
func mutate(&int i, int j) {
218218
*i = j;
219219
}
220220
221-
fn main() {
221+
func main() {
222222
x = 5;
223223
y = &x;
224224
z = &x; //y and z are aliased
@@ -598,7 +598,7 @@ enum List<T> {
598598
}
599599
600600
fn main() {
601-
let list: List<int> = Cons(1, box Cons(2, box Cons(3, box Nil)));
601+
let list: List<int> = List::Cons(1, box List::Cons(2, box List::Cons(3, box List::Nil)));
602602
println!("{}", list);
603603
}
604604
```

trunk/src/doc/guide-strings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ println!("{}", s[0]);
155155
This does not compile. This is on purpose. In the world of UTF-8, direct
156156
indexing is basically never what you want to do. The reason is that each
157157
character can be a variable number of bytes. This means that you have to iterate
158-
through the characters anyway, which is a O(n) operation.
158+
through the characters anyway, which is an O(n) operation.
159159

160160
There's 3 basic levels of unicode (and its encodings):
161161

trunk/src/doc/guide-testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ will be counted as a failure. For example:
8484
#[test]
8585
#[should_fail]
8686
fn test_out_of_bounds_failure() {
87-
let v: &[int] = [];
87+
let v: &[int] = &[];
8888
v[0];
8989
}
9090
~~~

0 commit comments

Comments
 (0)