Commit Graph

40820 Commits

Author SHA1 Message Date
Huon Wilson
c2258d6d04 Optimise Iterator::{max, max_by, min, min_by}.
The main change in this patch is removing the use of `Option` inside the
inner loops of those functions to avoid comparisons where one branch
will only trigger on the first pass through the loop.

The included benchmarks go from:

    test bench_max    ... bench:       372 ns/iter (+/- 118)
    test bench_max_by ... bench:       428 ns/iter (+/- 33)
    test bench_max_by2 ... bench:      7128 ns/iter (+/- 326)

to:

    test bench_max    ... bench:       317 ns/iter (+/- 64)
    test bench_max_by ... bench:       356 ns/iter (+/- 270)
    test bench_max_by2 ... bench:      1387 ns/iter (+/- 183)

Problem noticed in http://www.reddit.com/r/rust/comments/31syce/using_iterators_to_find_the_index_of_the_min_or/
2015-04-10 14:42:17 +10:00
bors
d9146bf8ba Auto merge of #24169 - Manishearth:rollup, r=Manishearth
- Successful merges: #24132, #24139, #24147, #24148, #24150, #24166
- Failed merges:
2015-04-07 19:49:59 +00:00
Manish Goregaokar
4e067f5273 Rollup merge of #24166 - lgvz:email, r=steveklabnik 2015-04-08 01:19:38 +05:30
Manish Goregaokar
c4bd1c2bb2 Rollup merge of #24150 - wg:master, r=alexcrichton
This fix allows the gdb debuginfo tests to pass on FreeBSD when using the newer 7.8 package.
2015-04-08 01:19:38 +05:30
Manish Goregaokar
fe2cff74f4 Rollup merge of #24148 - xfq:patch-2, r=steveklabnik
People use programming language *implementations* like Ruby MRI, CPython, and SpiderMonkey for executing programs.
2015-04-08 01:19:38 +05:30
Manish Goregaokar
2b34643638 Rollup merge of #24147 - lstat:needstest-22560, r=alexcrichton
Closes #22560
2015-04-08 01:19:38 +05:30
Manish Goregaokar
6295406d9f Rollup merge of #24139 - xfq:patch-1, r=steveklabnik
Use HTTPS where possible to avoid plaintext HTTP connections.
2015-04-08 01:19:37 +05:30
Manish Goregaokar
7b2e11844a Rollup merge of #24132 - kwantam:master, r=alexcrichton
@mahkoh points out in #15628 that unicode.py does not use
normative data for Grapheme classes. This pr fixes that issue,
and does some minor cleanup of the unicode.py script.

