Skip to content

Commit 5c59882

Browse files
committed
---
yaml --- r: 178551 b: refs/heads/try c: 1d00c54 h: refs/heads/master i: 178549: 2b01e8d 178547: 8d22f95 178543: 2c4bf25 v: v3
1 parent 5d78e21 commit 5c59882

File tree

662 files changed

+7313
-4536
lines changed

Some content is hidden

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

662 files changed

+7313
-4536
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 336c8d2e9c6b276b162bdb3edd43706372e6eddd
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 474b324eda10440d6568ef872a7307d38e7de95b
5-
refs/heads/try: 64dd7be2c5faae1946989c5e1df4d0c6172be1be
5+
refs/heads/try: 1d00c545ede609b9d43fdf9f252c15da5a66dac7
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,12 @@ There is a lot more documentation in the [wiki].
110110

111111
The Rust community congregates in a few places:
112112

113-
* [StackOverflow] - Direct questions about using the language here.
114-
* [users.rust-lang.org] - General discussion, broader questions.
113+
* [StackOverflow] - Get help here.
114+
* [/r/rust] - General discussion.
115115
* [internals.rust-lang.org] - For development of the Rust language itself.
116-
* [/r/rust] - News and general discussion.
117116

118117
[StackOverflow]: http://stackoverflow.com/questions/tagged/rust
119118
[/r/rust]: http://reddit.com/r/rust
120-
[users.rust-lang.org]: http://users.rust-lang.org/
121119
[internals.rust-lang.org]: http://internals.rust-lang.org/
122120

123121
## License

branches/try/src/compiletest/common.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,17 @@ pub enum Mode {
2525
}
2626

2727
impl FromStr for Mode {
28-
type Err = ();
29-
fn from_str(s: &str) -> Result<Mode, ()> {
28+
fn from_str(s: &str) -> Option<Mode> {
3029
match s {
31-
"compile-fail" => Ok(CompileFail),
32-
"run-fail" => Ok(RunFail),
33-
"run-pass" => Ok(RunPass),
34-
"run-pass-valgrind" => Ok(RunPassValgrind),
35-
"pretty" => Ok(Pretty),
36-
"debuginfo-lldb" => Ok(DebugInfoLldb),
37-
"debuginfo-gdb" => Ok(DebugInfoGdb),
38-
"codegen" => Ok(Codegen),
39-
_ => Err(()),
30+
"compile-fail" => Some(CompileFail),
31+
"run-fail" => Some(RunFail),
32+
"run-pass" => Some(RunPass),
33+
"run-pass-valgrind" => Some(RunPassValgrind),
34+
"pretty" => Some(Pretty),
35+
"debuginfo-lldb" => Some(DebugInfoLldb),
36+
"debuginfo-gdb" => Some(DebugInfoGdb),
37+
"codegen" => Some(Codegen),
38+
_ => None,
4039
}
4140
}
4241
}

branches/try/src/compiletest/compiletest.rs

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

1111
#![crate_type = "bin"]
12-
12+
#![allow(unknown_features)]
13+
#![feature(slicing_syntax, unboxed_closures)]
1314
#![feature(box_syntax)]
14-
#![feature(collections)]
15-
#![feature(core)]
1615
#![feature(int_uint)]
17-
#![feature(io)]
18-
#![feature(os)]
19-
#![feature(path)]
16+
#![feature(test)]
2017
#![feature(rustc_private)]
21-
#![feature(slicing_syntax, unboxed_closures)]
2218
#![feature(std_misc)]
23-
#![feature(test)]
19+
#![feature(path)]
20+
#![feature(io)]
21+
#![feature(core)]
22+
#![feature(collections)]
23+
#![feature(os)]
2424
#![feature(unicode)]
2525

26+
#![allow(unstable)]
2627
#![deny(warnings)]
2728

2829
extern crate test;
@@ -34,6 +35,7 @@ extern crate log;
3435
use std::os;
3536
use std::old_io;
3637
use std::old_io::fs;
38+
use std::str::FromStr;
3739
use std::thunk::Thunk;
3840
use getopts::{optopt, optflag, reqopt};
3941
use common::Config;
@@ -138,7 +140,9 @@ pub fn parse_config(args: Vec<String> ) -> Config {
138140
build_base: opt_path(matches, "build-base"),
139141
aux_base: opt_path(matches, "aux-base"),
140142
stage_id: matches.opt_str("stage-id").unwrap(),
141-
mode: matches.opt_str("mode").unwrap().parse().ok().expect("invalid mode"),
143+
mode: FromStr::from_str(matches.opt_str("mode")
144+
.unwrap()
145+
.as_slice()).expect("invalid mode"),
142146
run_ignored: matches.opt_present("ignored"),
143147
filter: filter,
144148
logfile: matches.opt_str("logfile").map(|s| Path::new(s)),

branches/try/src/compiletest/header.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,8 @@ pub fn gdb_version_to_int(version_string: &str) -> int {
352352
panic!("{}", error_string);
353353
}
354354

355-
let major: int = components[0].parse().ok().expect(error_string);
356-
let minor: int = components[1].parse().ok().expect(error_string);
355+
let major: int = components[0].parse().expect(error_string);
356+
let minor: int = components[1].parse().expect(error_string);
357357

358358
return major * 1000 + minor;
359359
}
@@ -363,6 +363,6 @@ pub fn lldb_version_to_int(version_string: &str) -> int {
363363
"Encountered LLDB version string with unexpected format: {}",
364364
version_string);
365365
let error_string = error_string.as_slice();
366-
let major: int = version_string.parse().ok().expect(error_string);
366+
let major: int = version_string.parse().expect(error_string);
367367
return major;
368368
}

