Commit Graph

78503 Commits

Author SHA1 Message Date
bors
22c25dd737 Auto merge of #50841 - oli-obk:promote_errors_to_panics, r=eddyb
Don't lint numeric overflows in promoteds in release mode

r? @eddyb

mitigates #50814
2018-05-20 11:13:24 +00:00
Simon Martin
e6bf3e2ddb Issue #50636: Improve error diagnostic with missing commas after struct fields. 2018-05-20 13:08:25 +02:00
bors
4c26e2e3fb Auto merge of #50855 - nnethercote:fewer-macro_parser-allocs, r=petrochenkov
Speed up the macro parser

These three commits reduce the number of allocations done by the macro parser, in some cases dramatically. For example, for a clean check builds of html5ever, the number of allocations is reduced by 40%.

Here are the rustc-benchmarks that are sped up by at least 1%.
```
html5ever-check
        avg: -6.6%      min: -10.3%     max: -4.1%
html5ever
        avg: -5.2%      min: -9.5%      max: -2.8%
html5ever-opt
        avg: -4.3%      min: -9.3%      max: -1.6%
crates.io-check
        avg: -1.8%      min: -2.9%      max: -0.6%
crates.io-opt
        avg: -1.0%      min: -2.2%      max: -0.1%
crates.io
        avg: -1.1%      min: -2.2%      max: -0.2%
```
2018-05-20 08:55:50 +00:00
bors
ccb5e973f7 Auto merge of #50820 - alexcrichton:no-modules, r=petrochenkov
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-20 05:57:41 +00:00
Daniel Mueller
e2f0cc084f
Fix typo in cell.rs 2018-05-19 20:40:11 -07:00
bors
522aa5e00b Auto merge of #50813 - paoloteti:cortex-r, r=alexcrichton
Add target for Big-endian ARM Cortex-R4F/R5F MCUs

The ARM Real-Time (‘R’) profile provides high-performing processors for safety-critical environments.

Cortex-R has ARM, Thumb instruction whereas Cortex-M makes use of Thumb only.

CI/Dockerfile is intentionally in the `disabled` folder.
2018-05-20 03:29:49 +00:00
F001
f837c34a86 avoid reporting twice 2018-05-20 10:16:33 +08:00
F001
c3322556f5 Fix according to comments 2018-05-20 10:16:33 +08:00
F001
4bb39966a6 re-implement 2018-05-20 10:16:33 +08:00
Jake Goulding
52249e357d UnsafeCell doc typos and minor flow improvements 2018-05-19 21:10:24 -04:00
bors
21ea121de1 Auto merge of #50803 - varkor:never-transmute-never, r=eddyb
Fix an ICE when attempting to transmute an uninhabited type

Fixes https://github.com/rust-lang/rust/issues/50570.
2018-05-20 00:49:37 +00:00
Vadim Petrochenkov
5fd7d2fc76 resolve: Don't add unnecessary import candidates for prefix::{self} imports 2018-05-20 02:20:05 +03:00
bors
3ea2491589 Auto merge of #50893 - kennytm:rollup, r=kennytm
Rollup of 8 pull requests

Successful merges:

 - #50531 (Cleanup uses of TypeIdHasher and replace them with StableHasher)
 - #50819 (Fix potential divide by zero)
 - #50827 (Update LLVM to 56c931901cfb85cd6f7ed44c7d7520a8de1edf97)
 - #50829 (CheckLoopVisitor: also visit break expressions)
 - #50854 (in which the unused shorthand field pattern debacle/saga continues)
 - #50858 (Reorder description for snippets in rustdoc documentation)
 - #50883 (Fix warning when building stage0 libcore)
 - #50889 (Update clippy)

Failed merges:
2018-05-19 22:33:57 +00:00
kennytm
ada5feedda
Rollup merge of #50889 - oli-obk:clippy, r=kennytm
Update clippy


# Conflicts:
#	src/Cargo.lock
2018-05-20 04:21:05 +08:00
kennytm
e1f031e5d4
Rollup merge of #50819 - cjkenn:cjkenn/div-by-zero, r=kennytm
Fix potential divide by zero

This should fix #50761

I had trouble reproducing with the provided code, but looking at the stack trace would indicate that this code is the likely cause. I made a number of assumptions here, because I don't have enough context on how the register size is set:

1. I assumed `rest.unit.size.bytes()` can be 0, and it's ok if it's set to 0 before this function is called
2. I assumed that if `rest.unit.size.bytes()` is 0, that we want `rest_count` to also be 0.
2018-05-20 04:17:41 +08:00
kennytm
9f34c7feea
Rollup merge of #50883 - dlrobertson:fix_warning, r=TimNN
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-20 04:16:11 +08:00
kennytm
974396b991
Rollup merge of #50858 - robinkrahl:rustdoc-fix-order, r=steveklabnik
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-20 04:16:08 +08:00
kennytm
907288c73f
Rollup merge of #50854 - zackmdavis:and_the_case_of_the_unused_field_pattern_3_straight_to_video, r=estebank
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.