In addition, GC_RegionalIndicator is renamed GC_Regional_Indicator
in order to stay in line with the Unicode class name definitions.
I have updated refs in u_str.rs, and verified that there are no
refs elsewhere in the codebase. However, in principle someone
using the unicode tables for their own purposes might see breakage
from this.
2015-04-08 01:19:37 +05:30
Tero Hänninen
f728e39572 Change my email 2015-04-07 21:21:46 +03:00
bors
1fd89b625b Auto merge of #24156 - Manishearth:rollup, r=Manishearth 2015-04-07 16:44:11 +00:00
Manish Goregaokar
ae64d8e415 doc ignore (fixup #24059) 2015-04-07 22:10:55 +05:30
Manish Goregaokar
b3bcbb1a22 Rollup merge of #24113 - mbrubeck:doc-edit, r=steveklabnik
* Fix broken \"module-level documentation\" link on the [`trait Any` docs](http://doc.rust-lang.org/std/any/trait.Any.html) and related broken markup on the [`std::any` docs](http://doc.rust-lang.org/std/any/index.html).

* Remove an outdated or incorrect notice in the `BufRead::lines` docs. There is no such `read_string` function, and `lines` never returns an error.

r? @steveklabnik
2015-04-07 18:13:24 +05:30
Manish Goregaokar
322e4a18e3 Rollup merge of #24112 - joshtriplett:patch-1, r=steveklabnik
traits.md said:

If we add a `use` line right above `main` and make the right things public,
everything is fine:

However, the use line was actually placed at the top of the file instead.  Move
the use line to right above main.  That also makes the example more evocative
of cases where the module is defined in a separate file.
2015-04-07 18:13:12 +05:30
Manish Goregaokar
6efb8352e8 Rollup merge of #24110 - tbu-:pr_doc_fix_add, r=alexcrichton 2015-04-07 18:13:04 +05:30
Manish Goregaokar
50cb31f0e7 Rollup merge of #24088 - GuillaumeGomez:patch-1, r=alexcrichton
Fixes #24060.
2015-04-07 18:12:55 +05:30
Manish Goregaokar
6f852f5620 Rollup merge of #24059 - nikomatsakis:issue-22914-phantomdata-docs, r=huon
This probably needs a bit more work, but I wanted to try and capture some common use cases and be a bit more helpful.

r? @huonw
cc @steveklabnik
2015-04-07 18:12:47 +05:30
Manish Goregaokar
daf2e365cf Rollup merge of #24057 - nikomatsakis:lifetime-shadowing-hard-error, r=huon 2015-04-07 18:12:40 +05:30
Manish Goregaokar
4faf0befaa Rollup merge of #24042 - callahad:bug_24030, r=steveklabnik
Fixes #24030

Of the four code samples with modules in TRPL:

    - 2 use `mod test`
    - 2 use `mod tests`

We should be consistent here, but which is right? The stdlib is split:

    $ grep -r 'mod tests {' src/lib* | wc -l
          63
    $ grep -r 'mod test {'  src/lib* | wc -l
          58

Subjectively, I like the plural, but both the language reference and the
style guide recommend the singular. So we'll go with that here, for now.

r? @steveklabnik
2015-04-07 18:12:32 +05:30
Manish Goregaokar
4dd6edda9c Rollup merge of #23277 - aochagavia:intro, r=steveklabnik
cc @steveklabnik
2015-04-07 18:12:22 +05:30
Luke Gallagher
6f9ec0615c Add ignore-tidy-linelength and fix formatting 2015-04-07 21:43:12 +10:00
Will
fc2494b80c Fix charset of debuginfo test on FreeBSD 2015-04-07 20:41:34 +09:00
bors
b41f2df4ca Auto merge of #23277 - aochagavia:intro, r=steveklabnik
cc @steveklabnik
2015-04-07 11:34:38 +00:00
Xue Fuqiao
6eea4266ec Update hello-world.md
People use programming language *implementations* like Ruby MRI, CPython, and SpiderMonkey for executing programs.
2015-04-07 18:07:10 +08:00
Luke Gallagher
7eb723d794 Add test for #22560
Closes #22560
2015-04-07 18:00:39 +10:00
bors
de51bbec15 Auto merge of #24116 - zaeleus:rustdoc-codespan, r=alexcrichton
Because the current style for `code` in rustdoc is to prewrap whitespace, code spans that are hard wrapped in the source documentation are prematurely wrapped when rendered in HTML. [For example][2],

```
/// ...
/// type can be borrowed as multiple different types. In particular, `Vec<T>:
/// Borrow<Vec<T>>` and `Vec<T>: Borrow<[T]>`.
```

renders as

![screen shot 2015-04-06 at 12 11 21](https://cloud.githubusercontent.com/assets/191331/7008216/2706b3b0-dc56-11e4-941e-1b0154fcbc5c.png)

because "`Vec<T>: Borrow<Vec<T>>`" wraps to the next line in the source.

CommonMark 0.18 [[1]] specifies "interior spaces and line endings are collapsed into single spaces" for code spans, which would actually prevent this issue, but hoedown does not currently conform to the
CommonMark spec.

The added span-level callback attempts to adhere to how whitespace is handled as described by CommonMark, fixing the issue of early, unintentional wrapping of code spans in rendered HTML.

[1]: http://spec.commonmark.org/0.18/
[2]: https://doc.rust-lang.org/std/borrow/trait.Borrow.html
2015-04-07 07:41:32 +00:00
Xue Fuqiao
600101bdfd Update intro.md
Use HTTPS where possible to avoid plaintext HTTP connections.
2015-04-07 13:35:26 +08:00
bors
c52d46e778 Auto merge of #24101 - remram44:fix-rustdoc-passes-help, r=nikomatsakis
The current help string ("space separated list") suggests that `--passes "pass1 pass2"` is expected; the orrect usage is `--passes pass1 --passes pass2`.
2015-04-07 04:52:03 +00:00
bors
b2e65ee6e4 Auto merge of #23952 - Kimundi:more_string_pattern, r=alexcrichton
This adds the missing methods and turns `str::pattern` in a user facing module, as per RFC.

This also contains some big internal refactorings:
- string iterator pairs are implemented with a central macro to reduce redundancy 
- Moved all tests from `coretest::str` into `collectionstest::str` and left a note to prevent the two sets of tests drifting apart further.

See https://github.com/rust-lang/rust/issues/22477
2015-04-07 00:57:08 +00:00
kwantam
bef00ab2b8 use normative source for Grapheme class data
@mahkoh points out in #15628 that unicode.py does not use
normative data for Grapheme classes. This pr fixes that issue.

In addition, GC_RegionalIndicator is renamed GC_Regional_Indicator
in order to stay in line with the Unicode class name definitions.
I have updated refs in u_str.rs, and verified that there are no
refs elsewhere in the codebase. However, in principle someone
using the unicode tables for their own purposes might see breakage
from this.
2015-04-06 19:46:48 -04:00
bors
b49a5ef003 Auto merge of #23857 - phildawes:libsyntax_nopanic, r=nikomatsakis
Hello! 

I've been working towards a libsyntax without panics. See:
http://internals.rust-lang.org/t/changing-libsyntax-to-use-result-instead-of-panic/1670

This patch changes the internals of parser.rs to use Result<> rather than panicing. It keeps the following old-style panicing functions as a facade:
parse_expr, parse_item, parse_pat, parse_arm, parse_ty, parse_stmt

I left these functions because I wasn't sure what to do about the quote_* macros or how many syntax-extensions would break if these and quoting macros returned Result.

The gyst of the rest of the patch is:

 - Functions in parse/parser.rs return PResult<> rather than panicing
 - Other functions in libsyntax call panic! explicitly if they rely on panicing behaviour.
 - I added a macro 'panictry!()' to act as scaffolding for callers while converting panicing functions. (This does the same as 'unwrap()' but is easier to grep for and turn into try!()).

Am I on the right track?  I'd quite like to get something merged soon as keeping this rebased in the face of libsyntax changes is a lot of work. Please let me know what changes you'd like to see to make this happen.

Thanks!, Phil
2015-04-06 22:08:01 +00:00
bors
aab8669dda Auto merge of #23655 - gereeter:rustc-remove-ident, r=sanxiyn
...of #6993.

cc @pcwalton
2015-04-06 19:20:39 +00:00
Michael Macias
46cc6e5fc3 rustdoc: Use iterators to collapse whitespace
Thanks, @alexcrichton!
2015-04-06 14:07:02 -05:00
Michael Macias
b6c2e82b71 rustdoc: Add a custom callback for codespan to collapse whitespace
Because the current style for `code` in rustdoc is to prewrap
whitespace, code spans that are hard wrapped in the source
documentation are prematurely wrapped when rendered in HTML.

CommonMark 0.18 [[1]] specifies "interior spaces and line endings are
collapsed into single spaces" for code spans, which would actually
prevent this issue, but hoedown does not currently conform to the
CommonMark spec.

The added span-level callback attempts to adhere to how whitespace is
handled as described by CommonMark, fixing the issue of early,
unintentional wrapping of code spans in rendered HTML.

[1]: http://spec.commonmark.org/0.18/
2015-04-06 13:02:41 -05:00
bors
3c07835e10 Auto merge of #24056 - nikomatsakis:issue-23853-crates-io, r=aturon
If we find a blanket impl for `Trait` but we're matching on an object `Trait`, prefer the object (I think we could perhaps go either way, but this seems safer). Also give a nice error for attempts to manually `impl Trait for Trait`, since they will be ineffectual.

This fixes the problems around ambiguity ICEs relating to `Any` and `MarkerTrait` that were cropping up all over the place. There may still be similar ICEs reported in #21756 that this PR does not address.

Fixes #24015.

Fixes #24051.
Fixes #24037.
Fixes #23853.
Fixes #21942.
cc #21756.

cc @alexcrichton (this fixes crates.io)
r? @aturon
2015-04-06 16:07:18 +00:00
Matt Brubeck
6e86c636e5 Remove outdated notice from BufRead::lines docs.
There is no `read_string` function, and `lines` never returns an error.
2015-04-06 08:40:11 -07:00
Matt Brubeck
8fcc5bd6a7 Fix broken link and markup in trait Any docs. 2015-04-06 08:36:37 -07:00
Josh Triplett
59d889805e traits.md: Fix example of using traits to match description
traits.md said:

If we add a `use` line right above `main` and make the right things public,
everything is fine:

However, the use line was actually placed at the top of the file instead.  Move
the use line to right above main.  That also makes the example more evocative
of cases where the module is defined in a separate file.
2015-04-06 08:14:11 -07:00
Tobias Bucher
3b9847e886 Fix code formatting in core::ops::Add example 2015-04-06 16:01:01 +02:00
Niko Matsakis
d16677282a Try to improve PhantomData docs with more examples 2015-04-06 09:39:05 -04:00
Niko Matsakis
49f2a56666 Fix tests 2015-04-06 09:35:12 -04:00
bors
9f37ba64e8 Auto merge of #24104 - frewsxcv:patch-12, r=sanxiyn 2015-04-06 12:23:21 +00:00
Niko Matsakis
0d56699d41 If we find a blanket impl for Trait but we're matching on an object
`Trait`, prefer the object. Also give a nice error for attempts to
manually `impl Trait for Trait`, since they will be ineffectual.

Fixes #24015.

Fixes #24051.
Fixes #24037.
Fixes #23853.
Fixes #21942.
cc #21756.
2015-04-06 06:12:51 -04:00
Guillaume Gomez
92d00262c3 Replace alpha state by pre-1.0 2015-04-06 11:14:21 +02:00
Corey Farwell
19d8b67b7e Remove unnecessary returns in API examples 2015-04-06 00:06:24 -07:00
Remi Rampin
e13f0e9a25 Changes rustdoc --passes help message
The current help string ("space separated list") suggests that
`--passes "pass1 pass2"` is expected; the correct usage is
`--passes pass1 --passes pass2`.
2015-04-05 22:39:21 -04:00
bors
cf51e55274 Auto merge of #24087 - mossberg:docs-comma, r=steveklabnik
Correct mistyped comma, and slightly improve sentence.

r? @steveklabnik
2015-04-06 02:00:21 +00:00
bors
be9bd7c93a Auto merge of #24093 - GuillaumeGomez:typo, r=steveklabnik
Fixes #24080.
2015-04-05 22:18:29 +00:00
Guillaume Gomez
24f06e6664 Remove external iterator in CharIndices comment and the reference to the std::iter module 2015-04-05 18:54:07 +02:00
Marvin Löbel
fbba28e246 Added smoke tests for new methods.
Fixed bug in existing StrSearcher impl
2015-04-05 18:52:58 +02:00
Marvin Löbel
c29559d28a Moved coretest::str tests into collectiontest::str 2015-04-05 18:52:58 +02:00