]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoMove the allocation interner out of InterpretInternerInner
John Kåre Alsaker [Wed, 2 May 2018 04:03:02 +0000 (06:03 +0200)]
Move the allocation interner out of InterpretInternerInner

6 years agoGet rid of literal_alloc_cache
John Kåre Alsaker [Tue, 1 May 2018 10:18:53 +0000 (12:18 +0200)]
Get rid of literal_alloc_cache

6 years agoAuto merge of #50801 - eddyb:param-things, r=nikomatsakis
bors [Mon, 21 May 2018 17:19:39 +0000 (17:19 +0000)]
Auto merge of #50801 - eddyb:param-things, r=nikomatsakis

Quick refactoring around Substs & friends.

r? @nikomatsakis

6 years agoAuto merge of #50265 - japaric:sz, r=alexcrichton
bors [Mon, 21 May 2018 12:33:19 +0000 (12:33 +0000)]
Auto merge of #50265 - japaric:sz, r=alexcrichton

stabilize opt-level={s,z}

closes #35784
closes #47651

### Rationale

Since the lastest LLVM upgrade rustc / LLVM does more agressive loop unrolling. This results in increased binary size of embedded / no_std programs: a hundreds of bytes increase, or about a 7x increase, in the case of the smallest Cortex-M binary cf. #49260.

As we are shooting for embedded Rust on stable it would be great to also provide a way to optimize for size (which is pretty important for embedded applications that target resource constrained devices) on stable.

Also this has been baking in nightly for a long time.

r? @alexcrichton which team has to sign off this?

6 years agorustc: move TypeParamDef's fields into GenericParamDefKind::Type.
Eduard-Mihai Burtescu [Wed, 16 May 2018 10:03:04 +0000 (13:03 +0300)]
rustc: move TypeParamDef's fields into GenericParamDefKind::Type.

6 years agorustc: use AccumulateVec in Substs::for_item.
Eduard-Mihai Burtescu [Wed, 16 May 2018 09:37:36 +0000 (12:37 +0300)]
rustc: use AccumulateVec in Substs::for_item.

6 years agorustc: don't expose Substs::fill_item as public.
Eduard-Mihai Burtescu [Wed, 16 May 2018 08:56:50 +0000 (11:56 +0300)]
rustc: don't expose Substs::fill_item as public.

6 years agorustc: use intern_* instead of mk_* where possible.
Eduard-Mihai Burtescu [Wed, 16 May 2018 07:43:24 +0000 (10:43 +0300)]
rustc: use intern_* instead of mk_* where possible.

6 years agorustc: don't call Kind::from directly, use .into() instead.
Eduard-Mihai Burtescu [Wed, 16 May 2018 07:38:55 +0000 (10:38 +0300)]
rustc: don't call Kind::from directly, use .into() instead.

6 years agorustc: make mk_substs_trait take &[Kind] instead of &[Ty].
Eduard-Mihai Burtescu [Wed, 16 May 2018 06:34:09 +0000 (09:34 +0300)]
rustc: make mk_substs_trait take &[Kind] instead of &[Ty].

6 years agorustc: avoid using intern_*(it.collect()) when mk_*(it) works better.
Eduard-Mihai Burtescu [Wed, 16 May 2018 06:48:32 +0000 (09:48 +0300)]
rustc: avoid using intern_*(it.collect()) when mk_*(it) works better.

6 years agoAuto merge of #50898 - shepmaster:typo, r=QuietMisdreavus
bors [Mon, 21 May 2018 08:33:58 +0000 (08:33 +0000)]
Auto merge of #50898 - shepmaster:typo, r=QuietMisdreavus

UnsafeCell doc typos and minor flow improvements

r? @QuietMisdreavus

6 years agoAuto merge of #50739 - gnzlbg:vec_reserve, r=sfackler
bors [Mon, 21 May 2018 06:19:44 +0000 (06:19 +0000)]
Auto merge of #50739 - gnzlbg:vec_reserve, r=sfackler

Switch Vec from doubling size on growth to using RawVec's reserve

On growth, Vec does not require to exactly double its size for correctness,
like, for example, VecDeque does.

Using reserve instead better expresses this intent. It also allows to reuse
Excess capacity on growth and for better growth-policies to be provided by
RawVec.

