]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoUpdate compiltest to use rustfix 0.3.1
Pascal Hertleif [Sun, 13 May 2018 16:35:40 +0000 (18:35 +0200)]
Update compiltest to use rustfix 0.3.1

6 years agoAuto merge of #50968 - kennytm:rollup, r=kennytm
bors [Tue, 22 May 2018 16:38:12 +0000 (16:38 +0000)]
Auto merge of #50968 - kennytm:rollup, r=kennytm

Rollup of 15 pull requests

Successful merges:

 - #50846 (Add E0665)
 - #50849 (CheckLoopVisitor: also visit closure arguments)
 - #50863 (Make `[T]::len` and `str::len` const fn)
 - #50875 (rustdoc: use "short form" doc(cfg) printing even when combined with other conditionals)
 - #50913 (Fix typo in cell.rs)
 - #50914 (Issue #50636: Improve error diagnostic with missing commas after struct fields.)
 - #50931 (Inline `try_get`.)
 - #50932 (Optimize seen Predicate filtering.)
 - #50945 (Stabilize feature from_ref)
 - #50946 (rustc: Fix procedural macros generating lifetime tokens)
 - #50947 (rustdoc: set tab width in rust source blocks)
 - #50952 (Add the 2018 edition of the book to doc.rust-lang.org)
 - #50958 (Micro-optimization on PR#50697)
 - #50961 (Fix FileCheck finding with MSVC)
 - #50963 (Right-size the `VecDeque` in `coerce_unsized`.)

Failed merges:

6 years agoRollup merge of #50963 - nnethercote:coercion-VecDeque1, r=petrochenkov
kennytm [Tue, 22 May 2018 16:26:23 +0000 (00:26 +0800)]
Rollup merge of #50963 - nnethercote:coercion-VecDeque1, r=petrochenkov

Right-size the `VecDeque` in `coerce_unsized`.

The default capacity of a VecDeque is 8, which is excessive here. In a
"base incremental" check build of rustc-perf's tuple-stress benchmark,
this decreases total heap allocation by 26%. I couldn't see a clear
speedup, but it can't hurt.

6 years agoRollup merge of #50961 - Zoxc:fix-filecheck, r=alexcrichton
kennytm [Tue, 22 May 2018 16:26:22 +0000 (00:26 +0800)]
Rollup merge of #50961 - Zoxc:fix-filecheck, r=alexcrichton

Fix FileCheck finding with MSVC

6 years agoRollup merge of #50958 - KiChjang:nit-50697, r=pnkfelix
kennytm [Tue, 22 May 2018 16:26:21 +0000 (00:26 +0800)]
Rollup merge of #50958 - KiChjang:nit-50697, r=pnkfelix

Micro-optimization on PR#50697

We should stop iterating through the indices in the `init_path_map` once we've already found a match for the local.

r? @nikomatsakis or @pnkfelix

6 years agoRollup merge of #50952 - steveklabnik:2018-book, r=alexcrichton
kennytm [Tue, 22 May 2018 16:26:20 +0000 (00:26 +0800)]
Rollup merge of #50952 - steveklabnik:2018-book, r=alexcrichton

Add the 2018 edition of the book to doc.rust-lang.org

The second edition of the book is on its way to the printers, and as such, is frozen. We've forked off the 2018 edition to add new stuff to; this PR now builds it so that people can read it on doc.rust-lang.org.

6 years agoRollup merge of #50947 - QuietMisdreavus:nice-tabs, r=GuillaumeGomez
kennytm [Tue, 22 May 2018 16:26:19 +0000 (00:26 +0800)]
Rollup merge of #50947 - QuietMisdreavus:nice-tabs, r=GuillaumeGomez

rustdoc: set tab width in rust source blocks

cc https://github.com/rust-lang/rust/issues/49155 (fixes it?)

