Commit Graph

78346 Commits

Author SHA1 Message Date
Oliver Schneider
8753d0f12f Overflows only panic in debug mode 2018-05-19 13:10:52 +02:00
Oliver Schneider
27e710f557 Add a test showing the erroneous promoted bug 2018-05-19 13:10:51 +02:00
Oliver Schneider
d81651e8e9 Release mode overflows should not cause const eval to error 2018-05-19 13:10:51 +02:00
bors
c95e1cccc9 Auto merge of #50874 - nikomatsakis:nll-reset-unification, r=estebank
use `reset_unifications` instead of creating new unification table

This eliminates a hot spot in NLL performance.
2018-05-19 10:04:42 +00:00
bors
bdace29de0 Auto merge of #50744 - nikic:mutable-noalias, r=alexcrichton
Emit noalias on &mut parameters by default

This used to be disabled due to LLVM bugs in the handling of
noalias information in conjunction with unwinding. However,
according to #31681 all known LLVM bugs have been fixed by
LLVM 6.0, so it's probably time to reenable this optimization.

-Z no-mutable-noalias is left as an escape-hatch to debug problems
suspected to stem from this change.
2018-05-19 07:42:03 +00:00
bors
8319ef5b78 Auto merge of #50709 - alexcrichton:revert-musl, r=sfackler
Revert #50105 until regression is fixed

Discovered at https://github.com/rust-lang/rust/pull/50105#issuecomment-388630750 it looks like this caused a regression with i686 musl, so let's revert in the meantime while a fix is worked out
2018-05-19 03:10:53 +00:00
Dan Robertson
8b02488834
Fix warning when building stage0 libcore
When building stage0 a warning will be triggered when compiling libcore
due to align_to_offsets not being used.
2018-05-19 01:13:31 +00:00
bors
c6a1979e20 Auto merge of #50603 - eddyb:issue-49955, r=nikomatsakis
rustc_mir: allow promotion of promotable temps indexed at runtime.

Fixes #49955.

r? @nikomatsakis
2018-05-19 00:27:45 +00:00
Kyle Stachowicz
6da64a7666 Default unused_labels to allow, move to "unused" 2018-05-18 16:57:16 -07:00
Kyle Stachowicz
5586cd80e2 Revert "Remove unused label in mir"
This reverts commit b2a2450cf2925498e1c3bdd781aa1978f9eb00e5.
2018-05-18 16:57:16 -07:00
Kyle Stachowicz
335f91fd69 Revert "Allow unused_labels in some compile-fail tests"
This reverts commit b9257e2ca161b1bf5aae9d6b667f4d0c6b8d7be6.
2018-05-18 16:57:16 -07:00
Kyle Stachowicz
a336aa91db Allow unused_labels in some compile-fail tests 2018-05-18 16:57:16 -07:00
Kyle Stachowicz
f488d2b393 Remove unused label in mir 2018-05-18 16:57:16 -07:00
Kyle Stachowicz
702f1dd846 Add tests for new labeled blocks for unused_labels 2018-05-18 16:57:16 -07:00
Kyle Stachowicz
88f4063c83 Reimplement unused_labels lint as a compiler builtin in the resolver 2018-05-18 16:57:15 -07:00
Kyle Stachowicz
7676982e90 Revert "Add lint checks for unused loop labels"
This functionality is being reimplemented in the resolver phase

This reverts commit 503a69e844970476b27bf1ac7be951bb22194f50.
2018-05-18 16:57:15 -07:00
Kyle Stachowicz
167cedefe6 Fix formatting in unused label linting to make tidy checks pass 2018-05-18 16:57:15 -07:00
Kyle Stachowicz
4de4e61864 Fix ignored unused outer label when inner label shadows and is broken multiple times 2018-05-18 16:57:15 -07:00
Kyle Stachowicz
0f274122ee Add test case for shadowed labels, with the inner broken multiple times 2018-05-18 16:57:15 -07:00
Kyle Stachowicz
acd6ab8f0f Rename unused_loop_label to unused_label and fix/clean up lint logic 2018-05-18 16:57:15 -07:00
Kyle Stachowicz
bb867d3512 Add additional test case to unused_label lint 2018-05-18 16:57:15 -07:00
Kyle Stachowicz
7c4aa7362e Rename test to unused_label and remove empty stdout file 2018-05-18 16:57:15 -07:00
Kyle Stachowicz
d67628e053 Add lint checks for unused loop labels 2018-05-18 16:57:15 -07:00
bors
37a409177c Auto merge of #50319 - nagisa:align_to, r=alexcrichton
Implement [T]::align_to

