Skip to content

Commit b6423e6

Browse files
committed
---
yaml --- r: 126398 b: refs/heads/master c: 68bde0a h: refs/heads/master v: v3
1 parent d4286bd commit b6423e6

Some content is hidden

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

82 files changed

+555
-720
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: 223c043110c0eb35847bca41e58c0ce11110d78a
2+
refs/heads/master: 68bde0a07396efb415d61047c6b2a8183f47ef30
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 9fc8394d3bce22ab483f98842434c84c396212ae
55
refs/heads/try: cd2003ffd8dd976342f9e8fc1429ae93d6780e81

trunk/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

trunk/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

trunk/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]

trunk/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

trunk/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"/>

trunk/src/liballoc/arc.rs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//! Concurrency-enabled mechanisms for sharing mutable and/or immutable state
1414
//! between tasks.
1515
16-
use core::atomics;
16+
use core::atomic;
1717
use core::clone::Clone;
1818
use core::kinds::{Share, Send};
1919
use core::mem::{min_align_of, size_of, drop};
@@ -71,8 +71,8 @@ pub struct Weak<T> {
7171
}
7272

7373
struct ArcInner<T> {
74-
strong: atomics::AtomicUint,
75-
weak: atomics::AtomicUint,
74+
strong: atomic::AtomicUint,
75+
weak: atomic::AtomicUint,
7676
data: T,
7777
}
7878

