Skip to content

Commit 0063fe3

Browse files
committed
Release of Rust-0.11.0
1 parent bbfe7d4 commit 0063fe3

13 files changed

+40
-49
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ env:
77
global:
88
- secure: YuWDOwPGprL6PiBZVeGaLOCHHgC18fQ6nq617tlt7XFCkG17r/xDWq3iiAyNxNUcwsD9CkWi5aXok8SlX3rQx84XC/sya2bi0+8Frt9EztcVxgMwWuX3Ll4mFHO7HnMhazoQYRPd0b0w4s7bFY2WidxCqjsMKRgAM26Gn+6oQto=
99
install:
10-
- curl -O http://static.rust-lang.org/dist/rust-nightly-x86_64-unknown-linux-gnu.tar.gz
11-
- tar xfz rust-nightly-x86_64-unknown-linux-gnu.tar.gz
12-
- (cd rust-nightly-x86_64-unknown-linux-gnu/ && sudo ./install.sh)
10+
- curl -O http://static.rust-lang.org/dist/rust-0.11.0-x86_64-unknown-linux-gnu.tar.gz
11+
- tar xfz rust-0.11.0-x86_64-unknown-linux-gnu.tar.gz
12+
- (cd rust-0.11.0-x86_64-unknown-linux-gnu/ && sudo ./install.sh)
1313
- rustc --version
1414
script:
1515
- make clean test

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ rust-examples [![Ohloh statistics](http://www.ohloh.net/p/rust-examples/widgets/
77
gather example codes from tutorial and other documentations of
88
[Rust](http://www.rust-lang.org/) into files, ready to compile.
99

10-
Examples are tested with version 0.11-pre.
10+
Examples are tested with version 0.11.0.
1111

1212
## Files
1313

@@ -67,7 +67,7 @@ Examples are tested with version 0.11-pre.
6767

6868
# Compile and running it
6969

70-
You will need the version 0.11-pre of the rust compiler.
70+
You will need the version 0.11.0 of the rust compiler.
7171
If you encounter problems, make sure you have the right version before creating an issue.
7272

7373
The simplest way to build **rust-examples** is to do a clone and use ``make`` to compile:

api-collections-hashmap.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
2-
* http://doc.rust-lang.org/collections/hashmap/struct.HashMap.html
3-
* https://github.com/mozilla/rust/blob/master/src/test/run-pass/hashmap-memory.rs#L70
4-
* https://github.com/mozilla/rust/blob/master/src/libcollections/hashmap.rs
2+
* http://doc.rust-lang.org/std/collections/hashmap/struct.HashMap.html
3+
* https://github.com/rust-lang/rust/blob/master/src/test/run-pass/hashmap-memory.rs#L39
4+
* https://github.com/rust-lang/rust/blob/master/src/libstd/collections/hashmap.rs
55
*
66
* @license MIT license <http://www.opensource.org/licenses/mit-license.php>
77
*/

api-getopts.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,17 @@ fn print_usage(program: &str, _opts: &[OptGroup]) {
2222
}
2323

2424
fn main() {
25-
let args: Vec<String> = os::args().iter()
26-
.map(|x| x.to_string())
27-
.collect();
25+
let args: Vec<String> = os::args();
2826

2927
let program = args.get(0).clone();
3028

3129
let opts = [
3230
optopt("o", "", "set output file name", "NAME"),
3331
optflag("h", "help", "print this help menu")
3432
];
35-
3633
let matches = match getopts(args.tail(), opts) {
3734
Ok(m) => { m }
38-
Err(f) => { fail!(f.to_err_msg()) }
35+
Err(f) => { fail!(f.to_str()) }
3936
};
4037
if matches.opt_present("h") {
4138
print_usage(program.as_slice(), opts);

api-std-vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fn main() {
2828
* The iterator yields borrowed pointers to the vector's elements,
2929
* so if the element type of the vector is int, the element type of the iterator is &int.
3030
*/
31-
let numbers = [0, 1, 2];
31+
let numbers = [0i, 1, 2];
3232
for &x in numbers.iter() {
3333
println!("element in numbers: {}", x);
3434
}

find_max.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,67 +81,67 @@ fn find_maxstd<'a, T: Ord>(lst: &'a Vec<T>) -> Option<&'a T> {
8181

8282
#[test]
8383
fn test_find_max1() {
84-
let v = vec!(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
85-
let nine = 9;
84+
let v = vec!(0i, 1, 2, 3, 4, 5, 6, 7, 8, 9);
85+
let nine = 9i;
8686
assert_eq!(Some(&nine), find_max1(&v));
8787
}
8888

8989
#[test]
9090
fn test_find_max2() {
91-
let v = vec!(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
92-
let nine = 9;
91+
let v = vec!(0i, 1, 2, 3, 4, 5, 6, 7, 8, 9);
92+
let nine = 9i;
9393
assert_eq!(Some(&nine), find_max2(&v));
9494
}
9595

9696
#[test]
9797
fn test_find_max3() {
98-
let v = vec!(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
99-
let nine = 9;
98+
let v = vec!(0i, 1, 2, 3, 4, 5, 6, 7, 8, 9);
99+
let nine = 9i;
100100
assert_eq!(Some(&nine), find_max3(&v));
101101
}
102102

103103
#[test]
104104
fn test_find_maxstd() {
105-
let v = vec!(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
106-
let nine = 9;
105+
let v = vec!(0i, 1, 2, 3, 4, 5, 6, 7, 8, 9);
106+
let nine = 9i;
107107
assert_eq!(Some(&nine), find_maxstd(&v));
108108
}
109109

110110
#[bench]
111111
fn bench_find_max1(b: &mut Bencher) {
112-
let v = vec!(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
112+
let v = vec!(0i, 1, 2, 3, 4, 5, 6, 7, 8, 9);
113113
b.iter(|| {
114114
find_max1(&v);
115115
});
116116
}
117117

118118
#[bench]
119119
fn bench_find_max2(b: &mut Bencher) {
120-
let v = vec!(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
120+
let v = vec!(0i, 1, 2, 3, 4, 5, 6, 7, 8, 9);
121121
b.iter(|| {
122122
find_max2(&v);
123123
});
124124
}
125125

126126
#[bench]
127127
fn bench_find_max3(b: &mut Bencher) {
128-
let v = vec!(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
128+
let v = vec!(0i, 1, 2, 3, 4, 5, 6, 7, 8, 9);
129129
b.iter(|| {
130130
find_max3(&v);
131131
});
132132
}
133133

134134
#[bench]
135135
fn bench_find_maxstd(b: &mut Bencher) {
136-
let v = vec!(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
136+
let v = vec!(0i, 1, 2, 3, 4, 5, 6, 7, 8, 9);
137137
b.iter(|| {
138138
find_maxstd(&v);
139139
});
140140
}
141141

142142
#[cfg(not(test))]
143143
fn main () {
144-
let int_v = vec!(5, 2, 0, 8, 2);
144+
let int_v = vec!(5i, 2, 0, 8, 2);
145145
println!("find_max1 -> {}", find_max1(&int_v));
146146
println!("find_max2 -> {}", find_max2(&int_v));
147147
println!("find_max3 -> {}", find_max3(&int_v));

inifile.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,6 @@ mod tests {
534534
}
535535
#[test]
536536
fn write() {
537-
use std::task;
538-
use std::any::Any;
539537
// Copy config.ini to write_test.ini using `write()`.
540538
let writepath = "data/write_test.ini";
541539
let mut ini = super::IniFile::new();
@@ -555,12 +553,7 @@ mod tests {
555553

556554
// Clean
557555
assert!(path.exists(), format!("{} should exist after reading the new inifile!", writepath));
558-
let result: Result<(), Box<Any:Send>> = task::try(proc() {
559-
match fs::unlink(&path) {
560-
Err(e) => fail!("open of {:?} failed: {}", path, e),
561-
_ => debug!("open of {:?} succeeded", path)
562-
}
563-
});
556+
let result = fs::unlink(&path);
564557
assert!(!result.is_err(), format!("Unlinking {} should not fail!", writepath));
565558
}
566559
#[test]

lang-pointers.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::gc::GC;
1313
* http://doc.rust-lang.org/tutorial.html#dereferencing-pointers
1414
*
1515
* The deprecation of @, its alternatives
16-
* https://github.com/mozilla/rust/wiki/Doc-detailed-release-notes
16+
* https://github.com/rust-lang/rust/wiki/Doc-detailed-release-notes
1717
*/
1818
struct Point {
1919
x: f64,
@@ -49,7 +49,8 @@ fn main() {
4949
print_point(&p);
5050
// Managed pointer to T
5151
// @T, in C++ : shared_ptr<T>
52-
let p2 = @Point{x:2.1, y:2.2};
52+
// The type syntax @T was replaced by Gc<T> which lives in std::gc.
53+
let p2 = box(GC) Point{x:2.1, y:2.2};
5354
print_point(p2);
5455
// Owned pointer to T
5556
// box T, in C++ : unique_ptr<T>
@@ -70,7 +71,7 @@ fn main() {
7071
* 13. Dereferencing pointers
7172
* http://doc.rust-lang.org/tutorial.html#dereferencing-pointers
7273
*/
73-
let managed = @10;
74+
let managed = box(GC) 10i;
7475
let owned = box 20;
7576
let borrowed = &30;
7677

@@ -81,7 +82,7 @@ fn main() {
8182
* Dereferenced mutable pointers may appear on the left hand side of assignments.
8283
* Such an assignment modifies the value that the pointer points to.
8384
*/
84-
let managed = @10;
85+
let managed = box(GC) 10i;
8586
let mut owned = box 20;
8687

8788
let mut value = 30;
@@ -101,7 +102,7 @@ fn main() {
101102
* dereferencing to the receiver (the value on the left-hand side of the dot),
102103
* so in most cases, explicitly dereferencing the receiver is not necessary.
103104
*/
104-
let bottom = @Point { x: 10.0, y: 120.0 };
105+
let bottom = box(GC) Point { x: 10.0, y: 120.0 };
105106
let top = box Point { x: bottom.x + 100.0, y: bottom.y - 100.0 };
106107
let rect = &Rectangle(*top, *bottom);
107108
let area = rect.area();

tutorial-03-syntax_basics.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ fn main() {
1212
* To introduce a local variable that you can re-assign later, use let mut instead.
1313
*/
1414
let hi = "hi";
15-
let mut count = 0;
15+
let mut count = 0i;
1616

1717
while count < 10 {
18-
println!("{}, count: {}", hi, count);
19-
count += 1;
18+
println!("{}, count: {}", hi, count);
19+
count += 1;
2020
}
2121

2222
/*
@@ -35,7 +35,7 @@ fn main() {
3535
* http://doc.rust-lang.org/tutorial.html#syntax-extensions
3636
*/
3737
// {} will print the "default format" of a type
38-
println!("{} is {}", "the answer", 43);
38+
println!("{} is {}", "the answer", 43i);
3939

4040
// // {:?} will conveniently print any type
4141
println!("what is this thing: {:?}", monster_size);

tutorial-15-closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn main() {
3838
/*
3939
* Call with captured variable
4040
*/
41-
let captured_var = 20;
41+
let captured_var = 20i;
4242
let closure = |arg| println!("captured_var={}, arg={}", captured_var, arg);
4343
call_closure_with_ten(closure);
4444

0 commit comments

Comments
 (0)