Note that this PR deviates from what is accepted by RFC slightly by making `align_offset` to return an offset in elements, rather than bytes. This is necessary to sanely support `[T]::align_to` and also simply makes more sense™. The caveat is that trying to align a pointer of ZST is now an equivalent to `is_aligned` check, rather than anything else (as no number of ZST elements will align a misaligned ZST pointer).

It also implements the `align_to` slightly differently than proposed in the RFC to properly handle cases where size of T and U aren’t co-prime.

Furthermore, a promise is made that the slice containing `U`s will be as large as possible (contrary to the RFC) – otherwise the function is quite useless.

The implementation uses quite a few underhanded tricks and takes advantage of the fact that alignment is a power-of-two quite heavily to optimise the machine code down to something that results in as few known-expensive instructions as possible. Currently calling `ptr.align_offset` with an unknown-at-compile-time `align` results in code that has just a single "expensive" modulo operation; the rest is "cheap" arithmetic and bitwise ops.

cc https://github.com/rust-lang/rust/issues/44488 @oli-obk

As mentioned in the commit message for align_offset, many thanks go to Chris McDonald.
2018-05-18 21:49:38 +00:00
Matthew Jasper
218a81b06c Prevent main and start from having a where clause. 2018-05-18 22:03:24 +01:00
Alex Crichton
5e4bac31b8 rustc: Disallow modules and macros in expansions
This commit feature gates generating modules and macro definitions in procedural
macro expansions. Custom derive is exempt from this check as it would be a large
retroactive breaking change (#50587). It's hoped that we can hopefully stem the
bleeding to figure out a better solution here before opening up the floodgates.

The restriction here is specifically targeted at surprising hygiene results [1]
that result in non-"copy/paste" behavior. Hygiene and procedural macros is
intended to be avoided as much as possible for Macros 1.2 by saying everything
is "as if you copy/pasted the code", but modules and macros are sort of weird
exceptions to this rule that aren't fully fleshed out.

[1]: https://github.com/rust-lang/rust/issues/50504#issuecomment-387734625

cc #50504
2018-05-18 13:25:08 -07:00
Niko Matsakis
7ed0fd7699 use reset_unifications instead of creating new unification table 2018-05-18 15:58:23 -04:00
bors
952f344cdc Auto merge of #50697 - KiChjang:issue-50461, r=pnkfelix
Use EverInit instead of MaybeInit to determine initialization

Fixes #50461.
Fixes #50463.
2018-05-18 19:36:26 +00:00
Paolo Teti
4897093cfd armebv7r-none-eabihf: default to ARM mode
- remove +thumb2 that has not effect
- remove -mthumb

Tested on TMS570LS3137
2018-05-18 20:57:48 +02:00
bors
a722296b6e Auto merge of #50653 - oli-obk:bad_const, r=cramertj
Make the `const_err` lint `deny`-by-default

At best these things are runtime panics (debug mode) or overflows (release mode). More likely they are public constants that are unused in the crate declaring them.

This is not a breaking change, as dependencies won't break and root crates can `#![warn(const_err)]`, though I don't know why anyone would do that.
2018-05-18 17:17:35 +00:00
bors
ba64edb3ed Auto merge of #50533 - GuillaumeGomez:rustdoc-prim-auto, r=QuietMisdreavus
add auto-impl for primitive type

Part of #50431.

I have no clue how to test this though with the rustdoc test suite...

r? @QuietMisdreavus
2018-05-18 14:52:12 +00:00
Anthony Ramine
b7db68f516 Find the largest niche when computing layouts
Otherwise we end up with `Option<Option<(&(), bool)>>` unnecessarily large.
2018-05-18 14:32:05 +02:00
Nicholas Nethercote
ad471452ba Make Directory::path a Cow.
Because we create a lot of these in the macro parser, but only very
rarely modify them.

This speeds up some html5ever runs by 2--3%.
2018-05-18 22:20:33 +10:00
Nicholas Nethercote
fcf2b24e1b Introduce MatcherPosHandle.
This lets us store most `MatcherPos` instances on the stack. This speeds
up various runs of html5ever, the best by 3%.
2018-05-18 22:20:27 +10:00
Robin Krahl
cf1f0385a8
Reorder description for snippets in rustdoc documentation
The example code snippets for the `no_run` and `compile_fail` attributes
in the rustdoc documentation were followed by the description for the
wrong attribute.  This patch reorders the descriptions to match the code
snippets.
2018-05-18 14:12:25 +02:00
bors
df40e61382 Auto merge of #50307 - petrochenkov:keyhyg2, r=nikomatsakis
Implement edition hygiene for keywords

Determine "keywordness" of an identifier in its hygienic context.
cc https://github.com/rust-lang/rust/pull/49611

I've resurrected `proc` as an Edition-2015-only keyword for testing purposes, but it should probably be buried again. EDIT: `proc` is removed again.
2018-05-18 10:57:05 +00:00
bors
fd18d2537d Auto merge of #50758 - varkor:stabilise-inclusive_range_methods, r=SimonSapin
Stabilise inclusive_range_methods

r? @SimonSapin

Closes #49022.
2018-05-18 08:10:23 +00:00
Zack M. Davis
59782f4829 in which the unused shorthand field pattern debacle/saga continues
In e4b1a79 (#47922), we corrected erroneous suggestions for unused
shorthand field pattern bindings, suggesting `field: _` where the
previous suggestion of `_field` wouldn't even have compiled
(#47390). Soon, it was revealed that this was insufficient (#50303), and
the fix was extended to references, slices, &c. (#50327) But even this
proved inadequate, as the erroneous suggestions were still being issued
for patterns in local (`let`) bindings (#50804). Here, we yank the
shorthand-detection and variable/node registration code into a new
common function that can be called while visiting both match arms and
`let` bindings.

Resolves #50804.
2018-05-18 01:00:22 -07:00
Anthony Ramine
032831da78 Update LLVM to 56c931901cfb85cd6f7ed44c7d7520a8de1edf97
This brings in https://github.com/rust-lang/llvm/pull/115, which fixes
https://github.com/rust-lang/rust/issues/49873.
2018-05-18 09:24:11 +02:00
bors
2a421f8e19 Auto merge of #50848 - nrc:update, r=alexcrichton
Update RLS and Rustfmt

Fixes RLS build (The Rustfmt update is insignificant)

r? @alexcrichton
2018-05-18 05:23:23 +00:00
bors
dfc07a48f6 Auto merge of #50847 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 10 pull requests

Successful merges:

 - #50387 (Remove leftover tab in libtest outputs)
 - #50553 (Add Option::xor method)
 - #50610 (Improve format string errors)
 - #50649 (Tweak `nearest_common_ancestor()`.)
 - #50790 (Fix grammar documentation wrt Unicode identifiers)
 - #50791 (Fix null exclusions in grammar docs)
 - #50806 (Add `bless` x.py subcommand for easy ui test replacement)
 - #50818 (Speed up `opt_normalize_projection_type`)
 - #50837 (Revert #49767)
 - #50839 (Make sure people know the book is free oline)

Failed merges:
2018-05-18 02:58:13 +00:00
bors
bedbf72785 Auto merge of #50566 - nnethercote:bump, r=petrochenkov
Streamline `StringReader::bump`

These patches make `bump` smaller and nicer. They speed up most runs for coercions and tuple-stress by 1--3%.
2018-05-18 00:09:37 +00:00
iancormac84
03493941fb Fixed accidental removal of StableHasher declaration. 2018-05-17 19:43:36 -04:00
bors
612ca14b81 Auto merge of #50593 - nikomatsakis:nll-no-location, r=nikomatsakis
stop considering location when computing outlives relationships

This doesn't (yet?) use SEME regions, but it does ignore the location for outlives constraints. This makes (I believe) NLL significantly faster -- but we should do some benchmarks. It regresses the "get-default" family of use cases for NLL, which is a shame, but keeps the other benefits, and thus represents a decent step forward.

r? @pnkfelix
2018-05-17 21:36:43 +00:00
iancormac84
1839faead0 Removed yet another unused import. 2018-05-17 16:41:34 -04:00
iancormac84
18b032a96b Removed unused import. 2018-05-17 16:41:33 -04:00
iancormac84
b79edf008f Added extra hashing step. 2018-05-17 16:41:33 -04:00
iancormac84
6131c0a98c Fix more unused imports errors. 2018-05-17 16:41:31 -04:00
iancormac84
ef38712f87 Removed unused imports. 2018-05-17 16:41:30 -04:00
iancormac84
9041d81f78 Code structure edits. 2018-05-17 16:41:29 -04:00