Commit Graph

352 Commits

Author SHA1 Message Date
Adolfo Ochagavía
0fe894e49b Deprecated String::from_raw_parts
Replaced by `string::raw::from_parts`

[breaking-change]
2014-07-24 07:25:43 -07:00
Adolfo Ochagavía
6e509d3462 Deprecated str::raw::from_buf_len
Replaced by `string::raw::from_buf_len`

[breaking-change]
2014-07-24 07:25:43 -07:00
Adolfo Ochagavía
feeae27a56 Deprecated str::raw::from_byte
Use `string:raw::from_utf8` instead

[breaking-change]
2014-07-24 07:25:43 -07:00
Adolfo Ochagavía
9ec19373af Deprecated str::raw::from_utf8_owned
Replaced by `string::raw::from_utf8`

[breaking-change]
2014-07-24 07:25:43 -07:00
Adolfo Ochagavía
eacc5d779f Deprecated str::raw::from_c_str
Use `string::raw::from_buf` instead

[breaking-change]
2014-07-24 07:25:43 -07:00
Adolfo Ochagavía
ba707fb3a0 Remove OwnedStr trait
This trait was only implemented by `String`. It provided the methods
`into_bytes` and `append`, both of which **are already implemented as normal
methods** of `String` (not as trait methods). This change improves the
consistency of strings.

This shouldn't break any code, except if somebody has implemented
`OwnedStr` for a user-defined type.
2014-07-24 07:25:43 -07:00
Jonas Hietala
571692c0ab Document PriorityQueue. 2014-07-24 11:41:23 +02:00
Jonas Hietala
87ef2f390b Move contructors to the top of PriorityQueue. 2014-07-24 11:40:22 +02:00
Brian Anderson
71a75cc2ce Just land already 2014-07-23 13:20:17 -07:00
Brian Anderson
63d1137d68 collections: Tweak docs for push 2014-07-23 13:20:17 -07:00
Brian Anderson
054b1ff989 Remove kludgy imports from vec! macro 2014-07-23 13:20:17 -07:00
Brian Anderson
9db1d35687 collections: Deprecate shift/unshift
Use insert/remove instead.
2014-07-23 13:20:16 -07:00
Brian Anderson
94e42c2d89 collections: Make push_back/pop_back default methods 2014-07-23 13:20:16 -07:00
Brian Anderson
7c61bb7213 collections: Move push/pop docs to MutableSeq 2014-07-23 13:20:16 -07:00
Brian Anderson
79a980558b collections: Deprecate push_back/pop_back 2014-07-23 13:20:16 -07:00
Brian Anderson
d36a8f3f9c collections: Move push/pop to MutableSeq
Implement for Vec, DList, RingBuf. Add MutableSeq to the prelude.

Since the collections traits are in the prelude most consumers of
these methods will continue to work without change.

[breaking-change]
2014-07-23 13:20:10 -07:00
bors
c080d26d32 auto merge of #15902 : nham/rust/hash_triemap, r=alexcrichton
cc #15294
2014-07-23 18:11:15 +00:00
bors
826b835813 auto merge of #15749 : vhbit/rust/treemap-doc-fixes, r=alexcrichton
1. Removed obsolete comment regarding recursive/iteration implementations of tree_find_with/tree_find_mut_with
2. Replaced easy breakable find_with example with simpler one (which only removes redundant allocation during search)
2014-07-23 14:06:08 +00:00
Valerii Hiora
4a00d4e676 TreeMap examples fixes
1. Removed obsolete comment regarding recursive/iteration implementations of tree_find_with/tree_find_mut_with
2. Replaced easy breakable find_with example with simpler one (which only removes redundant allocation during search)
2014-07-23 10:58:46 +03:00
bors
43d84bf32e auto merge of #15894 : treeman/rust/vec-doc, r=alexcrichton
Fill in examples for missing methods. Opt for `vec![]` instead of `vec!()`.
2014-07-22 21:26:14 +00:00
nham
366c66e171 Implement PartialEq, Eq for TrieMap, TrieSet 2014-07-22 17:04:16 -04:00
nham
9e83d29f30 Derive Hash for TrieMap and TrieSet 2014-07-22 16:36:09 -04:00
bors
2ffccb76ce auto merge of #15857 : treeman/rust/doc-dijkstra-example, r=alexcrichton
I wanted to have a slightly larger example compared to the method examples, but I'm unsure how it worked out.