@@ -84,8 +84,8 @@ impl<T: Share + Send> Arc<T> {
8484
// Start the weak pointer count as 1 which is the weak pointer that's
8585
// held by all the strong pointers (kinda), see std/rc.rs for more info
8686
let x = box ArcInner {
87-
strong: atomics::AtomicUint::new(1),
88-
weak: atomics::AtomicUint::new(1),
87+
strong: atomic::AtomicUint::new(1),
88+
weak: atomic::AtomicUint::new(1),
8989
data: data,
9090
};
9191
Arc { _ptr: unsafe { mem::transmute(x) } }
@@ -109,7 +109,7 @@ impl<T: Share + Send> Arc<T> {
109109
#[experimental = "Weak pointers may not belong in this module."]
110110
pub fn downgrade(&self) -> Weak<T> {
111111
// See the clone() impl for why this is relaxed
112-
self.inner().weak.fetch_add(1, atomics::Relaxed);
112+
self.inner().weak.fetch_add(1, atomic::Relaxed);
113113
Weak { _ptr: self._ptr }
114114
}
115115
}
@@ -134,7 +134,7 @@ impl<T: Share + Send> Clone for Arc<T> {
134134
// another must already provide any required synchronization.
135135
//
136136
// [1]: (www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html)
137-
self.inner().strong.fetch_add(1, atomics::Relaxed);
137+
self.inner().strong.fetch_add(1, atomic::Relaxed);
138138
Arc { _ptr: self._ptr }
139139
}
140140
}
@@ -159,8 +159,8 @@ impl<T: Send + Share + Clone> Arc<T> {
159159
// Note that we hold a strong reference, which also counts as
160160
// a weak reference, so we only clone if there is an
161161
// additional reference of either kind.
162-
if self.inner().strong.load(atomics::SeqCst) != 1 ||
163-
self.inner().weak.load(atomics::SeqCst) != 1 {
162+
if self.inner().strong.load(atomic::SeqCst) != 1 ||
163+
self.inner().weak.load(atomic::SeqCst) != 1 {
164164
*self = Arc::new(self.deref().clone())
165165
}
166166
// This unsafety is ok because we're guaranteed that the pointer
@@ -185,7 +185,7 @@ impl<T: Share + Send> Drop for Arc<T> {
185185
// Because `fetch_sub` is already atomic, we do not need to synchronize
186186
// with other threads unless we are going to delete the object. This
187187
// same logic applies to the below `fetch_sub` to the `weak` count.
188-
if self.inner().strong.fetch_sub(1, atomics::Release) != 1 { return }
188+
if self.inner().strong.fetch_sub(1, atomic::Release) != 1 { return }
189189

190190
// This fence is needed to prevent reordering of use of the data and
191191
// deletion of the data. Because it is marked `Release`, the
@@ -204,14 +204,14 @@ impl<T: Share + Send> Drop for Arc<T> {
204204
// and an "acquire" operation before deleting the object.
205205
//
206206
// [1]: (www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html)
207-
atomics::fence(atomics::Acquire);
207+
atomic::fence(atomic::Acquire);
208208

209209
// Destroy the data at this time, even though we may not free the box
210210
// allocation itself (there may still be weak pointers lying around).
211211
unsafe { drop(ptr::read(&self.inner().data)); }
212212

213-
if self.inner().weak.fetch_sub(1, atomics::Release) == 1 {
214-
atomics::fence(atomics::Acquire);
213+
if self.inner().weak.fetch_sub(1, atomic::Release) == 1 {
214+
atomic::fence(atomic::Acquire);
215215
unsafe { deallocate(self._ptr as *mut u8, size_of::<ArcInner<T>>(),
216216
min_align_of::<ArcInner<T>>()) }
217217
}
@@ -230,9 +230,9 @@ impl<T: Share + Send> Weak<T> {
230230
// fetch_add because once the count hits 0 is must never be above 0.
231231
let inner = self.inner();
232232
loop {
233-
let n = inner.strong.load(atomics::SeqCst);
233+
let n = inner.strong.load(atomic::SeqCst);
234234
if n == 0 { return None }
235-
let old = inner.strong.compare_and_swap(n, n + 1, atomics::SeqCst);
235+
let old = inner.strong.compare_and_swap(n, n + 1, atomic::SeqCst);
236236
if old == n { return Some(Arc { _ptr: self._ptr }) }
237237
}
238238
}
@@ -249,7 +249,7 @@ impl<T: Share + Send> Clone for Weak<T> {
249249
#[inline]
250250
fn clone(&self) -> Weak<T> {
251251
// See comments in Arc::clone() for why this is relaxed
252-
self.inner().weak.fetch_add(1, atomics::Relaxed);
252+
self.inner().weak.fetch_add(1, atomic::Relaxed);
253253
Weak { _ptr: self._ptr }
254254
}
255255
}
@@ -264,8 +264,8 @@ impl<T: Share + Send> Drop for Weak<T> {
264264
// If we find out that we were the last weak pointer, then its time to
265265
// deallocate the data entirely. See the discussion in Arc::drop() about
266266
// the memory orderings
267-
if self.inner().weak.fetch_sub(1, atomics::Release) == 1 {
268-
atomics::fence(atomics::Acquire);
267+
if self.inner().weak.fetch_sub(1, atomic::Release) == 1 {
268+
atomic::fence(atomic::Acquire);
269269
unsafe { deallocate(self._ptr as *mut u8, size_of::<ArcInner<T>>(),
270270
min_align_of::<ArcInner<T>>()) }
271271
}
@@ -281,21 +281,21 @@ mod tests {
281281
use std::mem::drop;
282282
use std::ops::Drop;
283283
use std::option::{Option, Some, None};
284-
use std::sync::atomics;
284+
use std::sync::atomic;
285285
use std::task;
286286
use std::vec::Vec;
287287
use super::{Arc, Weak};
288288
use std::sync::Mutex;
289289

290-
struct Canary(*mut atomics::AtomicUint);
290+
struct Canary(*mut atomic::AtomicUint);
291291

292292
impl Drop for Canary
293293
{
294294
fn drop(&mut self) {
295295
unsafe {
296296
match *self {
297297
Canary(c) => {
298-
(*c).fetch_add(1, atomics::SeqCst);
298+
(*c).fetch_add(1, atomic::SeqCst);
299299
}
300300
}
301301
}
@@ -413,20 +413,20 @@ mod tests {
413413

414414
#[test]
415415
fn drop_arc() {
416-
let mut canary = atomics::AtomicUint::new(0);
417-
let x = Arc::new(Canary(&mut canary as *mut atomics::AtomicUint));
416+
let mut canary = atomic::AtomicUint::new(0);
417+
let x = Arc::new(Canary(&mut canary as *mut atomic::AtomicUint));
418418
drop(x);
419-
assert!(canary.load(atomics::Acquire) == 1);
419+
assert!(canary.load(atomic::Acquire) == 1);
420420
}
421421

422422
#[test]
423423
fn drop_arc_weak() {
424-
let mut canary = atomics::AtomicUint::new(0);
425-
let arc = Arc::new(Canary(&mut canary as *mut atomics::AtomicUint));
424+
let mut canary = atomic::AtomicUint::new(0);
425+
let arc = Arc::new(Canary(&mut canary as *mut atomic::AtomicUint));
426426
let arc_weak = arc.downgrade();
427-
assert!(canary.load(atomics::Acquire) == 0);
427+
assert!(canary.load(atomic::Acquire) == 0);
428428
drop(arc);
429-
assert!(canary.load(atomics::Acquire) == 1);
429+
assert!(canary.load(atomic::Acquire) == 1);
430430
drop(arc_weak);
431431
}
432432
}

trunk/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,

0 commit comments

Comments
 (0)