Skip to content

Commit 4313e0d

Browse files
---
yaml --- r: 126334 b: refs/heads/auto c: c74d320 h: refs/heads/master v: v3
1 parent b8195a3 commit 4313e0d

File tree

49 files changed

+233
-427
lines changed

Some content is hidden

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

49 files changed

+233
-427
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: f5ac41185a821681f4bfaf93ef0569955d24ef4a
16+
refs/heads/auto: c74d320662329922860c5cdaf8cba1797caebea4
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/doc/guide.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,14 +1647,14 @@ $ cargo build
16471647
$
16481648
```
16491649

1650-
Excellent! Open up your `src/main.rs` again. We'll be writing all of
1650+
Excellent! Open up your `src/guessing_game.rs` again. We'll be writing all of
16511651
our code in this file. We'll talk about multiple-file projects later on in the
16521652
guide.
16531653

16541654
## Processing a Guess
16551655

16561656
Let's get to it! The first thing we need to do for our guessing game is
1657-
allow our player to input a guess. Put this in your `src/main.rs`:
1657+
allow our player to input a guess. Put this in your `src/guessing_game.rs`:
16581658

16591659
```{rust,no_run}
16601660
use std::io;
@@ -1734,9 +1734,9 @@ this using `cargo build`:
17341734
```{notrust,no_run}
17351735
$ cargo build
17361736
Compiling guessing_game v0.1.0 (file:/home/you/projects/guessing_game)
1737-
src/main.rs:7:26: 7:34 error: the type of this value must be known in this context
1738-
src/main.rs:7 let secret_number = (rand::random() % 100i) + 1i;
1739-
^~~~~~~~
1737+
src/guessing_game.rs:7:26: 7:34 error: the type of this value must be known in this context
1738+
src/guessing_game.rs:7 let secret_number = (rand::random() % 100i) + 1i;
1739+
^~~~~~~~
17401740
error: aborting due to previous error
17411741
```
17421742

@@ -1896,12 +1896,12 @@ If we try to compile, we'll get some errors:
18961896
```{notrust,ignore}
18971897
$ cargo build
18981898
Compiling guessing_game v0.1.0 (file:/home/you/projects/guessing_game)
1899-
src/main.rs:20:15: 20:20 error: mismatched types: expected `int` but found `collections::string::String` (expected int but found struct collections::string::String)
1900-
src/main.rs:20 match cmp(input, secret_number) {
1901-
^~~~~
1902-
src/main.rs:20:22: 20:35 error: mismatched types: expected `int` but found `uint` (expected int but found uint)
1903-
src/main.rs:20 match cmp(input, secret_number) {
1904-
^~~~~~~~~~~~~
1899+
src/guessing_game.rs:20:15: 20:20 error: mismatched types: expected `int` but found `collections::string::String` (expected int but found struct collections::string::String)
1900+
src/guessing_game.rs:20 match cmp(input, secret_number) {
1901+
^~~~~
1902+
src/guessing_game.rs:20:22: 20:35 error: mismatched types: expected `int` but found `uint` (expected int but found uint)
1903+
src/guessing_game.rs:20 match cmp(input, secret_number) {
1904+
^~~~~~~~~~~~~
19051905
error: aborting due to 2 previous errors
19061906
```
19071907

@@ -1950,9 +1950,9 @@ And try compiling again:
19501950
```{notrust,ignore}
19511951
$ cargo build
19521952
Compiling guessing_game v0.1.0 (file:/home/you/projects/guessing_game)
1953-
src/main.rs:20:15: 20:20 error: mismatched types: expected `uint` but found `collections::string::String` (expected uint but found struct collections::string::String)
1954-
src/main.rs:20 match cmp(input, secret_number) {
1955-
^~~~~
1953+
src/guessing_game.rs:20:15: 20:20 error: mismatched types: expected `uint` but found `collections::string::String` (expected uint but found struct collections::string::String)
1954+
src/guessing_game.rs:20 match cmp(input, secret_number) {
1955+
^~~~~
19561956
error: aborting due to previous error
19571957
```
19581958