r? @sfackler

6 years agoAuto merge of #50924 - petrochenkov:spanover, r=alexcrichton
bors [Mon, 21 May 2018 03:36:30 +0000 (03:36 +0000)]
Auto merge of #50924 - petrochenkov:spanover, r=alexcrichton

lexer: Fix span override for the first token in a string

Previously due to peculiarities of `StringReader` construction something like `"a b c d".parse::<TokenStream>()` gave you one non-overridden span for `a` and then three correctly overridden spans for `b`, `c` and `d`.
Now all the spans are overridden.

6 years agoAuto merge of #50860 - nox:big-niches-for-big-doggos-🐕, r=eddyb
bors [Mon, 21 May 2018 01:23:15 +0000 (01:23 +0000)]
Auto merge of #50860 - nox:big-niches-for-big-doggos-🐕, r=eddyb

Find the largest niche when computing layouts

Otherwise we end up with `Option<Option<(&(), bool)>>` unnecessarily large.

6 years agoAuto merge of #50851 - eddyb:the-only-constant, r=nikomatsakis
bors [Sun, 20 May 2018 22:37:06 +0000 (22:37 +0000)]
Auto merge of #50851 - eddyb:the-only-constant, r=nikomatsakis

rustc: introduce {ast,hir}::AnonConst to consolidate so-called "embedded constants".

Previously, constants in array lengths and enum variant discriminants were "merely an expression", and had no separate ID for, e.g. type-checking or const-eval, instead reusing the expression's.

That complicated code working with bodies, because such constants were the only special case where the "owner" of the body wasn't the HIR parent, but rather the same node as the body itself.
Also, if the body happened to be a closure, we had no way to allocate a `DefId` for both the constant *and* the closure, leading to *several* bugs (mostly ICEs where type errors were expected).

This PR rectifies the situation by adding another (`{ast,hir}::AnonConst`) node around every such constant. Also, const generics are expected to rely on the new `AnonConst` nodes, as well (cc @varkor).
* fixes #48838
* fixes #50600
* fixes #50688
* fixes #50689
* obsoletes #50623

r? @nikomatsakis

6 years agolexer: Fix span override for the first token in a string
Vadim Petrochenkov [Sun, 20 May 2018 19:31:27 +0000 (22:31 +0300)]
lexer: Fix span override for the first token in a string

6 years agoAuto merge of #50234 - cramertj:extend, r=alexcrichton
bors [Sun, 20 May 2018 20:29:10 +0000 (20:29 +0000)]
Auto merge of #50234 - cramertj:extend, r=alexcrichton

Add implementation of Extend for ()

This is useful in some generic code which wants to collect iterators of items into a result.

6 years agoAuto merge of #50719 - frewsxcv:frewsxcv-iterator-zip, r=alexcrichton
bors [Sun, 20 May 2018 18:18:12 +0000 (18:18 +0000)]
Auto merge of #50719 - frewsxcv:frewsxcv-iterator-zip, r=alexcrichton

Fix incorrect statement about return value for Iterator::zip.

Fixes https://github.com/rust-lang/rust/issues/50225.

6 years agoAuto merge of #50908 - petrochenkov:usemacself, r=alexcrichton
bors [Sun, 20 May 2018 14:24:14 +0000 (14:24 +0000)]
Auto merge of #50908 - petrochenkov:usemacself, r=alexcrichton

resolve: Don't add unnecessary import candidates for `prefix::{self}` imports

Fixes https://github.com/rust-lang/rust/issues/50725

6 years agoAuto merge of #50841 - oli-obk:promote_errors_to_panics, r=eddyb
bors [Sun, 20 May 2018 11:13:24 +0000 (11:13 +0000)]
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

