Skip to content

Commit d440be0

Browse files
committed
---
yaml --- r: 150483 b: refs/heads/try2 c: 3b4a517 h: refs/heads/master i: 150481: 387145b 150479: c99cbbd v: v3
1 parent d20f999 commit d440be0

Some content is hidden

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

71 files changed

+791
-767
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: 7bda3df6ff894e9b522ede02b15b6772c99e7362
8+
refs/heads/try2: 3b4a5174c099b38fc1e71599540d13193de2467c
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/RELEASES.txt

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ Version 0.10 (April 2014)
66
* Language
77
* A new RFC process is now in place for modifying the language.
88
* Patterns with `@`-pointers have been removed from the language.
9-
* Patterns with unique vectors (`~[T]`) have been removed from the
10-
language.
11-
* Patterns with unique strings (`~str`) have been removed from the
12-
language.
9+
* Patterns with unique vectors have been removed from the language.
1310
* `@str` has been removed from the language.
1411
* `@[T]` has been removed from the language.
1512
* `@self` has been removed from the language.
@@ -28,10 +25,9 @@ Version 0.10 (April 2014)
2825
* Camel Case types
2926
* Uppercase variables
3027
* Publicly visible private types
31-
* `#[deriving]` with raw pointers
3228
* Unsafe functions can no longer be coerced to closures.
3329
* Various obscure macros such as `log_syntax!` are now behind feature gates.
34-
* The `#[simd]` attribute is now behind a feature gate.
30+
* The #[simd] attribute is now behind a feature gate.
3531
* Visibility is no longer allowed on `extern crate` statements, and
3632
unnecessary visibility (`priv`) is no longer allowed on `use` statements.
3733
* Trailing commas are now allowed in argument lists and tuple patterns.
@@ -43,7 +39,7 @@ Version 0.10 (April 2014)
4339
* The `Share` trait has been added for types that can be shared among
4440
threads.
4541
* Labels in macros are now hygienic.
46-
* Expression/statement macro invocations can be delimited with `{}` now.
42+
* Expresson/statement macro invocations can be delimited with `{}` now.
4743
* Treatment of types allowed in `static mut` locations has been tweaked.
4844
* The `*` and `.` operators are now overloadable through the `Deref` and
4945
`DerefMut` traits.
@@ -136,7 +132,7 @@ Version 0.10 (April 2014)
136132
* Tooling
137133
* `rustpkg` has been deprecated and removed from the main repository. Its
138134
replacement, `cargo`, is under development.
139-
* Nightly builds of rust are now available
135+
* Nightly builds of rust are now available (INSERT URL HERE)
140136
* The memory usage of rustc has been improved many times throughout this
141137
release cycle.
142138
* The build process supports disabling rpath support for the rustc binary
@@ -149,20 +145,16 @@ Version 0.10 (April 2014)
149145
* Output flags have been centralized into one `--emit` flag.
150146
* Crate type flags have been centralized into one `--crate-type` flag.
151147
* Codegen flags have been consolidated behind a `-C` flag.
148+
* `rustdoc` now implements syntax highlighting and rendering markdown files.
149+
* `rustdoc --test` now tests all code blocks by default.
150+
* `rustdoc` now shows documented macros.
151+
* `rustdoc` inlines documentation for reexported types.
152+
* `rustdoc` search works across crates now.
152153
* Linking against outdated crates now has improved error messages.
153154
* Error messages with lifetimes will often suggest how to annotate the
154155
function to fix the error.
155156
* Many more types are documented in the standard library, and new guides
156157
were written.
157-
* Many `rustdoc` improvements:
158-
* code blocks are syntax highlighted.
159-
* render standalone markdown files.
160-
* the --test flag tests all code blocks by default.
161-
* exported macros are displayed.
162-
* reexported types have their documentation inlined at the location of the
163-
first reexport.
164-
* search works across crates that have been rendered to the same output
165-
directory.
166158

167159
Version 0.9 (January 2014)
168160
--------------------------

