Skip to content

Commit 6ddcec5

Browse files
committed
---
yaml --- r: 124590 b: refs/heads/auto c: 0c30e1f h: refs/heads/master v: v3
1 parent 09a6c49 commit 6ddcec5

File tree

106 files changed

+989
-2858
lines changed

Some content is hidden

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

106 files changed

+989
-2858
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: 793b1424ac52b7d1cb20e508e313ce516530cea7
16+
refs/heads/auto: 0c30e1faad86214e28454d223ffa040212897a1e
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/mk/docs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ DOCS := index intro tutorial guide guide-ffi guide-macros guide-lifetimes \
3030
guide-tasks guide-container guide-pointers guide-testing \
3131
guide-runtime complement-bugreport \
3232
complement-lang-faq complement-design-faq complement-project-faq rust \
33-
rustdoc guide-unsafe
33+
rustdoc guide-unsafe guide-strings
3434

3535
PDF_DOCS := tutorial rust
3636

branches/auto/src/doc/guide-strings.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
% The Strings Guide
22

3-
# Strings
4-
53
Strings are an important concept to master in any programming language. If you
64
come from a managed language background, you may be surprised at the complexity
75
of string handling in a systems programming language. Efficient access and
@@ -14,7 +12,7 @@ Additionally, strings are not null-terminated and can contain null bytes.
1412

1513
Rust has two main types of strings: `&str` and `String`.
1614

17-
## &str
15+
# &str
1816

1917
The first kind is a `&str`. This is pronounced a 'string slice.' String literals
2018
are of the type `&str`:
@@ -38,7 +36,7 @@ Like vector slices, string slices are simply a pointer plus a length. This
3836
means that they're a 'view' into an already-allocated string, such as a
3937
`&'static str` or a `String`.
4038

41-
## String
39+
# String
4240