@@ -2053,9 +2053,9 @@ Let's try it out!
20532053
```{notrust,ignore}
20542054
$ cargo build
20552055
Compiling guessing_game v0.1.0 (file:/home/you/projects/guessing_game)
2056-
src/main.rs:22:15: 22:24 error: mismatched types: expected `uint` but found `core::option::Option<uint>` (expected uint but found enum core::option::Option)
2057-
src/main.rs:22 match cmp(input_num, secret_number) {
2058-
^~~~~~~~~
2056+
src/guessing_game.rs:22:15: 22:24 error: mismatched types: expected `uint` but found `core::option::Option<uint>` (expected uint but found enum core::option::Option)
2057+
src/guessing_game.rs:22 match cmp(input_num, secret_number) {
2058+
^~~~~~~~~
20592059
error: aborting due to previous error
20602060
```
20612061

branches/auto/src/doc/intro.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,10 @@ fn main() {
359359
// Take the lock, along with exclusive access to the underlying array
360360
let mut numbers = numbers_lock.lock();
361361
362-
// This is ugly for now because of the need for `get_mut`, but
363-
// will be replaced by `numbers[num as uint] += 1`
364-
// in the near future.
362+
// This is ugly for now, but will be replaced by
363+
// `numbers[num as uint] += 1` in the near future.
365364
// See: https://github.com/rust-lang/rust/issues/6515
366-
*numbers.get_mut(num as uint) += 1;
365+
*numbers.get_mut(num as uint) = *numbers.get_mut(num as uint) + 1;
367366
368367
println!("{}", (*numbers)[num as uint]);
369368

branches/auto/src/doc/rust.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ production. See [tokens](#tokens) for more information.
112112

113113
## Input format
114114

115-
Rust input is interpreted as a sequence of Unicode codepoints encoded in UTF-8.
115+
Rust input is interpreted as a sequence of Unicode codepoints encoded in UTF-8,
116+
normalized to Unicode normalization form NFKC.
116117
Most Rust grammar rules are defined in terms of printable ASCII-range codepoints,
117118
but a small number are defined in terms of Unicode properties or explicit
118119
codepoint lists. [^inputformat]

branches/auto/src/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2196,7 +2196,7 @@ and may not be overridden:
21962196
Types are sendable
21972197
unless they contain references.
21982198

2199-
* `Share` - Types that are *threadsafe*.
2199+
* `Share` - Types that are *threadsafe*
22002200
These are types that are safe to be used across several threads with access to
22012201
a `&T` pointer. `Mutex<T>` is an example of a *sharable* type with internal mutable data.
22022202

branches/auto/src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
<style id="number" _name="Number" map-to="def:number"/>
2323
<style id="scope" _name="Scope" map-to="def:preprocessor"/>
2424
<style id="attribute" _name="Attribute" map-to="def:preprocessor"/>
25-
<style id="macro" _name="Macro" map-to="def:preprocessor"/>
2625
</styles>
2726

2827
<definitions>
@@ -252,12 +251,6 @@
252251
</match>
253252
</context>
254253

255-
<context id="macro" style-ref="macro">
256-
<match extended="true">
257-
\%{ident}!
258-
</match>
259-
</context>
260-
261254
<context id="lifetime" style-ref="keyword">
262255
<match extended="true">
263256
'\%{ident}
@@ -315,7 +308,6 @@
315308
<context ref="types"/>
316309
<context ref="ctypes"/>
317310
<context ref="self"/>
318-
<context ref="macro"/>
319311
<context ref="constants"/>
320312
<context ref="cconstants"/>
321313
<context ref="line-comment"/>

branches/auto/src/liballoc/heap.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,6 @@ mod imp {
136136
use libc::{c_char, c_int, c_void, size_t};
137137

138138
#[link(name = "jemalloc", kind = "static")]
139-
#[cfg(not(test))]
140-
extern {}
141-
142139
extern {
143140
fn je_mallocx(size: size_t, flags: c_int) -> *mut c_void;
144141
fn je_rallocx(ptr: *mut c_void, size: size_t,

branches/auto/src/libcore/fmt/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ impl<'a> Arguments<'a> {
127127
/// to prevent modification.
128128
///
129129
/// The `format_args!` macro will safely create an instance of this structure
130-
/// and pass it to a function or closure, passed as the first argument. The
131-
/// macro validates the format string at compile-time so usage of the `write`
132-
/// and `format` functions can be safely performed.
130+
/// and pass it to a user-supplied function. The macro validates the format
131+
/// string at compile-time so usage of the `write` and `format` functions can
132+
/// be safely performed.
133133
pub struct Arguments<'a> {
134134
fmt: &'a [rt::Piece<'a>],
135135
args: &'a [Argument<'a>],

branches/auto/src/libcore/slice.rs

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,6 @@ pub trait ImmutableVector<'a, T> {
7676
* Fails when `end` points outside the bounds of self.
7777
*/
7878
fn slice_to(&self, end: uint) -> &'a [T];
79-
80-
/// Divides one slice into two at an index.
81-
///
82-
/// The first will contain all indices from `[0, mid)` (excluding
83-
/// the index `mid` itself) and the second will contain all
84-
/// indices from `[mid, len)` (excluding the index `len` itself).
85-
///
86-
/// Fails if `mid > len`.
87-
fn split_at(&self, mid: uint) -> (&'a [T], &'a [T]);
88-
8979
/// Returns an iterator over the vector
9080
fn iter(self) -> Items<'a, T>;
9181
/// Returns an iterator over the subslices of the vector which are
@@ -257,11 +247,6 @@ impl<'a,T> ImmutableVector<'a, T> for &'a [T] {
257247
self.slice(0, end)
258248
}
259249

260-
#[inline]
261-
fn split_at(&self, mid: uint) -> (&'a [T], &'a [T]) {
262-
(self.slice(0, mid), self.slice(mid, self.len()))
263-
}
264-
265250
#[inline]
266251
fn iter(self) -> Items<'a, T> {
267252
unsafe {
@@ -1207,7 +1192,8 @@ impl<'a, T> Iterator<&'a [T]> for Chunks<'a, T> {
12071192
None
12081193
} else {
12091194
let chunksz = cmp::min(self.v.len(), self.size);
1210-
let (fst, snd) = self.v.split_at(chunksz);
1195+
let (fst, snd) = (self.v.slice_to(chunksz),
1196+
self.v.slice_from(chunksz));
12111197
self.v = snd;
12121198
Some(fst)
12131199
}
@@ -1233,7 +1219,8 @@ impl<'a, T> DoubleEndedIterator<&'a [T]> for Chunks<'a, T> {
12331219
} else {
12341220
let remainder = self.v.len() % self.size;
12351221
let chunksz = if remainder != 0 { remainder } else { self.size };
1236-
let (fst, snd) = self.v.split_at(self.v.len() - chunksz);
1222+
let (fst, snd) = (self.v.slice_to(self.v.len() - chunksz),
1223+
self.v.slice_from(self.v.len() - chunksz));
12371224
self.v = fst;
12381225
Some(snd)
12391226
}

branches/auto/src/libfourcc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
124124
(val << 8) | (byte as u32)
125125
};
126126
}
127-
let e = cx.expr_lit(sp, ast::LitInt(val as u64, ast::UnsignedIntLit(ast::TyU32)));
127+
let e = cx.expr_lit(sp, ast::LitUint(val as u64, ast::TyU32));
128128
MacExpr::new(e)
129129
}
130130

