Commit Graph

57741 Commits

Author SHA1 Message Date
Alex Crichton
2d71be5780 Rollup merge of #37067 - jseyfried:expand_derives_last, r=alexcrichton
macros: expand `#[derive]`s after other attribute macros and improve intra-`#[derive]` ordering

Fixes https://github.com/serde-rs/serde/issues/577.
cc #35900
r? @alexcrichton
2016-10-12 14:07:56 -07:00
Alex Crichton
920f10950a Rollup merge of #37066 - nrc:stderr, r=alexcrichton
Error monitor should emit error to stderr instead of stdout

We are pretty consistent about emitting to stderr, except for when there is actually an error, in which case we emit to stdout. This seems a bit backwards. This PR just changes that exception to emit to stderr. This is useful for the RLS since the LS protocol uses stdout (grrr).

r? @alexcrichton
2016-10-12 14:07:56 -07:00
Alex Crichton
f05bd1b41d Rollup merge of #37064 - nnethercote:read_str, r=eddyb
Avoid allocations in `Decoder::read_str`.

`opaque::Decoder::read_str` is very hot within `rustc` due to its use in
the reading of crate metadata, and it currently returns a `String`. This
commit changes it to instead return a `Cow<str>`, which avoids a heap
allocation.

This change reduces the number of calls to `malloc` by almost 10% in
some benchmarks.

This is a [breaking-change] to libserialize.
2016-10-12 14:07:56 -07:00
Alex Crichton
a0ad6616fc Rollup merge of #37056 - Mark-Simulacrum:fix-bool-comparison, r=bluss
Add comparison operators to boolean const eval.

I think it might be worth adding tests here, but since I don't know how or where to do that, I have not done so yet. Willing to do so if asked and given an explanation as to how.

Fixes #37047.
2016-10-12 14:07:55 -07:00
Alex Crichton
5ac7f4fc31 Rollup merge of #37050 - frewsxcv:librustdoc, r=alexcrichton
librustdoc refactoring and cleanup.
2016-10-12 14:07:55 -07:00
Alex Crichton
4e65489e77 Rollup merge of #37049 - srinivasreddy:librustc_lint, r=nrc
run rustfmt on librustc_lint folder
2016-10-12 14:07:55 -07:00
Alex Crichton
65fc3ef1f4 Rollup merge of #37023 - jseyfried:fix_extern_crate_back_compat, r=nrc
Fix importing inaccessible `extern crate`s (with a warning)

Fixes #36747, fixes #37020, and fixes #37021.
r? @nrc
2016-10-12 14:07:55 -07:00
Alex Crichton
9d70ff384f Rollup merge of #36995 - nrc:stable, r=@nikomatsakis
stabilise ?, attributes on stmts, deprecate Reflect

r? @nikomatsakis
2016-10-12 14:07:55 -07:00
Alex Crichton
d13b102c54 Rollup merge of #36991 - wesleywiser:fixme_1, r=arielb1
Move IdxSetBuf and BitSlice to rustc_data_structures

Resolves a FIXME
2016-10-12 14:07:54 -07:00
Alex Crichton
091b547122 Rollup merge of #36831 - michaelwoerister:ich-updates, r=nikomatsakis
incr.comp.: Minor refactoring and update to struct ICH test case

r? @nikomatsakis
2016-10-12 10:15:26 -07:00
Alex Crichton
76fb6e7761 Rollup merge of #36762 - achanda:sockaddr_type, r=alexcrichton
Add two functions to check type of SockAddr

These can be used to determine the type of the underlying IP
address

r? @alexcrichton
2016-10-12 10:15:25 -07:00
bors
acb50e3481 Auto merge of #36737 - srinivasreddy:check, r=nrc
Run rustfmt on librustc_typeck/check/ folder
2016-10-12 05:29:09 -07:00
bors
a29c49f5cc Auto merge of #37095 - petrochenkov:metactor, r=alexcrichton
Temporary fix for metadata decoding for struct constructors

Same as https://github.com/rust-lang/rust/pull/37078, but for nightly.
Ideally, metadata lookup functions should "just work" for constructor ids, but this fixes the issue as well.

Fixes https://github.com/rust-lang/rust/issues/37026
r? @alexcrichton
2016-10-11 23:36:29 -07: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
Vadim Petrochenkov
f5827d08d9 Temporary fix for metadata decoding for struct constructors 2016-10-11 23:04:29 +03:00
Nick Cameron
79b5177378 Review changes 2016-10-12 08:40:23 +13:00
Nick Cameron
14c62f91b7 Deprecate Reflect
[tracking issue](https://github.com/rust-lang/rust/issues/27749)
2016-10-12 08:40:22 +13:00
Nick Cameron
a94f5934cd Stabilise attributes on statements.
Note that attributes on expressions are still unstable and are behind the `stmt_expr_attributes` flag.

cc [Tracking issue](https://github.com/rust-lang/rust/issues/15701)
2016-10-12 08:40:22 +13:00
Nick Cameron
9bc6d26092 Stabilise ?
cc [`?` tracking issue](https://github.com/rust-lang/rust/issues/31436)
2016-10-12 08:40:22 +13: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
Wesley Wiser
5e91c073f2 Move IdxSetBuf and BitSlice to rustc_data_structures
Resolves a FIXME
2016-10-10 20:26:26 -04: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
Jeffrey Seyfried
448d6ad72e Test derive expansion ordering. 2016-10-10 22:15:57 +00:00
Jeffrey Seyfried
60a4b69ec0 Expand #[derive] attribute macro invocations last. 2016-10-10 22:15:55 +00: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
Mark-Simulacrum
f9c73adce8 Add comparison operators to boolean const eval. 2016-10-10 09:58:00 -06: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
Nick Cameron
4df0f3f6a6 Error monitor should emit error to stderr instead of stdout 2016-10-10 18:14:45 +13:00
Nicholas Nethercote
b043e11de2 Avoid allocations in Decoder::read_str.
`opaque::Decoder::read_str` is very hot within `rustc` due to its use in
the reading of crate metadata, and it currently returns a `String`. This
commit changes it to instead return a `Cow<str>`, which avoids a heap
allocation.

This change reduces the number of calls to `malloc` by almost 10% in
some benchmarks.

This is a [breaking-change] to libserialize.
2016-10-10 10:36:35 +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