6 years agoAuto merge of #50855 - nnethercote:fewer-macro_parser-allocs, r=petrochenkov
bors [Sun, 20 May 2018 08:55:50 +0000 (08:55 +0000)]
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%
```

6 years agoAuto merge of #50820 - alexcrichton:no-modules, r=petrochenkov
bors [Sun, 20 May 2018 05:57:41 +0000 (05:57 +0000)]
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

6 years agoAuto merge of #50813 - paoloteti:cortex-r, r=alexcrichton
bors [Sun, 20 May 2018 03:29:49 +0000 (03:29 +0000)]
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.

6 years agoUnsafeCell doc typos and minor flow improvements
Jake Goulding [Sat, 19 May 2018 17:58:16 +0000 (13:58 -0400)]
UnsafeCell doc typos and minor flow improvements

6 years agoAuto merge of #50803 - varkor:never-transmute-never, r=eddyb
bors [Sun, 20 May 2018 00:49:37 +0000 (00:49 +0000)]
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.

6 years agoresolve: Don't add unnecessary import candidates for `prefix::{self}` imports
Vadim Petrochenkov [Sat, 19 May 2018 17:31:06 +0000 (20:31 +0300)]
resolve: Don't add unnecessary import candidates for `prefix::{self}` imports

6 years agoAuto merge of #50893 - kennytm:rollup, r=kennytm
bors [Sat, 19 May 2018 22:33:57 +0000 (22:33 +0000)]
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:

6 years agoRollup merge of #50889 - oli-obk:clippy, r=kennytm
kennytm [Sat, 19 May 2018 20:21:05 +0000 (04:21 +0800)]
Rollup merge of #50889 - oli-obk:clippy, r=kennytm

Update clippy

# Conflicts:
# src/Cargo.lock

6 years agoRollup merge of #50819 - cjkenn:cjkenn/div-by-zero, r=kennytm
kennytm [Sat, 19 May 2018 20:17:41 +0000 (04:17 +0800)]
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.

6 years agoRollup merge of #50883 - dlrobertson:fix_warning, r=TimNN
kennytm [Sat, 19 May 2018 15:41:05 +0000 (23:41 +0800)]
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.

6 years agoRollup merge of #50858 - robinkrahl:rustdoc-fix-order, r=steveklabnik
kennytm [Sat, 19 May 2018 15:41:04 +0000 (23:41 +0800)]
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.

6 years agoRollup merge of #50854 - zackmdavis:and_the_case_of_the_unused_field_pattern_3_straig...
kennytm [Sat, 19 May 2018 15:41:03 +0000 (23:41 +0800)]
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

6 years agoRollup merge of #50829 - est31:master, r=estebank
kennytm [Sat, 19 May 2018 15:41:01 +0000 (23:41 +0800)]
Rollup merge of #50829 - est31:master, r=estebank

CheckLoopVisitor: also visit break expressions

Fixes #50802

6 years agoRollup merge of #50827 - nox:llvmup, r=eddyb
kennytm [Sat, 19 May 2018 15:41:00 +0000 (23:41 +0800)]
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.

6 years agoAuto merge of #50782 - matthewjasper:wheres-main, r=matthewjasper
bors [Sat, 19 May 2018 20:10:34 +0000 (20:10 +0000)]
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

6 years agoremove feature line from test
cjkenn [Sat, 19 May 2018 20:01:28 +0000 (13:01 -0700)]
remove feature line from test

6 years agorustc: introduce {ast,hir}::AnonConst to consolidate so-called "embedded constants".
Eduard-Mihai Burtescu [Thu, 17 May 2018 18:28:50 +0000 (21:28 +0300)]
rustc: introduce {ast,hir}::AnonConst to consolidate so-called "embedded constants".

6 years agoAuto merge of #50690 - oli-obk:mir_stuff, r=eddyb
bors [Sat, 19 May 2018 17:30:18 +0000 (17:30 +0000)]
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

6 years agouse if let to avoid potential div by zero
cjkenn [Thu, 17 May 2018 03:02:01 +0000 (20:02 -0700)]
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.

6 years agorustc: removed unused `DefPathData::Initializer` DefId's for associated constants.
Eduard-Mihai Burtescu [Thu, 17 May 2018 18:30:15 +0000 (21:30 +0300)]
rustc: removed unused `DefPathData::Initializer` DefId's for associated constants.

6 years agoRollup merge of #50531 - iancormac84:merge-typeidhasher-cleanup, r=michaelwoerister
kennytm [Sat, 19 May 2018 15:40:58 +0000 (23:40 +0800)]
Rollup merge of #50531 - iancormac84:merge-typeidhasher-cleanup, r=michaelwoerister

Cleanup uses of TypeIdHasher and replace them with StableHasher

Fixes #50424

r? @michaelwoerister

6 years agoAuto merge of #50763 - KyleStach1678:unused-loop-label, r=petrochenkov
bors [Sat, 19 May 2018 14:52:30 +0000 (14:52 +0000)]
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.
6 years agoUse `Size` instead of `u64` in mir interpretation
Oliver Schneider [Sat, 19 May 2018 14:37:29 +0000 (16:37 +0200)]
Use `Size` instead of `u64` in mir interpretation

6 years agoKeep statics' constant as ByRef
Oliver Schneider [Thu, 17 May 2018 14:14:30 +0000 (16:14 +0200)]
Keep statics' constant as ByRef

6 years agoGo through an allocation when accessing fields of constants
Oliver Schneider [Mon, 14 May 2018 16:54:24 +0000 (18:54 +0200)]
Go through an allocation when accessing fields of constants

6 years agoReintroduce some sanity checks
Oliver Schneider [Sun, 13 May 2018 17:52:53 +0000 (19:52 +0200)]
Reintroduce some sanity checks

6 years agoEnsure that statics are always ByRef
Oliver Schneider [Sat, 12 May 2018 16:47:20 +0000 (18:47 +0200)]
Ensure that statics are always ByRef

6 years agoAuto merge of #50760 - petrochenkov:legimp, r=nikomatsakis
bors [Sat, 19 May 2018 12:16:50 +0000 (12:16 +0000)]
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).

6 years agoUpdate clippy
Oliver Schneider [Sat, 19 May 2018 11:18:02 +0000 (13:18 +0200)]
Update clippy

6 years agoOverflows only panic in debug mode
Oliver Schneider [Fri, 18 May 2018 08:59:44 +0000 (10:59 +0200)]
Overflows only panic in debug mode

6 years agoAdd a test showing the erroneous promoted bug
Oliver Schneider [Fri, 18 May 2018 07:41:24 +0000 (09:41 +0200)]
Add a test showing the erroneous promoted bug

6 years agoRelease mode overflows should not cause const eval to error
Oliver Schneider [Thu, 17 May 2018 10:07:00 +0000 (12:07 +0200)]
Release mode overflows should not cause const eval to error

6 years agoAuto merge of #50874 - nikomatsakis:nll-reset-unification, r=estebank
bors [Sat, 19 May 2018 10:04:42 +0000 (10:04 +0000)]
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.

6 years agoAuto merge of #50744 - nikic:mutable-noalias, r=alexcrichton
bors [Sat, 19 May 2018 07:42:03 +0000 (07:42 +0000)]
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.

6 years agoAuto merge of #50709 - alexcrichton:revert-musl, r=sfackler
bors [Sat, 19 May 2018 03:10:53 +0000 (03:10 +0000)]
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

6 years agoFix warning when building stage0 libcore
Dan Robertson [Sat, 19 May 2018 01:13:31 +0000 (01:13 +0000)]
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.

6 years agoAuto merge of #50603 - eddyb:issue-49955, r=nikomatsakis
bors [Sat, 19 May 2018 00:27:45 +0000 (00:27 +0000)]
Auto merge of #50603 - eddyb:issue-49955, r=nikomatsakis

 rustc_mir: allow promotion of promotable temps indexed at runtime.

Fixes #49955.

r? @nikomatsakis

6 years agoDefault `unused_labels` to allow, move to "unused"
Kyle Stachowicz [Fri, 18 May 2018 23:53:39 +0000 (16:53 -0700)]
Default `unused_labels` to allow, move to "unused"

6 years agoRevert "Remove unused label in mir"
Kyle Stachowicz [Fri, 18 May 2018 14:12:19 +0000 (07:12 -0700)]
Revert "Remove unused label in mir"

This reverts commit b2a2450cf2925498e1c3bdd781aa1978f9eb00e5.

6 years agoRevert "Allow `unused_labels` in some compile-fail tests"
Kyle Stachowicz [Fri, 18 May 2018 14:11:44 +0000 (07:11 -0700)]
Revert "Allow `unused_labels` in some compile-fail tests"

This reverts commit b9257e2ca161b1bf5aae9d6b667f4d0c6b8d7be6.

6 years agoAllow `unused_labels` in some compile-fail tests
Kyle Stachowicz [Fri, 18 May 2018 05:17:06 +0000 (22:17 -0700)]
Allow `unused_labels` in some compile-fail tests

6 years agoRemove unused label in mir
Kyle Stachowicz [Fri, 18 May 2018 00:58:16 +0000 (17:58 -0700)]
Remove unused label in mir

6 years agoAdd tests for new labeled blocks for `unused_labels`
Kyle Stachowicz [Fri, 18 May 2018 00:32:05 +0000 (17:32 -0700)]
Add tests for new labeled blocks for `unused_labels`

6 years agoReimplement unused_labels lint as a compiler builtin in the resolver
Kyle Stachowicz [Fri, 18 May 2018 00:20:30 +0000 (17:20 -0700)]
Reimplement unused_labels lint as a compiler builtin in the resolver

6 years agoRevert "Add lint checks for unused loop labels"
Kyle Stachowicz [Thu, 17 May 2018 23:57:46 +0000 (16:57 -0700)]
Revert "Add lint checks for unused loop labels"

This functionality is being reimplemented in the resolver phase

This reverts commit 503a69e844970476b27bf1ac7be951bb22194f50.

6 years agoFix formatting in unused label linting to make tidy checks pass
Kyle Stachowicz [Wed, 16 May 2018 03:58:09 +0000 (20:58 -0700)]
Fix formatting in unused label linting to make tidy checks pass

6 years agoFix ignored unused outer label when inner label shadows and is broken multiple times
Kyle Stachowicz [Wed, 16 May 2018 03:32:43 +0000 (20:32 -0700)]
Fix ignored unused outer label when inner label shadows and is broken multiple times

6 years agoAdd test case for shadowed labels, with the inner broken multiple times
Kyle Stachowicz [Wed, 16 May 2018 03:17:20 +0000 (20:17 -0700)]
Add test case for shadowed labels, with the inner broken multiple times

6 years agoRename `unused_loop_label` to `unused_label` and fix/clean up lint logic
Kyle Stachowicz [Wed, 16 May 2018 00:36:43 +0000 (17:36 -0700)]
Rename `unused_loop_label` to `unused_label` and fix/clean up lint logic

6 years agoAdd additional test case to unused_label lint
Kyle Stachowicz [Wed, 16 May 2018 00:08:24 +0000 (17:08 -0700)]
Add additional test case to unused_label lint

6 years agoRename test to `unused_label` and remove empty `stdout` file
Kyle Stachowicz [Tue, 15 May 2018 23:34:08 +0000 (16:34 -0700)]
Rename test to `unused_label` and remove empty `stdout` file

6 years agoAdd lint checks for unused loop labels
Kyle Stachowicz [Tue, 15 May 2018 06:32:21 +0000 (23:32 -0700)]
Add lint checks for unused loop labels

6 years agoAuto merge of #50319 - nagisa:align_to, r=alexcrichton
bors [Fri, 18 May 2018 21:49:38 +0000 (21:49 +0000)]
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.

6 years agoPrevent main and start from having a where clause.
Matthew Jasper [Fri, 18 May 2018 21:03:24 +0000 (22:03 +0100)]
Prevent main and start from having a where clause.

6 years agorustc: Disallow modules and macros in expansions
Alex Crichton [Wed, 9 May 2018 22:03:02 +0000 (15:03 -0700)]
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

6 years agouse `reset_unifications` instead of creating new unification table
Niko Matsakis [Fri, 18 May 2018 19:25:34 +0000 (15:25 -0400)]
use `reset_unifications` instead of creating new unification table

6 years agoAuto merge of #50697 - KiChjang:issue-50461, r=pnkfelix
bors [Fri, 18 May 2018 19:36:26 +0000 (19:36 +0000)]
Auto merge of #50697 - KiChjang:issue-50461, r=pnkfelix

Use EverInit instead of MaybeInit to determine initialization

Fixes #50461.
Fixes #50463.

6 years agoarmebv7r-none-eabihf: default to ARM mode
Paolo Teti [Fri, 18 May 2018 18:57:48 +0000 (20:57 +0200)]
armebv7r-none-eabihf: default to ARM mode

- remove +thumb2 that has not effect
- remove -mthumb

Tested on TMS570LS3137

6 years agoAuto merge of #50653 - oli-obk:bad_const, r=cramertj
bors [Fri, 18 May 2018 17:17:35 +0000 (17:17 +0000)]
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.

6 years agoAuto merge of #50533 - GuillaumeGomez:rustdoc-prim-auto, r=QuietMisdreavus
bors [Fri, 18 May 2018 14:52:12 +0000 (14:52 +0000)]
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

6 years agoFind the largest niche when computing layouts
Anthony Ramine [Fri, 18 May 2018 12:20:48 +0000 (14:20 +0200)]
Find the largest niche when computing layouts

Otherwise we end up with `Option<Option<(&(), bool)>>` unnecessarily large.

6 years agoMake `Directory::path` a `Cow`.
Nicholas Nethercote [Fri, 18 May 2018 06:19:35 +0000 (16:19 +1000)]
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%.

6 years agoIntroduce `MatcherPosHandle`.
Nicholas Nethercote [Fri, 18 May 2018 01:23:31 +0000 (11:23 +1000)]
Introduce `MatcherPosHandle`.

This lets us store most `MatcherPos` instances on the stack. This speeds
up various runs of html5ever, the best by 3%.

6 years agoReorder description for snippets in rustdoc documentation
Robin Krahl [Fri, 18 May 2018 12:09:15 +0000 (14:09 +0200)]
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.

6 years agoAuto merge of #50307 - petrochenkov:keyhyg2, r=nikomatsakis
bors [Fri, 18 May 2018 10:57:05 +0000 (10:57 +0000)]
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.

6 years agoAuto merge of #50758 - varkor:stabilise-inclusive_range_methods, r=SimonSapin
bors [Fri, 18 May 2018 08:10:23 +0000 (08:10 +0000)]
Auto merge of #50758 - varkor:stabilise-inclusive_range_methods, r=SimonSapin

Stabilise inclusive_range_methods

r? @SimonSapin

Closes #49022.

6 years agoin which the unused shorthand field pattern debacle/saga continues
Zack M. Davis [Fri, 18 May 2018 07:07:31 +0000 (00:07 -0700)]
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.

6 years agoUpdate LLVM to 56c931901cfb85cd6f7ed44c7d7520a8de1edf97
Anthony Ramine [Thu, 17 May 2018 09:13:04 +0000 (11:13 +0200)]
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.

6 years agoAuto merge of #50848 - nrc:update, r=alexcrichton
bors [Fri, 18 May 2018 05:23:23 +0000 (05:23 +0000)]
Auto merge of #50848 - nrc:update, r=alexcrichton

Update RLS and Rustfmt

Fixes RLS build (The Rustfmt update is insignificant)

r? @alexcrichton

6 years agoAuto merge of #50847 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
bors [Fri, 18 May 2018 02:58:13 +0000 (02:58 +0000)]
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:

6 years agoAuto merge of #50566 - nnethercote:bump, r=petrochenkov
bors [Fri, 18 May 2018 00:09:37 +0000 (00:09 +0000)]
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%.

6 years agoFixed accidental removal of StableHasher declaration.
iancormac84 [Thu, 17 May 2018 23:43:36 +0000 (19:43 -0400)]
Fixed accidental removal of StableHasher declaration.

6 years agoAuto merge of #50593 - nikomatsakis:nll-no-location, r=nikomatsakis
bors [Thu, 17 May 2018 21:36:43 +0000 (21:36 +0000)]
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

6 years agoRemoved yet another unused import.
iancormac84 [Wed, 16 May 2018 06:29:15 +0000 (02:29 -0400)]
Removed yet another unused import.

6 years agoRemoved unused import.
iancormac84 [Wed, 16 May 2018 00:27:37 +0000 (20:27 -0400)]
Removed unused import.

6 years agoAdded extra hashing step.
iancormac84 [Tue, 8 May 2018 23:57:45 +0000 (19:57 -0400)]
Added extra hashing step.

6 years agoFix more unused imports errors.
iancormac84 [Tue, 8 May 2018 14:58:32 +0000 (10:58 -0400)]
Fix more unused imports errors.

6 years agoRemoved unused imports.
iancormac84 [Tue, 8 May 2018 14:02:41 +0000 (10:02 -0400)]
Removed unused imports.

6 years agoCode structure edits.
iancormac84 [Tue, 8 May 2018 13:38:29 +0000 (09:38 -0400)]
Code structure edits.