Skip to content

Commit a7b8e16

Browse files
committed
---
yaml --- r: 185535 b: refs/heads/master c: 704ce1d h: refs/heads/master i: 185533: 741fd8a 185531: 13fd82e 185527: ffd5bd0 185519: 224d984 185503: bd4e029 185471: 9b60322 v: v3
1 parent 3ed509b commit a7b8e16

Some content is hidden

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

75 files changed

+204
-1150
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: 204adc9ab83ff7ab4873fa5ee7bd58190799c538
2+
refs/heads/master: 704ce1d735cc885718fc5d1d4b2b5ca55410271e
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 3a96d6a9818fe2affc98a187fb1065120458cee9
55
refs/heads/try: ccf8fedf1cffcb8f6f3581d53d220039e192fe77

trunk/src/doc/reference.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ nonzero_dec: '1' | '2' | '3' | '4'
302302

303303
A _character literal_ is a single Unicode character enclosed within two
304304
`U+0027` (single-quote) characters, with the exception of `U+0027` itself,
305-
which must be _escaped_ by a preceding `U+005C` character (`\`).
305+
which must be _escaped_ by a preceding U+005C character (`\`).
306306

307307
##### String literals
308308

@@ -311,19 +311,6 @@ A _string literal_ is a sequence of any Unicode characters enclosed within two
311311
which must be _escaped_ by a preceding `U+005C` character (`\`), or a _raw
312312
string literal_.
313313

314-
A multi-line string literal may be defined by terminating each line with a
315-
`U+005C` character (`\`) immediately before the newline. This causes the
316-
`U+005C` character, the newline, and all whitespace at the beginning of the
317-
next line to be ignored.
318-
319-
```rust
320-
let a = "foobar";
321-
let b = "foo\
322-
bar";
323-
324-
assert_eq!(a,b);
325-
```
326-
327314
##### Character escapes
328315

329316
Some additional _escapes_ are available in either character or non-raw string

trunk/src/doc/trpl/hello-cargo.md

Lines changed: 4 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@ the Cargo
1818
README](https://github.com/rust-lang/cargo#installing-cargo-from-nightlies)
1919
for specific instructions about installing it.
2020

21-
## Converting to Cargo
22-
2321
Let's convert Hello World to Cargo.
2422

2523
To Cargo-ify our project, we need to do two things: Make a `Cargo.toml`
2624
configuration file, and put our source file in the right place. Let's
2725
do that part first:
2826

29-
```bash
27+
```{bash}
3028
$ mkdir src
3129
$ mv main.rs src/main.rs
3230
```
@@ -38,7 +36,7 @@ place for everything, and everything in its place.
3836

3937
Next, our configuration file:
4038

41-
```bash
39+
```{bash}
4240
$ editor Cargo.toml
4341
```
4442

@@ -75,7 +73,7 @@ well as what it is named.
7573

7674
Once you have this file in place, we should be ready to build! Try this:
7775

78-
```bash
76+
```{bash}
7977
$ cargo build
8078
Compiling hello_world v0.0.1 (file:///home/yourname/projects/hello_world)
8179
$ ./target/hello_world
@@ -105,62 +103,6 @@ That's it! We've successfully built `hello_world` with Cargo. Even though our
105103
program is simple, it's using much of the real tooling that you'll use for the
106104
rest of your Rust career.
107105

108-
## A New Project
109-
110-
You don't have to go through this whole process every time you want to start a new
111-
project! Cargo has the ability to make a bare-bones project directory in which you
112-
can start developing right away.
113-
114-
To start a new project with Cargo, use `cargo new`:
115-
116-
```bash
117-
$ cargo new hello_world --bin
118-
```
119-
120-
We're passing `--bin` because we're making a binary program: if we
121-
were making a library, we'd leave it off.
122-
123-
Let's check out what Cargo has generated for us:
124-
125-
```bash
126-
$ cd hello_world
127-
$ tree .
128-
.
129-
├── Cargo.toml
130-
└── src
131-
└── main.rs
132-
133-
1 directory, 2 files
134-
```
135-
136-
If you don't have the `tree` command, you can probably get it from your distro's package
137-
manager. It's not necessary, but it's certainly useful.
138-
139-
This is all we need to get started. First, let's check out `Cargo.toml`:
140-
141-
```toml
142-
[package]
143-
144-
name = "hello_world"
145-
version = "0.0.1"
146-
authors = ["Your Name <[email protected]>"]
147-
```
148-
149-
Cargo has populated this file with reasonable defaults based off the arguments you gave
150-
it and your `git` global configuration. You may notice that Cargo has also initialized
151-
the `hello_world` directory as a `git` repository.
152-
153-
Here's what's in `src/main.rs`:
154-
155-
```rust
156-
fn main() {
157-
println!("Hello, world!");
158-
}
159-
```
160-
161-
Cargo has generated a "Hello World!" for us, and you're ready to start coding! A
162-
much more in-depth guide to Cargo can be found [here](http://doc.crates.io/guide.html).
163-
164106
Now that you've got the tools down, let's actually learn more about the Rust
165107
language itself. These are the basics that will serve you well through the rest
166-
of your time with Rust.
108+
of your time with Rust.

trunk/src/etc/htmldocck.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@
9696
highlights for example. If you want to simply check the presence of
9797
given node or attribute, use an empty string (`""`) as a `PATTERN`.
9898
99-
* `@count PATH XPATH COUNT' checks for the occurrence of given XPath
100-
in the given file. The number of occurrences must match the given count.
101-
10299
All conditions can be negated with `!`. `@!has foo/type.NoSuch.html`
103100
checks if the given file does not exist, for example.
104101
@@ -336,11 +333,6 @@ def check_tree_text(tree, path, pat, regexp):
336333
return ret
337334

338335

339-
def check_tree_count(tree, path, count):
340-
path = normalize_xpath(path)
341-
return len(tree.findall(path)) == count
342-
343-
344336
def check(target, commands):
345337
cache = CachedFiles(target)
346338
for c in commands:
@@ -368,13 +360,6 @@ def check(target, commands):
368360
raise RuntimeError('Invalid number of @{} arguments \
369361
at line {}'.format(c.cmd, c.lineno))
370362

371-
elif c.cmd == 'count': # count test
372-
if len(c.args) == 3: # @count <path> <pat> <count> = count test
373-
ret = check_tree_count(cache.get_tree(c.args[0]), c.args[1], int(c.args[2]))
374-
else:
375-
raise RuntimeError('Invalid number of @{} arguments \
376-
at line {}'.format(c.cmd, c.lineno))
377-
378363
elif c.cmd == 'valid-html':
379364
raise RuntimeError('Unimplemented @valid-html at line {}'.format(c.lineno))
380365

trunk/src/liballoc/arc.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,6 @@ pub struct Weak<T> {
139139
unsafe impl<T: Sync + Send> Send for Weak<T> { }
140140
unsafe impl<T: Sync + Send> Sync for Weak<T> { }
141141

142-
#[stable(feature = "rust1", since = "1.0.0")]
143-
impl<T: fmt::Debug> fmt::Debug for Weak<T> {
144-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
145-
write!(f, "(Weak)")
146-
}
147-
}
148-
149142
struct ArcInner<T> {
150143
strong: atomic::AtomicUsize,
151144
weak: atomic::AtomicUsize,

trunk/src/liballoc/heap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ mod imp {
300300
libc::realloc(ptr as *mut libc::c_void, size as libc::size_t) as *mut u8
301301
} else {
302302
let new_ptr = allocate(size, align);
303-
ptr::copy(new_ptr, ptr, cmp::min(size, old_size));
303+
ptr::copy_memory(new_ptr, ptr, cmp::min(size, old_size));
304304
deallocate(ptr, old_size, align);
305305
new_ptr
306306
}

trunk/src/libcollections/btree/node.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ impl<K, V> Node<K, V> {
10851085
vals: RawItems::from_slice(self.vals()),
10861086
edges: RawItems::from_slice(self.edges()),
10871087

1088-
ptr: Unique::new(*self.keys as *mut u8),
1088+
ptr: *self.keys as *mut u8,
10891089
capacity: self.capacity(),
10901090
is_leaf: self.is_leaf()
10911091
},
@@ -1354,14 +1354,11 @@ struct MoveTraversalImpl<K, V> {
13541354
edges: RawItems<Node<K, V>>,
13551355

13561356
// For deallocation when we are done iterating.
1357-
ptr: Unique<u8>,
1357+
ptr: *mut u8,
13581358
capacity: usize,
13591359
is_leaf: bool
13601360
}
13611361

1362-
unsafe impl<K: Sync, V: Sync> Sync for MoveTraversalImpl<K, V> {}
1363-
unsafe impl<K: Send, V: Send> Send for MoveTraversalImpl<K, V> {}
1364-
13651362
impl<K, V> TraversalImpl for MoveTraversalImpl<K, V> {
13661363
type Item = (K, V);
13671364
type Edge = Node<K, V>;
@@ -1404,7 +1401,7 @@ impl<K, V> Drop for MoveTraversalImpl<K, V> {
14041401

14051402
let (alignment, size) =
14061403
calculate_allocation_generic::<K, V>(self.capacity, self.is_leaf);
1407-
unsafe { heap::deallocate(*self.ptr, size, alignment) };
1404+
unsafe { heap::deallocate(self.ptr, size, alignment) };
14081405
}
14091406
}
14101407

@@ -1428,12 +1425,12 @@ pub enum TraversalItem<K, V, E> {
14281425
/// A traversal over a node's entries and edges
14291426
pub type Traversal<'a, K, V> = AbsTraversal<ElemsAndEdges<Zip<slice::Iter<'a, K>,
14301427
slice::Iter<'a, V>>,
1431-
slice::Iter<'a, Node<K, V>>>>;
1428+
slice::Iter<'a, Node<K, V>>>>;
14321429

14331430
/// A mutable traversal over a node's entries and edges
14341431
pub type MutTraversal<'a, K, V> = AbsTraversal<ElemsAndEdges<Zip<slice::Iter<'a, K>,
14351432
slice::IterMut<'a, V>>,
1436-
slice::IterMut<'a, Node<K, V>>>>;
1433+
slice::IterMut<'a, Node<K, V>>>>;
14371434

14381435
/// An owning traversal over a node's entries and edges
14391436
pub type MoveTraversal<K, V> = AbsTraversal<MoveTraversalImpl<K, V>>;

trunk/src/libcollections/linked_list.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ struct Rawlink<T> {
5151
}
5252

5353
impl<T> Copy for Rawlink<T> {}
54-
unsafe impl<T:Send> Send for Rawlink<T> {}
55-
unsafe impl<T:Sync> Sync for Rawlink<T> {}
54+
unsafe impl<T:'static+Send> Send for Rawlink<T> {}
55+
unsafe impl<T:Send+Sync> Sync for Rawlink<T> {}
5656

5757
struct Node<T> {
5858
next: Link<T>,

trunk/src/libcollections/slice.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2663,15 +2663,15 @@ mod tests {
26632663
let (left, right) = values.split_at_mut(2);
26642664
{
26652665
let left: &[_] = left;
2666-
assert!(left[..left.len()] == [1, 2]);
2666+
assert!(left[..left.len()] == [1, 2][]);
26672667
}
26682668
for p in left {
26692669
*p += 1;
26702670
}
26712671

26722672
{
26732673
let right: &[_] = right;
2674-
assert!(right[..right.len()] == [3, 4, 5]);
2674+
assert!(right[..right.len()] == [3, 4, 5][]);
26752675
}
26762676
for p in right {
26772677
*p += 2;

trunk/src/libcollections/vec.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,9 +1755,6 @@ pub struct Drain<'a, T:'a> {
17551755
marker: PhantomData<&'a T>,
17561756
}
17571757

1758-
unsafe impl<'a, T: Sync> Sync for Drain<'a, T> {}
1759-
unsafe impl<'a, T: Send> Send for Drain<'a, T> {}
1760-
17611758
#[stable(feature = "rust1", since = "1.0.0")]
17621759
impl<'a, T> Iterator for Drain<'a, T> {
17631760
type Item = T;
@@ -2093,15 +2090,15 @@ mod tests {
20932090
let (left, right) = values.split_at_mut(2);
20942091
{
20952092
let left: &[_] = left;
2096-
assert!(&left[..left.len()] == &[1, 2]);
2093+
assert!(&left[..left.len()] == &[1, 2][]);
20972094
}
20982095
for p in left {
20992096
*p += 1;
21002097
}
21012098

21022099
{
21032100
let right: &[_] = right;
2104-
assert!(&right[..right.len()] == &[3, 4, 5]);
2101+
assert!(&right[..right.len()] == &[3, 4, 5][]);
21052102
}
21062103
for p in right {
21072104
*p += 2;

trunk/src/libcollections/vec_deque.rs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use core::cmp::Ordering;
2424
use core::default::Default;
2525
use core::fmt;
2626
use core::iter::{self, repeat, FromIterator, IntoIterator, RandomAccessIterator};
27+
use core::marker;
2728
use core::mem;
2829
use core::num::{Int, UnsignedInt};
2930
use core::ops::{Index, IndexMut};
@@ -58,6 +59,12 @@ pub struct VecDeque<T> {
5859
ptr: Unique<T>,
5960
}
6061

62+
#[stable(feature = "rust1", since = "1.0.0")]
63+
unsafe impl<T: Send> Send for VecDeque<T> {}
64+
65+
#[stable(feature = "rust1", since = "1.0.0")]
66+
unsafe impl<T: Sync> Sync for VecDeque<T> {}
67+
6168
#[stable(feature = "rust1", since = "1.0.0")]
6269
impl<T: Clone> Clone for VecDeque<T> {
6370
fn clone(&self) -> VecDeque<T> {
@@ -538,7 +545,9 @@ impl<T> VecDeque<T> {
538545
IterMut {
539546
tail: self.tail,
540547
head: self.head,
541-
ring: unsafe { self.buffer_as_mut_slice() },
548+
cap: self.cap,
549+
ptr: *self.ptr,
550+
marker: marker::PhantomData,
542551
}
543552
}
544553

@@ -1506,12 +1515,17 @@ impl<'a, T> RandomAccessIterator for Iter<'a, T> {
15061515
}
15071516
}
15081517

1518+
// FIXME This was implemented differently from Iter because of a problem
1519+
// with returning the mutable reference. I couldn't find a way to
1520+
// make the lifetime checker happy so, but there should be a way.
15091521
/// `VecDeque` mutable iterator.
15101522
#[stable(feature = "rust1", since = "1.0.0")]
15111523
pub struct IterMut<'a, T:'a> {
1512-
ring: &'a mut [T],
1524+
ptr: *mut T,
15131525
tail: usize,
15141526
head: usize,
1527+
cap: usize,
1528+
marker: marker::PhantomData<&'a mut T>,
15151529
}
15161530

15171531
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1524,17 +1538,16 @@ impl<'a, T> Iterator for IterMut<'a, T> {
15241538
return None;
15251539
}
15261540
let tail = self.tail;
1527-
self.tail = wrap_index(self.tail + 1, self.ring.len());
1541+
self.tail = wrap_index(self.tail + 1, self.cap);
15281542

15291543
unsafe {
1530-
let elem = self.ring.get_unchecked_mut(tail);
1531-
Some(&mut *(elem as *mut _))
1544+
Some(&mut *self.ptr.offset(tail as isize))
15321545
}
15331546
}
15341547

15351548
#[inline]
15361549
fn size_hint(&self) -> (usize, Option<usize>) {
1537-
let len = count(self.tail, self.head, self.ring.len());
1550+
let len = count(self.tail, self.head, self.cap);
15381551
(len, Some(len))
15391552
}
15401553
}
@@ -1546,11 +1559,10 @@ impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
15461559
if self.tail == self.head {
15471560
return None;
15481561
}
1549-
self.head = wrap_index(self.head - 1, self.ring.len());
1562+
self.head = wrap_index(self.head - 1, self.cap);
15501563

15511564
unsafe {
1552-
let elem = self.ring.get_unchecked_mut(self.head);
1553-
Some(&mut *(elem as *mut _))
1565+
Some(&mut *self.ptr.offset(self.head as isize))
15541566
}
15551567
}
15561568
}

0 commit comments

Comments
 (0)