branches/try/src/doc/index.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,10 @@ Overflow](http://stackoverflow.com/questions/tagged/rust). Searching for your
3939
problem might reveal someone who has asked it before!
4040

4141
There is an active [subreddit](http://reddit.com/r/rust) with lots of
42-
discussion and news about Rust.
42+
discussion about Rust.
4343

44-
There is also a [user forum](http://users.rust-lang.org), for all
45-
user-oriented discussion, and a [developer
46-
forum](http://internals.rust-lang.org/), where the development of Rust
47-
itself is discussed.
44+
There is also a [developer forum](http://internals.rust-lang.org/), where the
45+
development of Rust itself is discussed.
4846

4947
# Specification
5048

branches/try/src/doc/reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2994,7 +2994,7 @@ Some examples of call expressions:
29942994
# fn add(x: i32, y: i32) -> i32 { 0 }
29952995
29962996
let x: i32 = add(1i32, 2i32);
2997-
let pi: Option<f32> = "3.14".parse().ok();
2997+
let pi: Option<f32> = "3.14".parse();
29982998
```
29992999

30003000
### Lambda expressions
@@ -3518,7 +3518,7 @@ An example of each kind:
35183518
```{rust}
35193519
let vec: Vec<i32> = vec![1, 2, 3];
35203520
let arr: [i32; 3] = [1, 2, 3];
3521-
let s: &[i32] = &vec;
3521+
let s: &[i32] = vec.as_slice();
35223522
```
35233523

35243524
As you can see, the `vec!` macro allows you to create a `Vec<T>` easily. The

branches/try/src/doc/trpl/guessing-game.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ a function for that:
400400
let input = old_io::stdin().read_line()
401401
.ok()
402402
.expect("Failed to read line");
403-
let input_num: Option<u32> = input.parse().ok();
403+
let input_num: Option<u32> = input.parse();
404404
```
405405
406406
The `parse` function takes in a `&str` value and converts it into something.
@@ -422,13 +422,11 @@ In this case, we say `x` is a `u32` explicitly, so Rust is able to properly
422422
tell `random()` what to generate. In a similar fashion, both of these work:
423423
424424
```{rust,ignore}
425-
let input_num = "5".parse::<u32>().ok(); // input_num: Option<u32>
426-
let input_num: Option<u32> = "5".parse().ok(); // input_num: Option<u32>
425+
let input_num = "5".parse::<u32>(); // input_num: Option<u32>
426+
let input_num: Option<u32> = "5".parse(); // input_num: Option<u32>
427427
```
428428
429-
Here we're converting the `Result` returned by `parse` to an `Option` by using
430-
the `ok` method as well. Anyway, with us now converting our input to a number,
431-
our code looks like this:
429+
Anyway, with us now converting our input to a number, our code looks like this:
432430
433431
```{rust,ignore}
434432
use std::old_io;
@@ -447,7 +445,7 @@ fn main() {
447445
let input = old_io::stdin().read_line()
448446
.ok()
449447
.expect("Failed to read line");
450-
let input_num: Option<u32> = input.parse().ok();
448+
let input_num: Option<u32> = input.parse();
451449

452450
println!("You guessed: {}", input_num);
453451

@@ -497,7 +495,7 @@ fn main() {
497495
let input = old_io::stdin().read_line()
498496
.ok()
499497
.expect("Failed to read line");
500-
let input_num: Option<u32> = input.parse().ok();
498+
let input_num: Option<u32> = input.parse();
501499
502500
let num = match input_num {
503501
Some(num) => num,
@@ -564,7 +562,7 @@ fn main() {
564562
let input = old_io::stdin().read_line()
565563
.ok()
566564
.expect("Failed to read line");
567-
let input_num: Option<u32> = input.trim().parse().ok();
565+
let input_num: Option<u32> = input.trim().parse();
568566
569567
let num = match input_num {
570568
Some(num) => num,
@@ -640,7 +638,7 @@ fn main() {
640638
let input = old_io::stdin().read_line()
641639
.ok()
642640
.expect("Failed to read line");
643-
let input_num: Option<u32> = input.trim().parse().ok();
641+
let input_num: Option<u32> = input.trim().parse();
644642

645643
let num = match input_num {
646644
Some(num) => num,
@@ -716,7 +714,7 @@ fn main() {
716714
let input = old_io::stdin().read_line()
717715
.ok()
718716
.expect("Failed to read line");
719-
let input_num: Option<u32> = input.trim().parse().ok();
717+
let input_num: Option<u32> = input.trim().parse();
720718
721719
let num = match input_num {
722720
Some(num) => num,
@@ -772,7 +770,7 @@ fn main() {
772770
let input = old_io::stdin().read_line()
773771
.ok()
774772
.expect("Failed to read line");
775-
let input_num: Option<u32> = input.trim().parse().ok();
773+
let input_num: Option<u32> = input.trim().parse();
776774
777775
let num = match input_num {
778776
Some(num) => num,
@@ -849,7 +847,7 @@ fn main() {
849847
let input = old_io::stdin().read_line()
850848
.ok()
851849
.expect("Failed to read line");
852-
let input_num: Option<u32> = input.trim().parse().ok();
850+
let input_num: Option<u32> = input.trim().parse();
853851
854852
let num = match input_num {
855853
Some(num) => num,

branches/try/src/doc/trpl/more-strings.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ To write a function that's generic over types of strings, use `&str`.
100100

101101
```
102102
fn some_string_length(x: &str) -> uint {
103-
x.len()
103+
x.len()
104104
}
105105
106106
fn main() {
@@ -110,7 +110,7 @@ fn main() {
110110
111111
let s = "Hello, world".to_string();
112112
113-
println!("{}", some_string_length(&s));
113+
println!("{}", some_string_length(s.as_slice()));
114114
}
115115
```
116116

branches/try/src/doc/trpl/patterns.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@ match origin {
174174
}
175175
```
176176

177-
If you want to match against a slice or array, you can use `&`:
177+
If you want to match against a slice or array, you can use `[]`:
178178

179179
```{rust}
180180
fn main() {
181181
let v = vec!["match_this", "1"];
182182
183-
match &v[] {
183+
match v.as_slice() {
184184
["match_this", second] => println!("The second element is {}", second),
185185
_ => {},
186186
}

branches/try/src/doc/trpl/plugins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
8282
}
8383
};
8484
85-
let mut text = &text;
85+
let mut text = text.as_slice();
8686
let mut total = 0;
8787
while !text.is_empty() {
8888
match NUMERALS.iter().find(|&&(rn, _)| text.starts_with(rn)) {

branches/try/src/doc/trpl/standard-input.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Let's go over these chunks, one by one:
2020
std::old_io::stdin();
2121
```
2222

23-
This calls a function, `stdin()`, that lives inside the `std::old_io` module. As
23+
This calls a function, `stdin()`, that lives inside the `std::io` module. As
2424
you can imagine, everything in `std` is provided by Rust, the 'standard
2525
library.' We'll talk more about the module system later.
2626

branches/try/src/doc/trpl/strings.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,36 @@ s.push_str(", world.");
3636
println!("{}", s);
3737
```
3838

39-
`String`s will coerece into `&str` with an `&`:
39+
You can get a `&str` view into a `String` with the `as_slice()` method:
4040

41-
```
41+
```{rust}
4242
fn takes_slice(slice: &str) {
4343
println!("Got: {}", slice);
4444
}
4545
4646
fn main() {
4747
let s = "Hello".to_string();
48-
takes_slice(&s);
48+
takes_slice(s.as_slice());
49+
}
50+
```
51+
52+
To compare a String to a constant string, prefer `as_slice()`...
53+
54+
```{rust}
55+
fn compare(string: String) {
56+
if string.as_slice() == "Hello" {
57+
println!("yes");
58+
}
59+
}
60+
```
61+
62+
... over `to_string()`:
63+
64+
```{rust}
65+
fn compare(string: String) {
66+
if string == "Hello".to_string() {
67+
println!("yes");
68+
}
4969
}
5070
```
5171

branches/try/src/doc/trpl/unsafe.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,6 @@ extern fn panic_fmt(args: &core::fmt::Arguments,
576576
#[lang = "eh_personality"] extern fn eh_personality() {}
577577
# #[start] fn start(argc: isize, argv: *const *const u8) -> isize { 0 }
578578
# fn main() {}
579-
# mod std { // for-loops
580-
# pub use core::iter;
581-
# pub use core::option;
582-
# }
583579
```
584580

585581
Note that there is one extra lang item here which differs from the examples

branches/try/src/driver/driver.rs

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

11+
#![allow(unknown_features)]
1112
#![cfg_attr(rustc, feature(rustc_private))]
1213
#![cfg_attr(rustdoc, feature(rustdoc))]
1314

0 commit comments

Comments
 (0)