branches/try2/src/doc/complement-lang-faq.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ You may also be interested in browsing [GitHub's Rust][github-rust] page.
3131

3232
## Does it run on Windows?
3333

34-
Yes. All development happens in lock-step on all 3 target platforms. Using MinGW, not Cygwin. Note that the windows implementation currently has some limitations: in particular 64-bit build is [not fully supported yet][win64], and all executables created by rustc [depends on libgcc DLL at runtime][libgcc].
34+
Yes. All development happens in lock-step on all 3 target platforms. Using MinGW, not Cygwin. Note that the windows implementation currently has some limitations: in particular tasks [cannot unwind on windows][unwind], and all Rust executables [require a MinGW installation at runtime][libgcc].
3535

36-
[win64]: https://github.com/mozilla/rust/issues/1237
37-
[libgcc]: https://github.com/mozilla/rust/issues/11782
36+
[unwind]: https://github.com/mozilla/rust/issues/908
37+
[libgcc]: https://github.com/mozilla/rust/issues/1603
3838

3939
## Is it OO? How do I do this thing I normally do in an OO language?
4040

branches/try2/src/doc/guide-pointers.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ sense, they're simple: just keep whatever ownership the data already has. For
332332
example:
333333

334334
~~~rust
335+
use std::num::sqrt;
336+
335337
struct Point {
336338
x: f32,
337339
y: f32,
@@ -341,7 +343,7 @@ fn compute_distance(p1: &Point, p2: &Point) -> f32 {
341343
let x_d = p1.x - p2.x;
342344
let y_d = p1.y - p2.y;
343345

344-
(x_d * x_d + y_d * y_d).sqrt()
346+
sqrt(x_d * x_d + y_d * y_d)
345347
}
346348

347349
fn main() {

branches/try2/src/doc/guide-runtime.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ into the pool of schedulers in order to spawn a new task.
216216

217217
With two implementations of the runtime available, a choice obviously needs to
218218
be made to see which will be used. The compiler itself will always by-default
219-
link to one of these runtimes.
219+
link to one of these runtimes. At the time of this writing, the default runtime
220+
is `libgreen` but in the future this will become `libnative`.
220221

221222
Having a default decision made in the compiler is done out of necessity and
222223
convenience. The compiler's decision of runtime to link to is *not* an

branches/try2/src/doc/rust.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -826,14 +826,14 @@ Use declarations support a number of convenient shortcuts:
826826
An example of `use` declarations:
827827

828828
~~~~
829-
use std::iter::range_step;
829+
use std::num::sin;
830830
use std::option::{Some, None};
831831
832832
# fn foo<T>(_: T){}
833833
834834
fn main() {
835-
// Equivalent to 'std::iter::range_step(0, 10, 2);'
836-
range_step(0, 10, 2);
835+
// Equivalent to 'std::num::sin(1.0);'
836+
sin(1.0);
837837
838838
// Equivalent to 'foo(~[std::option::Some(1.0), std::option::None]);'
839839
foo(~[Some(1.0), None]);

branches/try2/src/doc/tutorial.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,12 +504,13 @@ matching in order to bind names to the contents of data types.
504504
505505
~~~~
506506
use std::f64;
507+
use std::num::atan;
507508
fn angle(vector: (f64, f64)) -> f64 {
508509
let pi = f64::consts::PI;
509510
match vector {
510511
(0.0, y) if y < 0.0 => 1.5 * pi,
511512
(0.0, _) => 0.5 * pi,
512-
(x, y) => (y / x).atan()
513+
(x, y) => atan(y / x)
513514
}
514515
}
515516
~~~~
@@ -1429,11 +1430,12 @@ bad, but often copies are expensive. So we’d like to define a function
14291430
that takes the points by pointer. We can use references to do this:
14301431
14311432
~~~
1433+
use std::num::sqrt;
14321434
# struct Point { x: f64, y: f64 }
14331435
fn compute_distance(p1: &Point, p2: &Point) -> f64 {
14341436
let x_d = p1.x - p2.x;
14351437
let y_d = p1.y - p2.y;
1436-
(x_d * x_d + y_d * y_d).sqrt()
1438+
sqrt(x_d * x_d + y_d * y_d)
14371439
}
14381440
~~~
14391441
@@ -2301,7 +2303,7 @@ impl Shape for Circle {
23012303
fn new(area: f64) -> Circle { Circle { radius: (area / PI).sqrt() } }
23022304
}
23032305
impl Shape for Square {
2304-
fn new(area: f64) -> Square { Square { length: area.sqrt() } }
2306+
fn new(area: f64) -> Square { Square { length: (area).sqrt() } }
23052307
}
23062308
23072309
let area = 42.5;

branches/try2/src/libcollections/deque.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub mod bench {
5252
map: &mut M,
5353
bh: &mut BenchHarness) {
5454
// setup
55-
let mut rng = rand::weak_rng();
55+
let mut rng = rand::XorShiftRng::new();
5656

5757
map.clear();
5858
for _ in range(0, n) {
@@ -89,7 +89,7 @@ pub mod bench {
8989
map: &mut M,
9090
bh: &mut BenchHarness) {
9191
// setup
92-
let mut rng = rand::weak_rng();
92+
let mut rng = rand::XorShiftRng::new();
9393
let mut keys = slice::from_fn(n, |_| rng.gen::<uint>() % n);
9494

9595
for k in keys.iter() {

branches/try2/src/libcollections/hashmap.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,12 +1600,12 @@ mod test_map {
16001600

16011601
#[deriving(Hash, Eq, TotalEq)]
16021602
struct Dropable {
1603-
k: uint
1603+
k: int
16041604
}
16051605

16061606

16071607
impl Dropable {
1608-
fn new(k: uint) -> Dropable {
1608+
fn new(k: int) -> Dropable {
16091609
local_data::get_mut(drop_vector,
16101610
|v| { v.unwrap().as_mut_slice()[k] += 1; });
16111611

@@ -1628,24 +1628,24 @@ mod test_map {
16281628
let mut m = HashMap::new();
16291629

16301630
local_data::get(drop_vector, |v| {
1631-
for i in range(0u, 200) {
1631+
for i in range(0, 200) {
16321632
assert_eq!(v.unwrap().as_slice()[i], 0);
16331633
}
16341634
});
16351635

1636-
for i in range(0u, 100) {
1636+
for i in range(0, 100) {
16371637
let d1 = Dropable::new(i);
16381638
let d2 = Dropable::new(i+100);
16391639
m.insert(d1, d2);
16401640
}
16411641

16421642
local_data::get(drop_vector, |v| {
1643-
for i in range(0u, 200) {
1643+
for i in range(0, 200) {
16441644
assert_eq!(v.unwrap().as_slice()[i], 1);
16451645
}
16461646
});
16471647

1648-
for i in range(0u, 50) {
1648+
for i in range(0, 50) {
16491649
let k = Dropable::new(i);
16501650
let v = m.pop(&k);
16511651

@@ -1658,20 +1658,20 @@ mod test_map {
16581658
}
16591659

16601660
local_data::get(drop_vector, |v| {
1661-
for i in range(0u, 50) {
1661+
for i in range(0, 50) {
16621662
assert_eq!(v.unwrap().as_slice()[i], 0);
16631663
assert_eq!(v.unwrap().as_slice()[i+100], 0);
16641664
}
16651665

1666-
for i in range(50u, 100) {
1666+
for i in range(50, 100) {
16671667
assert_eq!(v.unwrap().as_slice()[i], 1);
16681668
assert_eq!(v.unwrap().as_slice()[i+100], 1);
16691669
}
16701670
});
16711671
}
16721672

16731673
local_data::get(drop_vector, |v| {
1674-
for i in range(0u, 200) {
1674+
for i in range(0, 200) {
16751675
assert_eq!(v.unwrap().as_slice()[i], 0);
16761676
}
16771677
});

branches/try2/src/libflate/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ mod tests {
112112
for _ in range(0, 20) {
113113
let mut input = ~[];
114114
for _ in range(0, 2000) {
115-
input.push_all(r.choose(words.as_slice()).as_slice());
115+
input.push_all(r.choose(words.as_slice()));
116116
}
117117
debug!("de/inflate of {} bytes of random word-sequences",
118118
input.len());

branches/try2/src/libgreen/sched.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -967,12 +967,7 @@ impl ClosureConverter for UnsafeTaskReceiver {
967967
// worry there.
968968
#[cfg(windows)]
969969
fn new_sched_rng() -> XorShiftRng {
970-
match XorShiftRng::new() {
971-
Ok(r) => r,
972-
Err(e) => {
973-
rtabort!("sched: failed to create seeded RNG: {}", e)
974-
}
975-
}
970+
XorShiftRng::new()
976971
}
977972
#[cfg(unix)]
978973
fn new_sched_rng() -> XorShiftRng {

branches/try2/src/libnative/io/addrinfo.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ extern "system" {
9696

9797
#[cfg(windows)]
9898
fn get_error(_: c_int) -> IoError {
99+
use super::translate_error;
100+
99101
unsafe {
100-
IoError::from_errno(WSAGetLastError() as uint, true)
102+
translate_error(WSAGetLastError() as i32, true)
101103
}
102104
}
103105

branches/try2/src/libnative/io/mod.rs

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,73 @@ fn unimpl() -> IoError {
8686
}
8787
}
8888

89-
fn last_error() -> IoError {
90-
IoError::last_error()
89+
fn translate_error(errno: i32, detail: bool) -> IoError {
90+
#[cfg(windows)]
91+
fn get_err(errno: i32) -> (io::IoErrorKind, &'static str) {
92+
match errno {
93+
libc::EOF => (io::EndOfFile, "end of file"),
94+
libc::ERROR_NO_DATA => (io::BrokenPipe, "the pipe is being closed"),
95+
libc::ERROR_FILE_NOT_FOUND => (io::FileNotFound, "file not found"),
96+
libc::ERROR_INVALID_NAME => (io::InvalidInput, "invalid file name"),
97+
libc::WSAECONNREFUSED => (io::ConnectionRefused, "connection refused"),
98+
libc::WSAECONNRESET => (io::ConnectionReset, "connection reset"),
99+
libc::WSAEACCES => (io::PermissionDenied, "permission denied"),
100+
libc::WSAEWOULDBLOCK => {
101+
(io::ResourceUnavailable, "resource temporarily unavailable")
102+
}
103+
libc::WSAENOTCONN => (io::NotConnected, "not connected"),
104+
libc::WSAECONNABORTED => (io::ConnectionAborted, "connection aborted"),
105+
libc::WSAEADDRNOTAVAIL => (io::ConnectionRefused, "address not available"),
106+
libc::WSAEADDRINUSE => (io::ConnectionRefused, "address in use"),
107+
libc::ERROR_BROKEN_PIPE => (io::EndOfFile, "the pipe has ended"),
108+
109+
// libuv maps this error code to EISDIR. we do too. if it is found
110+
// to be incorrect, we can add in some more machinery to only
111+
// return this message when ERROR_INVALID_FUNCTION after certain
112+
// win32 calls.
113+
libc::ERROR_INVALID_FUNCTION => (io::InvalidInput,
114+
"illegal operation on a directory"),
115+
116+
_ => (io::OtherIoError, "unknown error")
117+
}
118+
}
119+
120+
#[cfg(not(windows))]
121+
fn get_err(errno: i32) -> (io::IoErrorKind, &'static str) {
122+
// FIXME: this should probably be a bit more descriptive...
123+
match errno {
124+
libc::EOF => (io::EndOfFile, "end of file"),
125+
libc::ECONNREFUSED => (io::ConnectionRefused, "connection refused"),
126+
libc::ECONNRESET => (io::ConnectionReset, "connection reset"),
127+
libc::EPERM | libc::EACCES =>
128+
(io::PermissionDenied, "permission denied"),
129+
libc::EPIPE => (io::BrokenPipe, "broken pipe"),
130+
libc::ENOTCONN => (io::NotConnected, "not connected"),
131+
libc::ECONNABORTED => (io::ConnectionAborted, "connection aborted"),
132+
libc::EADDRNOTAVAIL => (io::ConnectionRefused, "address not available"),
133+
libc::EADDRINUSE => (io::ConnectionRefused, "address in use"),
134+
libc::ENOENT => (io::FileNotFound, "no such file or directory"),
135+
libc::EISDIR => (io::InvalidInput, "illegal operation on a directory"),
136+
137+
// These two constants can have the same value on some systems, but
138+
// different values on others, so we can't use a match clause
139+
x if x == libc::EAGAIN || x == libc::EWOULDBLOCK =>
140+
(io::ResourceUnavailable, "resource temporarily unavailable"),
141+
142+
_ => (io::OtherIoError, "unknown error")
143+
}
144+
}
145+
146+
let (kind, desc) = get_err(errno);
147+
IoError {
148+
kind: kind,
149+
desc: desc,
150+
detail: if detail {Some(os::last_os_error())} else {None},
151+
}
91152
}
92153

154+
fn last_error() -> IoError { translate_error(os::errno() as i32, true) }
155+
93156
// unix has nonzero values as errors
94157
fn mkerr_libc(ret: libc::c_int) -> IoResult<()> {
95158
if ret != 0 {

branches/try2/src/libnative/io/net.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ fn last_error() -> io::IoError {
120120
extern "system" {
121121
fn WSAGetLastError() -> libc::c_int;
122122
}
123-
io::IoError::from_errno(unsafe { WSAGetLastError() } as uint, true)
123+
super::translate_error(unsafe { WSAGetLastError() }, true)
124124
}
125125

126126
#[cfg(not(windows))]

branches/try2/src/libnative/io/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ fn spawn_process_os(config: p::ProcessConfig,
481481
(bytes[1] << 16) as i32 |
482482
(bytes[2] << 8) as i32 |
483483
(bytes[3] << 0) as i32;
484-
Err(io::IoError::from_errno(errno as uint, false))
484+
Err(super::translate_error(errno, false))
485485
}
486486
Err(e) => {
487487
assert!(e.kind == io::BrokenPipe ||

0 commit comments

Comments
 (0)