4341
A `String` is a heap-allocated string. This string is growable, and is also
4442
guaranteed to be UTF-8.
@@ -73,9 +71,9 @@ let x: &[u8] = &[b'a', b'b'];
7371
let stack_str: &str = str::from_utf8(x).unwrap();
7472
```
7573

76-
## Best Practices
74+
# Best Practices
7775

78-
### `String` vs. `&str`
76+
## `String` vs. `&str`
7977

8078
In general, you should prefer `String` when you need ownership, and `&str` when
8179
you just need to borrow a string. This is very similar to using `Vec<T>` vs. `&[T]`,
@@ -98,7 +96,7 @@ need, and it can make your lifetimes more complex. Furthermore, you can pass
9896
either kind of string into `foo` by using `.as_slice()` on any `String` you
9997
need to pass in, so the `&str` version is more flexible.
10098

101-
### Comparisons
99+
## Comparisons
102100

103101
To compare a String to a constant string, prefer `as_slice()`...
104102

@@ -123,7 +121,7 @@ fn compare(string: String) {
123121
Converting a `String` to a `&str` is cheap, but converting the `&str` to a
124122
`String` involves an allocation.
125123

126-
## Other Documentation
124+
# Other Documentation
127125

128126
* [the `&str` API documentation](/std/str/index.html)
129127
* [the `String` API documentation](std/string/index.html)

branches/auto/src/doc/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ li {list-style-type: none; }
1313

1414
# Guides
1515

16+
* [Strings](guide-strings.html)
1617
* [Pointers](guide-pointers.html)
1718
* [References and Lifetimes](guide-lifetimes.html)
1819
* [Containers and Iterators](guide-container.html)

branches/auto/src/libcollections/dlist.rs

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -278,23 +278,6 @@ impl<T> DList<T> {
278278
/// Move the last element to the front of the list.
279279
///
280280
/// If the list is empty, do nothing.
281-
///
282-
/// # Example
283-
///
284-
/// ```rust
285-
/// use std::collections::{DList, Deque};
286-
///
287-
/// let mut dl = DList::new();
288-
/// dl.push_back(1i);
289-
/// dl.push_back(2);
290-
/// dl.push_back(3);
291-
///
292-
/// dl.rotate_forward();
293-
///
294-
/// for e in dl.iter() {
295-
/// println!("{}", e); // prints 3, then 1, then 2
296-
/// }
297-
/// ```
298281
#[inline]
299282
pub fn rotate_forward(&mut self) {
300283
self.pop_back_node().map(|tail| {
@@ -305,23 +288,6 @@ impl<T> DList<T> {
305288
/// Move the first element to the back of the list.
306289
///
307290
/// If the list is empty, do nothing.
308-
///
309-
/// # Example
310-
///
311-
/// ```rust
312-
/// use std::collections::{DList, Deque};
313-
///
314-
/// let mut dl = DList::new();
315-
/// dl.push_back(1i);
316-
/// dl.push_back(2);
317-
/// dl.push_back(3);
318-
///
319-
/// dl.rotate_backward();
320-
///
321-
/// for e in dl.iter() {
322-
/// println!("{}", e); // prints 2, then 3, then 1
323-
/// }
324-
/// ```
325291
#[inline]
326292
pub fn rotate_backward(&mut self) {
327293
self.pop_front_node().map(|head| {
@@ -332,25 +298,6 @@ impl<T> DList<T> {
332298
/// Add all elements from `other` to the end of the list
333299
///
334300
/// O(1)
335-
///
336-
/// # Example
337-
///
338-
/// ```rust
339-
/// use std::collections::{DList, Deque};
340-
///
341-
/// let mut a = DList::new();
342-
/// let mut b = DList::new();
343-
/// a.push_back(1i);
344-
/// a.push_back(2);
345-
/// b.push_back(3i);
346-
/// b.push_back(4);
347-
///
348-
/// a.append(b);
349-
///
350-
/// for e in a.iter() {
351-
/// println!("{}", e); // prints 1, then 2, then 3, then 4
352-
/// }
353-
/// ```
354301
pub fn append(&mut self, mut other: DList<T>) {
355302
match self.list_tail.resolve() {
356303
None => *self = other,
@@ -373,25 +320,6 @@ impl<T> DList<T> {
373320
/// Add all elements from `other` to the beginning of the list
374321
///
375322
/// O(1)
376-
///
377-
/// # Example
378-
///
379-
/// ```rust
380-
/// use std::collections::{DList, Deque};
381-
///
382-
/// let mut a = DList::new();
383-
/// let mut b = DList::new();
384-
/// a.push_back(1i);
385-
/// a.push_back(2);
386-
/// b.push_back(3i);
387-
/// b.push_back(4);
388-
///
389-
/// a.prepend(b);
390-
///
391-
/// for e in a.iter() {
392-
/// println!("{}", e); // prints 3, then 4, then 1, then 2
393-
/// }
394-
/// ```
395323
#[inline]
396324
pub fn prepend(&mut self, mut other: DList<T>) {
397325
mem::swap(self, &mut other);
@@ -402,25 +330,6 @@ impl<T> DList<T> {
402330
/// or at the end.
403331
///
404332
/// O(N)
405-
///
406-
/// # Example
407-
///
408-
/// ```rust
409-
/// use std::collections::{DList, Deque};
410-
///
411-
/// let mut a: DList<int> = DList::new();
412-
/// a.push_back(2i);
413-
/// a.push_back(4);
414-
/// a.push_back(7);
415-
/// a.push_back(8);
416-
///
417-
/// // insert 11 before the first odd number in the list
418-
/// a.insert_when(11, |&e, _| e % 2 == 1);
419-
///
420-
/// for e in a.iter() {
421-
/// println!("{}", e); // prints 2, then 4, then 11, then 7, then 8
422-
/// }
423-
/// ```
424333
pub fn insert_when(&mut self, elt: T, f: |&T, &T| -> bool) {
425334
{
426335
let mut it = self.mut_iter();

branches/auto/src/libcollections/str.rs

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,6 @@ impl OwnedStr for String {
808808
#[cfg(test)]
809809
mod tests {
810810
use std::iter::AdditiveIterator;
811-
use std::iter::range;
812811
use std::default::Default;
813812
use std::char::Char;
814813
use std::clone::Clone;
@@ -1611,30 +1610,6 @@ mod tests {
16111610
assert_eq!(pos, v.len());
16121611
}
16131612

1614-
#[test]
1615-
fn test_chars_decoding() {
1616-
let mut bytes = [0u8, ..4];
1617-
for c in range(0u32, 0x110000).filter_map(|c| ::core::char::from_u32(c)) {
1618-
let len = c.encode_utf8(bytes);
1619-
let s = ::core::str::from_utf8(bytes.slice_to(len)).unwrap();
1620-
if Some(c) != s.chars().next() {
1621-
fail!("character {:x}={} does not decode correctly", c as u32, c);
1622-
}
1623-
}
1624-
}
1625-
1626-
#[test]
1627-
fn test_chars_rev_decoding() {
1628-
let mut bytes = [0u8, ..4];
1629-
for c in range(0u32, 0x110000).filter_map(|c| ::core::char::from_u32(c)) {
1630-
let len = c.encode_utf8(bytes);
1631-
let s = ::core::str::from_utf8(bytes.slice_to(len)).unwrap();
1632-
if Some(c) != s.chars().rev().next() {
1633-
fail!("character {:x}={} does not decode correctly", c as u32, c);
1634-
}
1635-
}
1636-
}
1637-
16381613
#[test]
16391614
fn test_iterator_clone() {
16401615
let s = "ศไทย中华Việt Nam";
@@ -2265,26 +2240,16 @@ mod tests {
22652240
#[cfg(test)]
22662241
mod bench {
22672242
use test::Bencher;
2268-
use test::black_box;
22692243
use super::*;
2270-
use std::option::{None, Some};
22712244
use std::iter::{Iterator, DoubleEndedIterator};
22722245
use std::collections::Collection;
22732246

22742247
#[bench]
22752248
fn char_iterator(b: &mut Bencher) {
22762249
let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb";
2250+
let len = s.char_len();
22772251

2278-
b.iter(|| s.chars().count());
2279-
}
2280-
2281-
#[bench]
2282-
fn char_iterator_for(b: &mut Bencher) {
2283-
let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb";
2284-
2285-
b.iter(|| {
2286-
for ch in s.chars() { black_box(ch) }
2287-
});
2252+
b.iter(|| assert_eq!(s.chars().count(), len));
22882253
}
22892254

22902255
#[bench]
@@ -2295,24 +2260,17 @@ mod bench {
22952260
Mary had a little lamb, Little lamb
22962261
Mary had a little lamb, Little lamb
22972262
Mary had a little lamb, Little lamb";
2263+
let len = s.char_len();
22982264

2299-
b.iter(|| s.chars().count());
2265+
b.iter(|| assert_eq!(s.chars().count(), len));
23002266
}
23012267

23022268
#[bench]
23032269
fn char_iterator_rev(b: &mut Bencher) {
23042270
let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb";
2271+
let len = s.char_len();
23052272

2306-
b.iter(|| s.chars().rev().count());
2307-
}
2308-
2309-
#[bench]
2310-
fn char_iterator_rev_for(b: &mut Bencher) {
2311-
let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb";
2312-
2313-
b.iter(|| {
2314-
for ch in s.chars().rev() { black_box(ch) }
2315-
});
2273+
b.iter(|| assert_eq!(s.chars().rev().count(), len));
23162274
}
23172275

23182276
#[bench]

branches/auto/src/libcore/ops.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -749,23 +749,19 @@ pub trait DerefMut<Result>: Deref<Result> {
749749
#[lang="fn"]
750750
pub trait Fn<Args,Result> {
751751
/// This is called when the call operator is used.
752-
#[rust_call_abi_hack]
753752
fn call(&self, args: Args) -> Result;
754753
}
755754

756755
/// A version of the call operator that takes a mutable receiver.
757756
#[lang="fn_mut"]
758757
pub trait FnMut<Args,Result> {
759758
/// This is called when the call operator is used.
760-
#[rust_call_abi_hack]
761759
fn call_mut(&mut self, args: Args) -> Result;
762760
}
763761

764762
/// A version of the call operator that takes a by-value receiver.
765763
#[lang="fn_once"]
766764
pub trait FnOnce<Args,Result> {
767765
/// This is called when the call operator is used.
768-
#[rust_call_abi_hack]
769766
fn call_once(self, args: Args) -> Result;
770767
}
771-

branches/auto/src/libcore/prelude.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ pub use ops::{BitAnd, BitOr, BitXor};
3535
pub use ops::{Drop, Deref, DerefMut};
3636
pub use ops::{Shl, Shr};
3737
pub use ops::{Index, IndexMut};
38-
pub use ops::{Fn, FnMut, FnOnce};
3938
pub use option::{Option, Some, None};
4039
pub use result::{Result, Ok, Err};
4140

0 commit comments

Comments
 (0)