Commit Graph

57706 Commits

Author SHA1 Message Date
Ulrik Sverdrup
ed5015939f Expand .zip() specialization to .map() and .cloned()
Implement .zip() specialization for Map and Cloned.

The crucial thing for transparent specialization is that we want to
preserve the potential side effects.

The simplest example is that in this code snippet:

`(0..6).map(f).zip((0..4).map(g)).count()`

`f` will be called five times, and `g` four times. The last time for `f`
is when the other iterator is at its end, so this element is unused.
This side effect can be preserved without disturbing code generation for
simple uses of `.map()`.

The `Zip::next_back()` case is even more complicated, unfortunately.
2016-10-17 10:58:21 +02:00
bors
0b2c356420 Auto merge of #37090 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 9 pull requests

- Successful merges: #36679, #36699, #36997, #37040, #37060, #37065, #37072, #37073, #37081
- Failed merges:
2016-10-11 13:29:02 -07:00
Guillaume Gomez
30164c21fa Rollup merge of #37081 - p512:master, r=sfackler
Changed 0 into '0'

Right now `0` is an undefined production rule.
[Documentation following the grammar specification](https://doc.rust-lang.org/nightly/std/fmt/#sign0) strongly suggests `'0'` is meant as it is used as a character literal.

r? @steveklabnik
2016-10-11 17:51:27 +02:00
Guillaume Gomez
5c29a914a9 Rollup merge of #37073 - GuillaumeGomez:string_url, r=steveklabnik
Add missing urls on String module

r? @steveklabnik
2016-10-11 17:51:27 +02:00
Guillaume Gomez
bfbd0a5e49 Rollup merge of #37072 - michaelwoerister:enable-trait-ich-tests, r=nikomatsakis
ICH: Enable some cases in trait definition hashing.

Enable some test cases originally written by @eulerdisk. The tests can be enabled now because @MathieuBordere has fixed the underlying problem in #36974.

r? @nikomatsakis
2016-10-11 17:51:27 +02:00
Guillaume Gomez
ffa9bbf7cd Rollup merge of #37065 - nnethercote:opt-mk_printer, r=nikomatsakis
Merge `Printer::token` and `Printer::size`.

Logically, it's a vector of pairs, so might as well represent it that
way.

The commit also changes `scan_stack` so that it is initialized with the
default size, instead of the excessive `55 * linewidth` size, which it
usually doesn't get even close to reaching.
2016-10-11 17:51:26 +02:00
Guillaume Gomez
ac94bde803 Rollup merge of #37060 - jfirebaugh:E0303, r=jonathandturner
Update E0303 to new error format

Fixes #35790

r? @jonathandturner
2016-10-11 17:51:26 +02:00
Guillaume Gomez
0ff115c507 Rollup merge of #37040 - flodiebold:hash-tests, r=michaelwoerister
Incr. comp. hash tests for consts and statics

Hi,

These two commits fix #37000 and #37001.

r? @michaelwoerister
2016-10-11 17:51:26 +02:00
Guillaume Gomez
97e9eac8bf Rollup merge of #36997 - KillTheMule:patch-1, r=steveklabnik
Book: Be very explicit of lifetimes being descriptive

... not prescriptive. Pointed out in https://users.rust-lang.org/t/what-if-i-get-lifetimes-wrong/7535/4, which was a revelation to me and made me think this should be more clear in the book. I'm not sure if I got this entirely right or if the wording is good, but I figured a PR is more helpful than a simple issue.

r? @steveklabnik

Small Note: There's also https://github.com/rust-lang/book, should I have sent the PR there? It doesn't coincide with the online book though, so I figured it's better of here.
2016-10-11 17:51:26 +02:00
Guillaume Gomez
0b7fe4d67c Rollup merge of #36699 - bluss:repeat-str, r=alexcrichton
Add method str::repeat(self, usize) -> String

It is relatively simple to repeat a string n times:
`(0..n).map(|_| s).collect::<String>()`. It becomes slightly more
complicated to do it “right” (sizing the allocation up front), which
warrants a method that does it for us.

This method is useful in writing testcases, or when generating text.
`format!()` can be used to repeat single characters, but not repeating
strings like this.
2016-10-11 17:51:26 +02:00
Guillaume Gomez
6717dba276 Rollup merge of #36679 - QuietMisdreavus:rustdoc-line-breaks, r=steveklabnik
rustdoc: print non-self arguments of bare functions and struct methods on their own line

This change alters the formatting rustdoc uses when it creates function and struct method documentation. For bare functions, each argument is printed on its own line. For struct methods, non-self arguments are printed on their own line. In both cases, no line breaks are introduced if there are no arguments, and for struct methods, no line breaks are introduced if there is only a single self argument. This should aid readability of long function signatures and allow for greater comprehension of these functions.

I've run rustdoc with these changes on my crate egg-mode and its set of dependencies and put the result [on my server](https://shiva.icesoldier.me/doc-custom/egg_mode/). Of note, here are a few shortcut links that highlight the changes:

* [Bare function with a long signature](https://shiva.icesoldier.me/doc-custom/egg_mode/place/fn.reverse_geocode.html)
* [Struct methods, with single self argument and with self and non-self arguments](https://shiva.icesoldier.me/doc-custom/egg_mode/tweet/struct.Timeline.html#method.reset)
* [Bare functions with no arguments](https://shiva.icesoldier.me/doc-custom/rand/fn.thread_rng.html) and [struct methods with no arguments](https://shiva.icesoldier.me/doc-custom/hyper/client/struct.Client.html#method.new) are left unchanged.

This PR consists of two commits: one for bare functions and one for struct methods.
2016-10-11 17:51:25 +02:00
bors
304d0c8d85 Auto merge of #36871 - petrochenkov:pdderr, r=nikomatsakis
Turn compatibility lint `match_of_unit_variant_via_paren_dotdot` into a hard error

The lint was introduced 10 months ago and made deny-by-default 7 months ago.
In case someone is still using it, https://github.com/rust-lang/rust/pull/36868 contains a stable replacement.

r? @nikomatsakis
2016-10-11 07:39:09 -07:00
bors
e33562078f Auto merge of #36983 - alexcrichton:configure-multiple-musl, r=brson
configure: Add options for separate musl roots

This allows using the `./configure` script to enable rustbuild to compile
multiple musl targets at once. We'll hopefully use this soon on our bots to
produce a bunch of targets.
2016-10-11 04:26:56 -07:00
bors
1e4c8b1a81 Auto merge of #36825 - sbwtw:master, r=alexcrichton
add println!() macro with out any arguments

lets add println!() to write "\n".
like java https://docs.oracle.com/javase/7/docs/api/java/io/PrintStream.html#println()
2016-10-11 01:17:03 -07:00
bors
ead9212c33 Auto merge of #36707 - achanda:ip_type, r=alexcrichton
Add two functions to check type of given address

The is_v4 function returns true if the given IP is v4. The is_v6
function returns true if the IP is v6.
2016-10-10 17:18:01 -07:00
p512
ee3de444e6 Changed 0 into '0'
0 is not a production rule but a literal
2016-10-11 01:25:50 +02:00
Ulrik Sverdrup
2b7222d3ec Add method str::repeat(self, usize) -> String
It is relatively simple to repeat a string n times:
`(0..n).map(|_| s).collect::<String>()`. It becomes slightly more
complicated to do it “right” (sizing the allocation up front), which
warrants a method that does it for us.

This method is useful in writing testcases, or when generating text.
`format!()` can be used to repeat single characters, but not repeating
strings like this.
2016-10-11 00:24:23 +02:00
bors
a3bc191b5f Auto merge of #37030 - michaelwoerister:live-debug-values-fix, r=alexcrichton
llvm: Update LLVM to include fix for pathologic case in its LiveDebugValues pass.

See #36926.
r? @alexcrichton
2016-10-10 12:15:14 -07:00
Guillaume Gomez
3c66f96aac Add missing urls on String module 2016-10-10 18:15:55 +02:00
Michael Woerister
f52723c330 ICH: Enable some cases in trait definition hashing. 2016-10-10 11:57:49 -04:00
Michael Woerister
7d03badb2a LLVM: Backport "[SimplifyCFG] Correctly test for unconditional branches in GetCaseResults" 2016-10-10 11:12:29 -04:00
Michael Woerister
d46defc82c Update LLVM to fix bug in SimplifyCFG pass. 2016-10-10 09:53:14 -04:00
bors
6d620843f6 Auto merge of #36341 - sagebind:thread_id, r=alexcrichton
Add ThreadId for comparing threads

This adds the capability to store and compare threads with the current calling thread via a new struct, `std:🧵:ThreadId`. Addresses the need outlined in issue #21507.

This avoids the need to add any special checks to the existing thread structs and does not rely on the system to provide an identifier for a thread, since it seems that this approach is unreliable and undesirable. Instead, this simply uses a lazily-created, thread-local `usize` whose value is copied from a global atomic counter. The code should be simple enough that it should be as much reliable as the `#[thread_local]` attribute it uses (however much that is).

`ThreadId`s can be compared directly for equality and have copy semantics.

Also see these other attempts:
- rust-lang/rust#29457
- rust-lang/rust#29448
- rust-lang/rust#29447

And this in the RFC repo: rust-lang/rfcs#1435
2016-10-10 04:04:51 -07:00
Nicholas Nethercote
67a5444183 Merge Printer::token and Printer::size.
Logically, it's a vector of pairs, so might as well represent it that
way.

The commit also changes `scan_stack` so that it is initialized with the
default size, instead of the excessive `55 * linewidth` size, which it
usually doesn't get even close to reaching.
2016-10-10 16:19:53 +11:00
John Firebaugh
9d364267d6 Update E0303 to new error format 2016-10-09 11:41:59 -07:00
bors
a7bfb1aba9 Auto merge of #37055 - kali:master, r=alexcrichton
use MSG_NOSIGNAL on all relevant platforms

followup #36824
2016-10-09 10:07:39 -07:00
Mathieu Poumeyrol
14f9cbdfd5 use MSG_NOSIGNAL on all relevant platforms 2016-10-09 13:01:29 +02:00
bors
9d4d0da7af Auto merge of #36982 - GuillaumeGomez:slice_urls, r=frewsxcv
Add missing urls in slice doc module

r? @steveklabnik
2016-10-09 00:35:56 -07:00
bors
b98cc352cb Auto merge of #36637 - GuillaumeGomez:fix_run_button, r=bluss
Fixes run button appearing when it shouldn't

Fixes #36621.

r? @steveklabnik
2016-10-08 19:42:55 -07:00
bors
19ac57926a Auto merge of #37041 - tbu-:pr_less_sizet_casts, r=alexcrichton
Use less `size_t` casts in libstd since it's now defined as `usize`
2016-10-08 15:59:49 -07:00
bors
bff06afbc5 Auto merge of #37027 - alexcrichton:less-deps-in-bootstrap, r=japaric
rustbuild: Optimize build times slightly

As the entry point for building the Rust compiler, a good user experience hinges
on this compiling quickly to get to the meat of the problem. To that end use
`#[cfg]`-specific dependencies to avoid building Windows crates on Unix and drop
the `regex` crate for now which was easily replacable with some string
searching.
2016-10-08 12:36:11 -07:00
Alex Crichton
d17f0b0dd7 rustbuild: Optimize build times slightly
As the entry point for building the Rust compiler, a good user experience hinges
on this compiling quickly to get to the meat of the problem. To that end use
`#[cfg]`-specific dependencies to avoid building Windows crates on Unix and drop
the `regex` crate for now which was easily replacable with some string
searching.
2016-10-08 11:11:00 -07:00
Guillaume Gomez
89870b3305 Add missing urls in slice doc module 2016-10-08 18:08:32 +02:00
Tobias Bucher
717d2ddca7 Use less size_t casts in libstd since it's now defined as usize 2016-10-08 15:48:28 +02:00
bors
4344f147aa Auto merge of #37039 - Manishearth:rollup, r=Manishearth
Rollup of 6 pull requests

- Successful merges: #36937, #37016, #37028, #37029, #37031, #37034
- Failed merges: #37027
2016-10-08 05:55:27 -07:00
Florian Diebold
eb07a6cfd0 Add ICH test case for consts
Fixes #37000.
2016-10-08 14:44:51 +02:00
Florian Diebold
5a30f0c728 Add ICH test case for statics
Fixes #37001.
2016-10-08 14:43:50 +02:00
Manish Goregaokar
69f4126da5 Rollup merge of #37034 - nox:empty-trait-list, r=alexcrichton
Do not add an empty #[derive()] list in expand_derive (fixes #37033)
2016-10-08 16:52:44 +05:30
Manish Goregaokar
c1a19b8481 Rollup merge of #37031 - fitzgen:typo-in-gcc-rs-comment, r=alexcrichton
Fix a typo in a comment describing gcc.rs's eh_frame_registry module

s/reigster/register/

r? @alexcrichton
2016-10-08 16:52:43 +05:30
Manish Goregaokar
73a9b8accd Rollup merge of #37029 - japaric:no-panics-in-checked-ops, r=alexcrichton
rewrite checked_{div,rem} to no contain any reference to panics

even without optimizations

r? @alexcrichton
2016-10-08 16:52:43 +05:30
Manish Goregaokar
3e6cc822d3 Rollup merge of #37028 - alexcrichton:fix-deps, r=japaric
rustbuild: Fix dependencies of check-docs step

Some of the doc tests depend on `extern crate test`, so depend on libtest
instead of libstd here.
2016-10-08 16:52:43 +05:30
Manish Goregaokar
06c5bd5135 Rollup merge of #37016 - alexcrichton:workspaces, r=japaric
Leverage Cargo workspaces in rustbuild

This is a continuation of https://github.com/rust-lang/rust/pull/36032 which implements the change to use `cargo metadata` to learn about the crate graph.
2016-10-08 16:52:43 +05:30
Manish Goregaokar
1d204685a4 Rollup merge of #36937 - wesleywiser:patch-3, r=frewsxcv
Fix documentation for `write!` on `std::fmt` page

Fixes #36906
2016-10-08 16:52:43 +05:30
bors
b5fcca5cd7 Auto merge of #37015 - ahmedcharles:sudo, r=alexcrichton
Prevent accidentally running 'make install' as sudo.

r? @alexcrichton

I missed this in the previous PR, but this seems to work. It should probably go in a rollup, but I don't know how to do those. :/
2016-10-08 02:23:47 -07:00
bors
195dbfa098 Auto merge of #37014 - nnethercote:avoid-pat_to_string, r=arielb1
Avoid some `pat_to_string` calls.

`ty_of_method_or_bare_fn` currently calls `pat_to_string` even when it
doesn't need to. Fixing this avoids hundreds of large allocations (e.g.
171,600 bytes, in `mk_printer`) in several of rustc-benchmarks.
2016-10-07 22:51:04 -07:00
bors
49be16e766 Auto merge of #37006 - brson:jsbackend, r=alexcrichton
Turn on JSBackend in the makefiles

This should make the nightlies work with emscripten. r? @alexcrichton

Closes #37004
2016-10-07 18:17:54 -07:00
Alex Crichton
147e2da13a rustbuild: Use cargo metadata to learn about DAG
This updates the commit to use workspaces to use `cargo metadata` instead of
hardcoded lists about what to test. This should help us be resilient to updates
in the future on behalf of the crate DAG and minimize the amount of files that
need to be touched.
2016-10-07 17:17:07 -07:00
Anthony Ramine
0d1ab4e9e4 Do not add an empty #[derive()] list in expand_derive (fixes #37033) 2016-10-08 01:49:11 +02:00
Stephen M. Coakley
032bffa5b8
Unlock guard before overflow panic 2016-10-07 17:45:04 -05:00
Nick Fitzgerald
75c0d3f657 Fix a typo in a comment describing gcc.rs's eh_frame_registry module
s/reigster/register/
2016-10-07 15:00:48 -07:00