This sets the tab width ([in supported browsers](https://developer.mozilla.org/en-US/docs/Web/CSS/tab-size)) in Rust source blocks to 4 spaces wide (instead of the default 8), to correspond with the style guidelines.

6 years agoRollup merge of #50946 - alexcrichton:fix-parse-lifetime, r=petrochenkov
kennytm [Tue, 22 May 2018 16:26:18 +0000 (00:26 +0800)]
Rollup merge of #50946 - alexcrichton:fix-parse-lifetime, r=petrochenkov

rustc: Fix procedural macros generating lifetime tokens

This commit fixes an accidental regression from #50473 where lifetime tokens
produced by procedural macros ended up getting lost in translation in the
compiler and not actually producing parseable code. The issue lies in the fact
that a lifetime's `Ident` is prefixed with `'`. The `glue` implementation for
gluing joint tokens together forgot to take this into account so the lifetime
inside of `Ident` was missing the leading tick!

The `glue` implementation here is updated to create a new `Symbol` in these
situations to manufacture a new `Ident` with a leading tick to ensure it parses
correctly.

Closes #50942

6 years agoRollup merge of #50945 - stjepang:stabilize-from-ref, r=SimonSapin
kennytm [Tue, 22 May 2018 16:26:17 +0000 (00:26 +0800)]
Rollup merge of #50945 - stjepang:stabilize-from-ref, r=SimonSapin

Stabilize feature from_ref

Function `from_ref_mut` is now renamed to `from_mut`, as discussed in #45703.

Closes #45703.

r? @SimonSapin

6 years agoRollup merge of #50932 - nnethercote:seen-Predicates, r=eddyb
kennytm [Tue, 22 May 2018 16:26:15 +0000 (00:26 +0800)]
Rollup merge of #50932 - nnethercote:seen-Predicates, r=eddyb

Optimize seen Predicate filtering.

This speeds up a few rustc-perf benchmark runs, most notably ones
involving 'coercions', the best by 2%.

6 years agoRollup merge of #50931 - nnethercote:inline-try_get, r=michaelwoerister
kennytm [Tue, 22 May 2018 16:26:14 +0000 (00:26 +0800)]
Rollup merge of #50931 - nnethercote:inline-try_get, r=michaelwoerister

Inline `try_get`.

This speeds up lots of rustc-perf benchmark runs. The maximum
improvement is 1%, but there are a lot in the 0.5--1.0% range.

6 years agoRollup merge of #50914 - simartin:issue_50636, r=oli-obk
kennytm [Tue, 22 May 2018 16:26:13 +0000 (00:26 +0800)]
Rollup merge of #50914 - simartin:issue_50636, r=oli-obk

Issue #50636: Improve error diagnostic with missing commas after struct fields.

Fixes #50636

6 years agoRollup merge of #50913 - d-e-s-o:fix-typo, r=joshtriplett
kennytm [Tue, 22 May 2018 16:26:12 +0000 (00:26 +0800)]
Rollup merge of #50913 - d-e-s-o:fix-typo, r=joshtriplett

Fix typo in cell.rs

6 years agoRollup merge of #50875 - QuietMisdreavus:short-features, r=GuillaumeGomez
kennytm [Tue, 22 May 2018 16:26:11 +0000 (00:26 +0800)]
Rollup merge of #50875 - QuietMisdreavus:short-features, r=GuillaumeGomez

rustdoc: use "short form" doc(cfg) printing even when combined with other conditionals

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

The original "short form" printing was introduced when `target_feature` was added to the `doc(cfg)` handling. However, it didn't properly propagate the "short form" indicator if the cfg was a combination of multiple conditionals, so the linked issue happened. This changes the handling to use a bool in the original `Html` wrapper, rather than a separate wrapper struct that defers to the original one.

6 years agoRollup merge of #50863 - oli-obk:const_len, r=SimonSapin,Gankro
kennytm [Tue, 22 May 2018 16:26:10 +0000 (00:26 +0800)]
Rollup merge of #50863 - oli-obk:const_len, r=SimonSapin,Gankro

Make `[T]::len` and `str::len` const fn

r? @Gankro

6 years agoRollup merge of #50849 - est31:visit_closure_args, r=michaelwoerister
kennytm [Tue, 22 May 2018 16:26:08 +0000 (00:26 +0800)]
Rollup merge of #50849 - est31:visit_closure_args, r=michaelwoerister

CheckLoopVisitor: also visit closure arguments

This turns the ICE #50581 in this code:

```rust
fn main() {
    |_: [u8; break]| ();
}
```

from
```
    'assertion failed: self.tcx.sess.err_count() > 0', librustc_typeck/check/mod.rs
```
to
```
    librustc_mir/hair/cx/expr.rs:543: invalid loop id for break: not inside loop scope
```

which is an ICE as well but at a later stage during compilation and most importantly
fixes of bug #50576 will fix this as well.

As this "only" moves an ICE to a later stage, I didn't add any tests.

Now I have manually verified the default impls of the visitor trait to check whether we have missed any other opportunity to visit more stuff and coudln't find anything (except the missing `break` visit I've fixed in #50829 but that one was already r+'d so I didn't want to push more commits).

6 years agoRollup merge of #50846 - GuillaumeGomez:add-e0665, r=frewsxcv
kennytm [Tue, 22 May 2018 16:26:06 +0000 (00:26 +0800)]
Rollup merge of #50846 - GuillaumeGomez:add-e0665, r=frewsxcv

Add E0665

6 years agobuild the 2018 edition
steveklabnik [Mon, 21 May 2018 19:31:12 +0000 (15:31 -0400)]
build the 2018 edition

6 years agoAuto merge of #49172 - oli-obk:const_let, r=eddyb
bors [Tue, 22 May 2018 12:57:06 +0000 (12:57 +0000)]
Auto merge of #49172 - oli-obk:const_let, r=eddyb

Allow let bindings and destructuring in constants and const fn

r? @eddyb

cc https://github.com/rust-lang/rust/issues/48821

6 years agoDeduplicate match arms
Oliver Schneider [Tue, 22 May 2018 11:56:37 +0000 (13:56 +0200)]
Deduplicate match arms

6 years agoAuto merge of #50520 - Zoxc:alloc-misc, r=oli-obk
bors [Tue, 22 May 2018 10:35:59 +0000 (10:35 +0000)]
Auto merge of #50520 - Zoxc:alloc-misc, r=oli-obk

Misc changes related to Miri allocations

This builds on top of https://github.com/rust-lang/rust/pull/50249

r? @oli-obk

6 years agoRight-size the `VecDeque` in `coerce_unsized`.
Nicholas Nethercote [Tue, 22 May 2018 06:51:28 +0000 (16:51 +1000)]
Right-size the `VecDeque` in `coerce_unsized`.

The default capacity of a VecDeque is 8, which is excessive here. In a
"base incremental" check build of rustc-perf's tuple-stress benchmark,
this decreases total heap allocation by 26%. I couldn't see a clear
speedup, but it can't hurt.

6 years agoFix a typo in a comment
Oliver Schneider [Tue, 8 May 2018 15:29:09 +0000 (17:29 +0200)]
Fix a typo in a comment

6 years agoRemove now unused error code
Oliver Schneider [Tue, 8 May 2018 12:35:45 +0000 (14:35 +0200)]
Remove now unused error code

6 years agoReport let bindings and statements as unstable
Oliver Schneider [Tue, 8 May 2018 11:59:26 +0000 (13:59 +0200)]
Report let bindings and statements as unstable

6 years agoBe more explicit about what's skipped
Oliver Schneider [Mon, 7 May 2018 09:30:41 +0000 (11:30 +0200)]
Be more explicit about what's skipped

6 years agoAllow let bindings in const fn and constants
Oliver Schneider [Tue, 27 Mar 2018 19:16:37 +0000 (21:16 +0200)]
Allow let bindings in const fn and constants

6 years agoAuto merge of #50876 - matthewjasper:rollback-trivial-bounds, r=nikomatsakis
bors [Tue, 22 May 2018 06:54:34 +0000 (06:54 +0000)]
Auto merge of #50876 - matthewjasper:rollback-trivial-bounds, r=nikomatsakis

Filter global bounds from ParamEnv again.

This PR adds back the filtering of global bounds from ParamEnv as a temporary solution for #50825.

<details>

Long term, the fix seems like it should be changing the priority in `candidate_should_be_dropped_in_favor_of` so that (global) where clauses aren't considered as highly.

https://github.com/rust-lang/rust/blob/a722296b6ec17fecd3f16a7d3f9232b83e5de800/src/librustc/traits/select.rs#L2017-L2022

</details>

r? @nikomatsakis

6 years agoFix FileCheck finding
John Kåre Alsaker [Tue, 22 May 2018 01:40:01 +0000 (03:40 +0200)]
Fix FileCheck finding

6 years agoMicro-optimization on PR#50697
Keith Yeung [Tue, 22 May 2018 04:45:15 +0000 (21:45 -0700)]
Micro-optimization on PR#50697

6 years agoAuto merge of #50838 - alexcrichton:token-impls, r=eddyb
bors [Tue, 22 May 2018 04:17:20 +0000 (04:17 +0000)]
Auto merge of #50838 - alexcrichton:token-impls, r=eddyb

rustc: Fix joint-ness of stringified token-streams

This commit fixes `StringReader`'s parsing of tokens which have been stringified
through procedural macros. Whether or not a token tree is joint is defined by
span information, but when working with procedural macros these spans are often
dummy and/or overridden which means that they end up considering all operators
joint if they can!

The fix here is to track the raw source span as opposed to the overridden span.
With this information we can more accurately classify `Punct` structs as either
joint or not.

Closes #50700

6 years agoIntroduce AllocType which indicates what AllocIds point to
John Kåre Alsaker [Wed, 2 May 2018 04:03:06 +0000 (06:03 +0200)]
Introduce AllocType which indicates what AllocIds point to

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 #50486 - Manishearth:approx-stab, r=nrc
bors [Tue, 22 May 2018 01:53:55 +0000 (01:53 +0000)]
Auto merge of #50486 - Manishearth:approx-stab, r=nrc

Stabilize suggestion applicability field in json output

cc @killercup

r? @nrc

6 years agoAuto merge of #49283 - varkor:combining-chars-escape_debug, r=SimonSapin
bors [Mon, 21 May 2018 23:26:32 +0000 (23:26 +0000)]
Auto merge of #49283 - varkor:combining-chars-escape_debug, r=SimonSapin

Escape combining characters in char::Debug

Although combining characters are technically printable, they make little sense to print on their own with `Debug`: it'd be better to escape them like non-printable characters.

This is a breaking change, but I imagine the fact `escape_debug` is rare and almost certainly primarily used for debugging that this is an acceptable change.
Resolves #41922.

r? @alexcrichton
cc @clarcharr

6 years agorustdoc: set tab width in rust source blocks
QuietMisdreavus [Mon, 21 May 2018 16:29:56 +0000 (11:29 -0500)]
rustdoc: set tab width in rust source blocks

6 years agoAuto merge of #50812 - kennytm:fix-50756-miri-bad-float-behavior, r=oli-obk
bors [Mon, 21 May 2018 21:16:16 +0000 (21:16 +0000)]
Auto merge of #50812 - kennytm:fix-50756-miri-bad-float-behavior, r=oli-obk

Fix issue #50811 (`NaN > NaN` was true).

Fix #50811

Make sure the float comparison output is consistent with the expected behavior when NaN is involved.

----

Note: This PR is a **BREAKING CHANGE**. If you have used `>` or `>=` to compare floats, and make the result as the length of a fixed array type, like:

```rust
use std::f64::NAN;
let x: [u8; (NAN > NAN) as usize] = [1];
```

then the code will no longer compile. Previously, all float comparison involving NaN will just return "Greater", i.e. `NAN > NAN` would wrongly return `true` during const evaluation. If you need to retain the old behavior (why), you may replace `a > b` with `a != a || b != b || a > b`.

6 years agoFix tables.rs
varkor [Mon, 21 May 2018 18:12:36 +0000 (19:12 +0100)]
Fix tables.rs

6 years agoAvoid counting characters and add explanatory comment to test
varkor [Mon, 21 May 2018 17:57:49 +0000 (18:57 +0100)]
Avoid counting characters and add explanatory comment to test

6 years agoOnly escape extended grapheme characters in the first position
varkor [Thu, 17 May 2018 09:45:34 +0000 (10:45 +0100)]
Only escape extended grapheme characters in the first position

6 years agoMake {char, str}::escape_debug and impl Debug for {char, str} consistent
varkor [Wed, 16 May 2018 22:20:22 +0000 (23:20 +0100)]
Make {char, str}::escape_debug and impl Debug for {char, str} consistent

6 years agoUse Grapheme_Extend instead of Mn
varkor [Wed, 16 May 2018 22:19:58 +0000 (23:19 +0100)]
Use Grapheme_Extend instead of Mn

6 years agoUse the correct output directory for downloading Unicode files
varkor [Wed, 16 May 2018 22:08:19 +0000 (23:08 +0100)]
Use the correct output directory for downloading Unicode files

6 years agoRemove example in test for is_nonspacing_mark because it's currently private
varkor [Fri, 13 Apr 2018 23:21:25 +0000 (00:21 +0100)]
Remove example in test for is_nonspacing_mark because it's currently private

6 years agoAdd test for Debug formatting of char
varkor [Thu, 12 Apr 2018 21:19:02 +0000 (22:19 +0100)]
Add test for Debug formatting of char

6 years agoEscape combining characters in escape_debug
varkor [Thu, 12 Apr 2018 10:39:18 +0000 (11:39 +0100)]
Escape combining characters in escape_debug

6 years agoKeep tables.rs copyright notice up to date
varkor [Thu, 12 Apr 2018 11:24:08 +0000 (12:24 +0100)]
Keep tables.rs copyright notice up to date

6 years agoDownload unicode data files in directory of unicode.py
varkor [Thu, 12 Apr 2018 11:09:47 +0000 (12:09 +0100)]
Download unicode data files in directory of unicode.py

6 years agoUpdate unicode/tables.rs with Mn
varkor [Thu, 12 Apr 2018 10:57:49 +0000 (11:57 +0100)]
Update unicode/tables.rs with Mn

6 years agoUpdate .gitignore for libstd_unicode
varkor [Thu, 12 Apr 2018 10:46:52 +0000 (11:46 +0100)]
Update .gitignore for libstd_unicode

6 years agoupdate tests
Manish Goregaokar [Mon, 21 May 2018 17:47:34 +0000 (10:47 -0700)]
update tests

6 years agoRemove rustc_serialize_exclude_null
Manish Goregaokar [Sun, 6 May 2018 20:30:57 +0000 (13:30 -0700)]
Remove rustc_serialize_exclude_null

6 years agoStabilize suggestion applicability field in json output
Manish Goregaokar [Sun, 6 May 2018 20:30:06 +0000 (13:30 -0700)]
Stabilize suggestion applicability field in json output

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 agoAdd some runtime sanity checks
Oliver Schneider [Sun, 20 May 2018 18:25:28 +0000 (20:25 +0200)]
Add some runtime sanity checks

6 years agoMake `[T]::len` and `str::len` const fn
Oliver Schneider [Fri, 18 May 2018 13:16:57 +0000 (15:16 +0200)]
Make `[T]::len` and `str::len` const fn

6 years agorustc: Fix procedural macros generating lifetime tokens
Alex Crichton [Mon, 21 May 2018 16:02:50 +0000 (09:02 -0700)]
rustc: Fix procedural macros generating lifetime tokens

This commit fixes an accidental regression from #50473 where lifetime tokens
produced by procedural macros ended up getting lost in translation in the
compiler and not actually producing parseable code. The issue lies in the fact
that a lifetime's `Ident` is prefixed with `'`. The `glue` implementation for
gluing joint tokens together forgot to take this into account so the lifetime
inside of `Ident` was missing the leading tick!

The `glue` implementation here is updated to create a new `Symbol` in these
situations to manufacture a new `Ident` with a leading tick to ensure it parses
correctly.

Closes #50942

6 years agoStabilize feature from_ref
Stjepan Glavina [Mon, 21 May 2018 15:59:20 +0000 (17:59 +0200)]
Stabilize feature from_ref

6 years agoAdd E0665
Guillaume Gomez [Thu, 17 May 2018 19:17:53 +0000 (21:17 +0200)]
Add E0665

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 agoOptimize seen Predicate filtering.
Nicholas Nethercote [Tue, 8 May 2018 01:17:18 +0000 (11:17 +1000)]
Optimize seen Predicate filtering.

This speeds up a few rustc-perf benchmark runs, most notably ones
involving 'coercions', the best by 2%.

6 years agoInline `try_get`.
Nicholas Nethercote [Mon, 21 May 2018 08:35:47 +0000 (18:35 +1000)]
Inline `try_get`.

This speeds up lots of rustc-perf benchmark runs. The maximum
improvement is 1%, but there are a lot in the 0.5--1.0% range.

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 agoIssue #50636: Improve error diagnostic with missing commas after struct fields.
Simon Martin [Sun, 20 May 2018 04:43:11 +0000 (06:43 +0200)]
Issue #50636: Improve error diagnostic with missing commas after struct fields.

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 agoFix typo in cell.rs
Daniel Mueller [Sun, 20 May 2018 03:40:11 +0000 (20:40 -0700)]
Fix typo in cell.rs

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