branches/auto/src/libgetopts/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ pub enum Name {
115115
pub enum HasArg {
116116
/// The option requires an argument.
117117
Yes,
118-
/// The option is just a flag, therefore no argument.
118+
/// The option takes no argument.
119119
No,
120-
/// The option argument is optional and it could or not exist.
120+
/// The option argument is optional.
121121
Maybe,
122122
}
123123

@@ -126,9 +126,9 @@ pub enum HasArg {
126126
pub enum Occur {
127127
/// The option occurs once.
128128
Req,
129-
/// The option could or not occur.
129+
/// The option occurs at most once.
130130
Optional,
131-
/// The option occurs once or multiple times.
131+
/// The option occurs zero or more times.
132132
Multi,
133133
}
134134

branches/auto/src/libnative/io/file_win32.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,8 @@ pub fn lstat(_p: &CString) -> IoResult<rtio::FileStat> {
516516

517517
pub fn utime(p: &CString, atime: u64, mtime: u64) -> IoResult<()> {
518518
let mut buf = libc::utimbuf {
519-
actime: atime as libc::time64_t,
520-
modtime: mtime as libc::time64_t,
519+
actime: (atime / 1000) as libc::time64_t,
520+
modtime: (mtime / 1000) as libc::time64_t,
521521
};
522522
let p = try!(to_utf16(p));
523523
super::mkerr_libc(unsafe {

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

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,27 +66,26 @@ fn ip_to_inaddr(ip: rtio::IpAddr) -> InAddr {
6666
}
6767
}
6868

69-
fn addr_to_sockaddr(addr: rtio::SocketAddr,
70-
storage: &mut libc::sockaddr_storage)
71-
-> libc::socklen_t {
69+
fn addr_to_sockaddr(addr: rtio::SocketAddr) -> (libc::sockaddr_storage, uint) {
7270
unsafe {
71+
let storage: libc::sockaddr_storage = mem::zeroed();
7372
let len = match ip_to_inaddr(addr.ip) {
7473
InAddr(inaddr) => {
75-
let storage = storage as *mut _ as *mut libc::sockaddr_in;
74+
let storage: *mut libc::sockaddr_in = mem::transmute(&storage);
7675
(*storage).sin_family = libc::AF_INET as libc::sa_family_t;
7776
(*storage).sin_port = htons(addr.port);
7877
(*storage).sin_addr = inaddr;
7978
mem::size_of::<libc::sockaddr_in>()
8079
}
8180
In6Addr(inaddr) => {
82-
let storage = storage as *mut _ as *mut libc::sockaddr_in6;
81+
let storage: *mut libc::sockaddr_in6 = mem::transmute(&storage);
8382
(*storage).sin6_family = libc::AF_INET6 as libc::sa_family_t;
8483
(*storage).sin6_port = htons(addr.port);
8584
(*storage).sin6_addr = inaddr;
8685
mem::size_of::<libc::sockaddr_in6>()
8786
}
8887
};
89-
return len as libc::socklen_t;
88+
return (storage, len);
9089
}
9190
}
9291

@@ -278,9 +277,9 @@ impl TcpStream {
278277
let fd = try!(socket(addr, libc::SOCK_STREAM));
279278
let ret = TcpStream::new(Inner::new(fd));
280279

281-
let mut storage = unsafe { mem::zeroed() };
282-
let len = addr_to_sockaddr(addr, &mut storage);
283-
let addrp = &storage as *const _ as *const libc::sockaddr;
280+
let (addr, len) = addr_to_sockaddr(addr);
281+
let addrp = &addr as *const _ as *const libc::sockaddr;
282+
let len = len as libc::socklen_t;
284283

285284
match timeout {
286285
Some(timeout) => {
@@ -458,9 +457,9 @@ impl TcpListener {
458457
let fd = try!(socket(addr, libc::SOCK_STREAM));
459458
let ret = TcpListener { inner: Inner::new(fd) };
460459

461-
let mut storage = unsafe { mem::zeroed() };
462-
let len = addr_to_sockaddr(addr, &mut storage);
463-
let addrp = &storage as *const _ as *const libc::sockaddr;
460+
let (addr, len) = addr_to_sockaddr(addr);
461+
let addrp = &addr as *const _ as *const libc::sockaddr;
462+
let len = len as libc::socklen_t;
464463

465464
// On platforms with Berkeley-derived sockets, this allows
466465
// to quickly rebind a socket, without needing to wait for
@@ -567,9 +566,9 @@ impl UdpSocket {
567566
write_deadline: 0,
568567
};
569568

570-
let mut storage = unsafe { mem::zeroed() };
571-
let len = addr_to_sockaddr(addr, &mut storage);
572-
let addrp = &storage as *const _ as *const libc::sockaddr;
569+
let (addr, len) = addr_to_sockaddr(addr);
570+
let addrp = &addr as *const _ as *const libc::sockaddr;
571+
let len = len as libc::socklen_t;
573572

574573
match unsafe { libc::bind(fd, addrp, len) } {
575574
-1 => Err(last_error()),
@@ -657,9 +656,9 @@ impl rtio::RtioUdpSocket for UdpSocket {
657656
}
658657

659658
fn send_to(&mut self, buf: &[u8], dst: rtio::SocketAddr) -> IoResult<()> {
660-
let mut storage = unsafe { mem::zeroed() };
661-
let dstlen = addr_to_sockaddr(dst, &mut storage);
662-
let dstp = &storage as *const _ as *const libc::sockaddr;
659+
let (dst, dstlen) = addr_to_sockaddr(dst);
660+
let dstp = &dst as *const _ as *const libc::sockaddr;
661+
let dstlen = dstlen as libc::socklen_t;
663662

664663
let fd = self.fd();
665664
let dolock = || self.lock_nonblocking();

0 commit comments

Comments
 (0)