r? @estebank
2018-05-20 04:16:06 +08:00
kennytm
611dafcf06
Rollup merge of #50829 - est31:master, r=estebank
CheckLoopVisitor: also visit break expressions

Fixes #50802
2018-05-20 04:16:03 +08:00
kennytm
fbfce83f58
Rollup merge of #50827 - nox:llvmup, r=eddyb
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-20 04:16:01 +08:00
bors
a3085756ed Auto merge of #50782 - matthewjasper:wheres-main, r=matthewjasper
Prevent main from having a where clause.

Closes #50714

Should this have a crater run?

cc #48557, #48214

r? @nikomatsakis
2018-05-19 20:10:34 +00:00
cjkenn
8d9a87c14d remove feature line from test 2018-05-19 13:01:28 -07:00
Eduard-Mihai Burtescu
26aad25487 rustc: introduce {ast,hir}::AnonConst to consolidate so-called "embedded constants". 2018-05-19 20:34:42 +03:00
bors
5c3960c2d6 Auto merge of #50690 - oli-obk:mir_stuff, r=eddyb
Ensure that statics are always ByRef

Statics aren't values to be used, they are names for memory locations.

r? @eddyb

cc @Zoxc

fixes #50706
2018-05-19 17:30:18 +00:00
cjkenn
ecce274e56 use if let to avoid potential div by zero
remove semicolon -_-

Add rem_bytes to conditional to avoid error when performing mod by 0

Add test file to confirm compilation passes.

Ensure we don't divide or mod by zero in llvm_type. Include test file from issue.
2018-05-19 08:49:54 -07:00
Eduard-Mihai Burtescu
072b0f617f rustc: removed unused DefPathData::Initializer DefId's for associated constants. 2018-05-19 18:47:06 +03:00
kennytm
9e914cc223
Rollup merge of #50531 - iancormac84:merge-typeidhasher-cleanup, r=michaelwoerister
Cleanup uses of TypeIdHasher and replace them with StableHasher

Fixes #50424

r? @michaelwoerister
2018-05-19 23:40:58 +08:00
bors
1b240dad06 Auto merge of #50763 - KyleStach1678:unused-loop-label, r=petrochenkov
Add lint checks for unused loop labels

Previously no warning was generated when a loop label was written out but never used (i.e. in a `break` or `continue` statement):
```rust
fn main() {
    'unused_label: loop {}
}
```
would compile without complaint.

This fix introduces `-W unused_loop_label`, which generates the following warning message for the above snippet:
```
warning: unused loop label
 --> main.rs:2:5
  |
2 |     'unused_label: loop {}
  |     ^^^^^^^^^^^^^
  |
  = note: #[warn(unused_loop_label)] on by default
```

Fixes: #50751.
2018-05-19 14:52:30 +00:00
David Wood
280c6fadee
Remove extra calls to kill_loans_out_of_scope_at_location - keep only before_statement_effect and before_terminator_effect. 2018-05-19 15:39:38 +01:00
Oliver Schneider
7c25aa79c5 Use Size instead of u64 in mir interpretation 2018-05-19 16:38:49 +02:00
Oliver Schneider
3e933f4d8c Keep statics' constant as ByRef 2018-05-19 14:24:24 +02:00
Oliver Schneider
6630678428 Go through an allocation when accessing fields of constants 2018-05-19 14:24:24 +02:00
Oliver Schneider
76ddede5c2 Reintroduce some sanity checks 2018-05-19 14:24:24 +02:00
Oliver Schneider
8b99c61701 Ensure that statics are always ByRef 2018-05-19 14:24:24 +02:00
bors
ef8ee64774 Auto merge of #50760 - petrochenkov:legimp, r=nikomatsakis
Turn deprecation lint `legacy_imports` into a hard error

Closes https://github.com/rust-lang/rust/issues/38260

The lint was introduced in Dec 2016, then made deny-by-default in Jun 2017 when crater run found 0 regressions caused by it.

This lint requires some not entirely trivial amount of import resolution logic that (surprisingly or not) interacts with `feature(use_extern_macros)` (https://github.com/rust-lang/rust/issues/35896), so it would be desirable to remove it before stabilizing `use_extern_macros`.
In particular, this PR fixes the failing example in https://github.com/rust-lang/rust/issues/50725 (but not the whole issue, `use std::panic::{self}` still can cause other undesirable errors when `use_extern_macros` is enabled).
2018-05-19 12:16:50 +00:00
Oliver Schneider
387875dfe3 Update clippy 2018-05-19 13:18:02 +02:00
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