Feedback would nice.
2014-07-22 16:11:14 +00:00
Jonas Hietala
94500b84d4 Main example for priority queue using dijkstra's algorithm. 2014-07-22 16:50:48 +02:00
Jonas Hietala
8d54ec8f4b doc: Normalize example style
Remove unnecessary `use std::vec::Vec`. Use ``` code blocks
with rust as default instead of spelling it out.
2014-07-22 14:06:45 +02:00
Jonas Hietala
eafcf6ba41 doc: Vec::from_raw_parts.
Also more explicit raw pointer handling in unsafe examples.
2014-07-22 14:06:45 +02:00
Jonas Hietala
4357da3560 doc: Fill vec documentation with examples.
Add more useful functions to main example.
2014-07-22 11:07:49 +02:00
Jonas Hietala
c004bebc9e doc: Use vec![] instead of vec!() in Vec. 2014-07-22 10:33:26 +02:00
bors
8d43e4474a auto merge of #15867 : cmr/rust/rewrite-lexer4, r=alexcrichton 2014-07-22 07:16:17 +00:00
Corey Richardson
35c0bf3292 Add a ton of ignore-lexer-test 2014-07-21 18:38:40 -07:00
Corey Richardson
188d889aaf ignore-lexer-test to broken files and remove some tray hyphens
I blame @ChrisMorgan for the hyphens.
2014-07-21 10:59:58 -07:00
Alex Crichton
414862db3c Test fixes from the rollup
Closes #15690 (Guide: improve error handling)
Closes #15729 (Guide: guessing game)
Closes #15751 (repair macro docs)
Closes #15766 (rustc: Print a smaller hash on -v)
Closes #15815 (Add unit test for rlibc)
Closes #15820 (Minor refactoring and features in rustc driver for embedders)
Closes #15822 (rustdoc: Add an --extern flag analagous to rustc's)
Closes #15824 (Document Deque trait and bitv.)
Closes #15832 (syntax: Join consecutive string literals in format strings together)
Closes #15837 (Update LLVM to include NullCheckElimination pass)
Closes #15841 (Rename to_str to to_string)
Closes #15847 (Purge #[!resolve_unexported] from the compiler)
Closes #15848 (privacy: Add publically-reexported foreign item to exported item set)
Closes #15849 (fix string in from_utf8_lossy_100_multibyte benchmark)
Closes #15850 (Get rid of few warnings in tests)
Closes #15852 (Clarify the std::vec::Vec::with_capacity docs)
2014-07-21 10:18:17 -07:00
P1start
37bb6ed302 Clarify the std::vec::Vec docs regarding capacity 2014-07-21 09:55:08 -07:00
Ted Horst
dfacef532d fix string in from_utf8_lossy_100_multibyte benchmark 2014-07-21 09:55:02 -07:00
Jonas Hietala
2357c443e0 Simplify and cleanup bitv examples. 2014-07-21 09:54:31 -07:00
Jonas Hietala
2957644e08 Describe BitPositions and TwoBitPositions. 2014-07-21 09:54:31 -07:00
Jonas Hietala
e68333a689 Polish bitv docs. 2014-07-21 09:54:31 -07:00
Jonas Hietala
71afdc4323 Enclose None as None. 2014-07-21 09:54:31 -07:00
Jonas Hietala
4574b2fbaa Main bitv example: prime sieve. 2014-07-21 09:54:31 -07:00
Jonas Hietala
26047f15e5 Move intersection above difference and symmetric_differance.
So all comes in the order union, intersection, difference and
symmetric_difference.
2014-07-21 09:54:31 -07:00
Jonas Hietala
b05f6050b6 Document BitvSet. 2014-07-21 09:54:31 -07:00
Jonas Hietala
681aa58214 Document Bitv. 2014-07-21 09:54:31 -07:00
Jonas Hietala
f4d9dca10d Group union, intersect and difference in Bitv. 2014-07-21 09:54:31 -07:00
Jonas Hietala
2e40078fc3 Place union as the first function, for consistency. 2014-07-21 09:54:31 -07:00
Jonas Hietala
9aaaa6b31e Move in-place functions below their iterator variants. 2014-07-21 09:54:31 -07:00
Jonas Hietala
c86873bda4 Document Deque. 2014-07-21 09:54:31 -07:00
bors
3a37ed4412 auto merge of #15806 : treeman/rust/std-doc, r=alexcrichton
Used `HashMap` and `HashSet` as the base of most examples. Could change it up with different containers, but I don't think it's a big deal.
2014-07-20 17:46:32 +00:00
Patrick Walton
6f99a27886 librustc: Implement lifetime elision.
This implements RFC 39. Omitted lifetimes in return values will now be
inferred to more useful defaults, and an error is reported if a lifetime
in a return type is omitted and one of the two lifetime elision rules
does not specify what it should be.

This primarily breaks two uncommon code patterns. The first is this:

    unsafe fn get_foo_out_of_thin_air() -> &Foo {
        ...
    }

This should be changed to:

    unsafe fn get_foo_out_of_thin_air() -> &'static Foo {
        ...
    }

The second pattern that needs to be changed is this:

    enum MaybeBorrowed<'a> {
        Borrowed(&'a str),
        Owned(String),
    }

    fn foo() -> MaybeBorrowed {
        Owned(format!("hello world"))
    }

Change code like this to:

    enum MaybeBorrowed<'a> {
        Borrowed(&'a str),
        Owned(String),
    }

    fn foo() -> MaybeBorrowed<'static> {
        Owned(format!("hello world"))
    }

Closes #15552.

[breaking-change]
2014-07-19 13:10:58 -07:00
bors
ca38434829 auto merge of #15638 : blake2-ppc/rust/ptr-arithmetic-chars, r=huonw
Reimplement the string slice's `Iterator<char>` by wrapping the already efficient
slice iterator.

The iterator uses our guarantee that the string contains valid UTF-8, but its only unsafe
code is transmuting the decoded `u32` into `char`.

Benchmarks suggest that the runtime of `Chars` benchmarks are reduced by up to 30%,
runtime of `Chars` reversed reduced by up to 60%.

```
BEFORE
test str::bench::char_indicesator                          ... bench:       124 ns/iter (+/- 1)
test str::bench::char_indicesator_rev                      ... bench:       188 ns/iter (+/- 9)
test str::bench::char_iterator                             ... bench:       122 ns/iter (+/- 2)
test str::bench::char_iterator_ascii                       ... bench:       302 ns/iter (+/- 41)
test str::bench::char_iterator_for                         ... bench:       123 ns/iter (+/- 4)
test str::bench::char_iterator_rev                         ... bench:       189 ns/iter (+/- 14)
test str::bench::char_iterator_rev_for                     ... bench:       177 ns/iter (+/- 4)

AFTER
test str::bench::char_indicesator                          ... bench:        85 ns/iter (+/- 3)
test str::bench::char_indicesator_rev                      ... bench:        82 ns/iter (+/- 2)
test str::bench::char_iterator                             ... bench:       100 ns/iter (+/- 3)
test str::bench::char_iterator_ascii                       ... bench:       317 ns/iter (+/- 3)
test str::bench::char_iterator_for                         ... bench:        86 ns/iter (+/- 2)
test str::bench::char_iterator_rev                         ... bench:        80 ns/iter (+/- 6)
test str::bench::char_iterator_rev_for                     ... bench:        68 ns/iter (+/- 0)
```

Note: Branch name is no longer indicative of the implementation.
2014-07-19 14:06:39 +00:00
Jonas Hietala
41729b83bc Document some trait methods. 2014-07-19 12:26:18 +02:00