]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #64973 - ecstatic-morse:fix-debuginfo-test, r=alexcrichton
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:39 +0000 (18:24 +0200)]
Rollup merge of #64973 - ecstatic-morse:fix-debuginfo-test, r=alexcrichton

Fix typo while setting `compile-flags` in test

This test is meant to check for an ICE when generating debug info, but didn't actually pass `-g` due to the typo.

I also removed the `FIXME`, since this needs to actually be built (not just checked) to trigger the ICE.

4 years agoRollup merge of #64967 - ecstatic-morse:issue-64945, r=oli-obk
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:38 +0000 (18:24 +0200)]
Rollup merge of #64967 - ecstatic-morse:issue-64945, r=oli-obk

Don't mark borrows of zero-sized arrays as indirectly mutable

Resolves #64945

r? @oli-obk

4 years agoRollup merge of #64961 - rust-lang:spastorino-patch-1, r=oli-obk
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:36 +0000 (18:24 +0200)]
Rollup merge of #64961 - rust-lang:spastorino-patch-1, r=oli-obk

Make comment about dummy type a bit more clear

4 years agoRollup merge of #64948 - GuillaumeGomez:improve-sidebar-styling, r=Mark-Simulacrum
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:35 +0000 (18:24 +0200)]
Rollup merge of #64948 - GuillaumeGomez:improve-sidebar-styling, r=Mark-Simulacrum

Improve sidebar styling to make its integration easier

Part of https://github.com/rust-lang/docs.rs/issues/417

Setting the height was an error: forcing the element bottom to be at the bottom allows to change to top of the sidebar.

r? @Mark-Simulacrum

4 years agoRollup merge of #64922 - spastorino:make-place-builder, r=nikomatsakis
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:33 +0000 (18:24 +0200)]
Rollup merge of #64922 - spastorino:make-place-builder, r=nikomatsakis

Use PlaceBuilder to avoid a lot of slice -> vec -> slice convertions

r? @oli-obk

4 years agoRollup merge of #64914 - pnkfelix:issue-64453-regression-test, r=nikomatsakis
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:31 +0000 (18:24 +0200)]
Rollup merge of #64914 - pnkfelix:issue-64453-regression-test, r=nikomatsakis

regression test for 64453 borrow check error.

Fix #64453

4 years agoRollup merge of #64850 - Mark-Simulacrum:dedup-dep-node, r=michaelwoerister
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:30 +0000 (18:24 +0200)]
Rollup merge of #64850 - Mark-Simulacrum:dedup-dep-node, r=michaelwoerister

Remove inlines from DepNode code

4 years agoRollup merge of #64581 - ztlpn:fix-ok-wrapping-unreachable-code, r=Centril
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:29 +0000 (18:24 +0200)]
Rollup merge of #64581 - ztlpn:fix-ok-wrapping-unreachable-code, r=Centril

Fix unreachable_code warnings for try{} block ok-wrapped expressions

Fixes #54165 and fixes #63324.

4 years agoUse PlaceBuilder to avoid a lot of slice -> vec -> slice convertions
Santiago Pastorino [Mon, 30 Sep 2019 16:09:10 +0000 (13:09 -0300)]
Use PlaceBuilder to avoid a lot of slice -> vec -> slice convertions

4 years agoRemove inline annotations from dep_node
Mark Rousskov [Mon, 30 Sep 2019 17:46:41 +0000 (13:46 -0400)]
Remove inline annotations from dep_node

4 years agoAuto merge of #64981 - tmandry:rollup-slfkhay, r=tmandry
bors [Wed, 2 Oct 2019 06:08:24 +0000 (06:08 +0000)]
Auto merge of #64981 - tmandry:rollup-slfkhay, r=tmandry

Rollup of 11 pull requests

Successful merges:

 - #64649 (Avoid ICE on return outside of fn with literal array)
 - #64722 (Make all alt builders produce parallel-enabled compilers)
 - #64801 (Avoid `chain()` in `find_constraint_paths_between_regions()`.)
 - #64805 (Still more `ObligationForest` improvements.)
 - #64840 (SelfProfiler API refactoring and part one of event review)
 - #64885 (use try_fold instead of try_for_each to reduce compile time)
 - #64942 (Fix clippy warnings)
 - #64952 (Update cargo.)
 - #64974 (Fix zebra-striping in generic dataflow visualization)
 - #64978 (Fully clear `HandlerInner` in `Handler::reset_err_count`)
 - #64979 (Update books)

Failed merges:

 - #64959 (syntax: improve parameter without type suggestions)

r? @ghost

4 years agoRollup merge of #64979 - ehuss:update-books, r=ehuss
Tyler Mandry [Wed, 2 Oct 2019 06:06:25 +0000 (23:06 -0700)]
Rollup merge of #64979 - ehuss:update-books, r=ehuss

Update books

## reference

3 commits in fa5dfb832ef8a7568e17dabf612f486d641ff4ac..320d232b206edecb67489316f71a14e31dbc6c08
2019-09-16 20:42:56 +0200 to 2019-10-01 17:05:35 +0200
- Update async/await keywords to real keywords. (rust-lang-nursery/reference#687)
- Remove the warning that appears on every page. (rust-lang-nursery/reference#685)
- Eschew fp lit pattern (rust-lang-nursery/reference#683)

## book

9 commits in 871416b85c1a73717d65d6f4a9ea29e5aef3db0e..04806c80be0f54b1290287e3f85e84bdfc0b6ec7
2019-09-16 09:46:20 -0400 to 2019-10-01 20:20:22 -0400
- Fix tidy error. (rust-lang/book#2104)
- Fancy quotes
- Commit autogenerated cargo content
- Move all scripts into tools
- We can start lines with numbers without creating ordered lists
- ci: validate that all used references are defined (rust-lang/book#2032)
- Remove the check for unstable features
- Specify the rustc version we're using in a rust-toolchain file
- Fix broken link to Chapter 13-01 in Chapter 12-04 (rust-lang/book#2025)

## rust-by-example

9 commits in 67cfbf31df880728dcf7cb35b15b028ec92caf31..a6288e7407a6c4c19ea29de6d43f40c803883f21
2019-09-18 09:36:40 -0300 to 2019-10-01 10:09:14 -0300
- Add reference to lifetime in structs (rust-lang/rust-by-example#1274)
- Rectangle ambiguity (rust-lang/rust-by-example#1270)
- Make Parsing a String code editable (rust-lang/rust-by-example#1268)
- Fix match range pattern usage (rust-lang/rust-by-example#1269)
- Added type alias enum variant rfc (rust-lang/rust-by-example#1267)
- Chapter 9.2.5: impl FnOnce() works in 1.35 (rust-lang/rust-by-example#1266)
- Move chapters from folder "traits" to "trait" (rust-lang/rust-by-example#1263)
- Capturing changes (rust-lang/rust-by-example#1265)
- Fix rust-lang/rust-by-example#1261: document Iterator::position (rust-lang/rust-by-example#1262)

r? @ghost

4 years agoRollup merge of #64978 - AnthonyMikh:librustc_errors/lib__fully_clear_inner_handler...
Tyler Mandry [Wed, 2 Oct 2019 06:06:24 +0000 (23:06 -0700)]
Rollup merge of #64978 - AnthonyMikh:librustc_errors/lib__fully_clear_inner_handler, r=Mark-Simulacrum

Fully clear `HandlerInner` in `Handler::reset_err_count`

Address [`FIXME`](https://github.com/rust-lang/rust/blob/702b45e409495a41afcccbe87a251a692b0cefab/src/librustc_errors/lib.rs#L472) for `Handler::reset_err_count` in the way suggested by @Mark-Simulacrum, i. e. clear all the fields of `HandlerInner`.

cc @estebank

4 years agoRollup merge of #64974 - ecstatic-morse:generic-graphviz-zebra, r=petrochenkov
Tyler Mandry [Wed, 2 Oct 2019 06:06:22 +0000 (23:06 -0700)]
Rollup merge of #64974 - ecstatic-morse:generic-graphviz-zebra, r=petrochenkov

Fix zebra-striping in generic dataflow visualization

A small formatting improvement to #64828.

Prior to this, the background color of the first row of the table for each basic block changed seemingly at random. You can see this in [basic block #5](https://github.com/rust-lang/rust/pull/64828#issuecomment-536690047) under "New table". Now it is always light.

This also updates the example table to match the current output.

4 years agoRollup merge of #64952 - michaelwoerister:update-cargo, r=alexcrichton
Tyler Mandry [Wed, 2 Oct 2019 06:06:20 +0000 (23:06 -0700)]
Rollup merge of #64952 - michaelwoerister:update-cargo, r=alexcrichton

Update cargo.

Pulls https://github.com/rust-lang/cargo/pull/7417/commits/f3c92ed52e65b10444020ea453c5823ab4d5ec37 into nightly Rust.

r? @alexcrichton

4 years agoRollup merge of #64942 - JohnTitor:fix-clippy, r=eddyb
Tyler Mandry [Wed, 2 Oct 2019 06:06:19 +0000 (23:06 -0700)]
Rollup merge of #64942 - JohnTitor:fix-clippy, r=eddyb

Fix clippy warnings

* Use `match` instead of `if` chain
* Remove redundant `into_iter()`
* Use `copied()` instead of `map()`

etc.

4 years agoRollup merge of #64885 - andjo403:iter, r=scottmcm
Tyler Mandry [Wed, 2 Oct 2019 06:06:17 +0000 (23:06 -0700)]
Rollup merge of #64885 - andjo403:iter, r=scottmcm

use try_fold instead of try_for_each to reduce compile time

as it was stated in #64572 that the biggest gain was due to less code was generated I tried to reduce the number of functions to inline by using try_fold direct instead of calling try_for_each that calls try_fold.

as there is some gains with using the try_fold function this is maybe a way forward.
when I tried to compile the clap-rs benchmark I get times gains only some % from #64572

there is more function that use eg. fold that calls try_fold that also can be changed but the question is how mush "duplication" that is tolerated in std to give faster compile times

can someone start a perf run?

cc @nnethercote @scottmcm @bluss
r? @ghost

4 years agoRollup merge of #64840 - michaelwoerister:self-profiling-raii-refactor, r=wesleywiser
Tyler Mandry [Wed, 2 Oct 2019 06:06:16 +0000 (23:06 -0700)]
Rollup merge of #64840 - michaelwoerister:self-profiling-raii-refactor, r=wesleywiser

SelfProfiler API refactoring and part one of event review

This PR refactors the `SelfProfiler` a little bit so that most profiling methods are RAII-based. The codegen backend code already had something similar, this refactoring pulls this functionality up into `SelfProfiler` itself, for general use.

The second commit of this PR is a review and update of the existing events we are already recording. Names have been made more consistent. CGU names have been removed from event names. They will be added back in when function parameter recording is implemented.

There is still some work to be done for adding new events, especially around trait resolution and the incremental system.

r? @wesleywiser

4 years agoRollup merge of #64805 - nnethercote:ObligForest-still-more, r=nikomatsakis
Tyler Mandry [Wed, 2 Oct 2019 06:06:14 +0000 (23:06 -0700)]
Rollup merge of #64805 - nnethercote:ObligForest-still-more, r=nikomatsakis

Still more `ObligationForest` improvements.

Following on from #64627, more readability improvements, but negligible effects on speed.

r? @nikomatsakis

4 years agoRollup merge of #64801 - nnethercote:improve-find_constraint_paths_between_regions...
Tyler Mandry [Wed, 2 Oct 2019 06:06:12 +0000 (23:06 -0700)]
Rollup merge of #64801 - nnethercote:improve-find_constraint_paths_between_regions, r=estebank

Avoid `chain()` in `find_constraint_paths_between_regions()`.

This iterator can be hot, and chained iterators are slow. The second
half of the chain is almost always empty, so this commit specializes the
code to avoid the chained iteration.

This change reduces instruction counts for the `wg-grammar` benchmark by
up to 1.5%.

4 years agoRollup merge of #64722 - Mark-Simulacrum:alt-parallel, r=alexcrichton
Tyler Mandry [Wed, 2 Oct 2019 06:06:11 +0000 (23:06 -0700)]
Rollup merge of #64722 - Mark-Simulacrum:alt-parallel, r=alexcrichton

Make all alt builders produce parallel-enabled compilers

We're not quite ready to ship parallel compilers by default, but the alt
builders are not used too much (in theory), so we believe that shipping
a possibly-broken compiler there is not too problematic.

r? @nikomatsakis

4 years agoRollup merge of #64649 - estebank:returnator, r=varkor
Tyler Mandry [Wed, 2 Oct 2019 06:06:09 +0000 (23:06 -0700)]
Rollup merge of #64649 - estebank:returnator, r=varkor

Avoid ICE on return outside of fn with literal array

Do not ICE when encountering `enum E { A = return [0][0] }`.

Fix #64638.

4 years agoUpdate books
Eric Huss [Wed, 2 Oct 2019 02:35:13 +0000 (19:35 -0700)]
Update books

4 years agoAuto merge of #64963 - Manishearth:clippyup, r=Manishearth
bors [Wed, 2 Oct 2019 02:01:20 +0000 (02:01 +0000)]
Auto merge of #64963 - Manishearth:clippyup, r=Manishearth

Update clippy

r? @ghost

4 years agoFully clear `HandlerInner` in `Handler::reset_err_count`
AnthonyMikh [Wed, 2 Oct 2019 01:13:02 +0000 (04:13 +0300)]
Fully clear `HandlerInner` in `Handler::reset_err_count`

4 years agoUpdate clippy
Manish Goregaokar [Wed, 2 Oct 2019 00:53:57 +0000 (17:53 -0700)]
Update clippy

4 years agoUpdate example table to match current output
Dylan MacKenzie [Tue, 1 Oct 2019 22:23:04 +0000 (15:23 -0700)]
Update example table to match current output

4 years agoReset row background for each block
Dylan MacKenzie [Tue, 1 Oct 2019 22:21:58 +0000 (15:21 -0700)]
Reset row background for each block

Now the first row of each basic block is always light instead of
changing seemingly at random.

4 years agoThis needs to be build-pass since it involves debuginfo
Dylan MacKenzie [Tue, 1 Oct 2019 22:10:29 +0000 (15:10 -0700)]
This needs to be build-pass since it involves debuginfo

4 years agoFix typo passing flags to rustc
Dylan MacKenzie [Tue, 1 Oct 2019 22:09:53 +0000 (15:09 -0700)]
Fix typo passing flags to rustc

4 years agoAuto merge of #64972 - Centril:rollup-gcawast, r=Centril
bors [Tue, 1 Oct 2019 22:04:23 +0000 (22:04 +0000)]
Auto merge of #64972 - Centril:rollup-gcawast, r=Centril

Rollup of 7 pull requests

Successful merges:

 - #63416 (apfloat: improve doc comments)
 - #64820 (BTreeSet intersection, is_subset & difference optimizations)
 - #64910 (syntax: cleanup param, method, and misc parsing)
 - #64912 (Remove unneeded `fn main` blocks from docs)
 - #64933 (Fixes #64919. Suggest fix based on operator precendence.)
 - #64943 (Add lower bound doctests for `saturating_{add,sub}` signed ints)
 - #64950 (Simplify interners)

Failed merges:

r? @ghost

4 years agoUpdate rls submodule
Alex Crichton [Tue, 1 Oct 2019 22:03:25 +0000 (15:03 -0700)]
Update rls submodule

4 years agoUpdate `Cargo.lock` for cargo update
Alex Crichton [Tue, 1 Oct 2019 13:11:32 +0000 (06:11 -0700)]
Update `Cargo.lock` for cargo update

4 years agoAdd test cases for #64945
Dylan MacKenzie [Tue, 1 Oct 2019 20:27:36 +0000 (13:27 -0700)]
Add test cases for #64945

This also tests that `&&[]` no longer causes an ICE in this PR (although
the test fails the borrow checker). This could be more complete.

4 years agoRollup merge of #64950 - nnethercote:simplify-interners, r=varkor,spastorino
Mazdak Farrokhzad [Tue, 1 Oct 2019 21:56:27 +0000 (23:56 +0200)]
Rollup merge of #64950 - nnethercote:simplify-interners, r=varkor,spastorino

Simplify interners

Some code readability improvements.

4 years agoRollup merge of #64943 - lzutao:doc-saturating, r=shepmaster
Mazdak Farrokhzad [Tue, 1 Oct 2019 21:56:26 +0000 (23:56 +0200)]
Rollup merge of #64943 - lzutao:doc-saturating, r=shepmaster

Add lower bound doctests for `saturating_{add,sub}` signed ints

Closes #64940

4 years agoRollup merge of #64933 - sam09:master, r=estebank
Mazdak Farrokhzad [Tue, 1 Oct 2019 21:56:24 +0000 (23:56 +0200)]
Rollup merge of #64933 - sam09:master, r=estebank

Fixes #64919. Suggest fix based on operator precendence.

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

4 years agoRollup merge of #64912 - lzutao:unneeded-main-doc, r=jonas-schievink
Mazdak Farrokhzad [Tue, 1 Oct 2019 21:56:23 +0000 (23:56 +0200)]
Rollup merge of #64912 - lzutao:unneeded-main-doc, r=jonas-schievink

Remove unneeded `fn main` blocks from docs

## [No whitespace diff](https://github.com/rust-lang/rust/pull/64912/files?w=1)

4 years agoRollup merge of #64910 - Centril:params-cleanup, r=petrochenkov
Mazdak Farrokhzad [Tue, 1 Oct 2019 21:56:21 +0000 (23:56 +0200)]
Rollup merge of #64910 - Centril:params-cleanup, r=petrochenkov

syntax: cleanup param, method, and misc parsing

Do some misc cleanup of the parser:
- Method and parameter parsing is refactored.
- A parser for `const | mut` is introduced that https://github.com/rust-lang/rust/pull/64588 can reuse.
- Some other misc parsing.

Next up in a different PR:
- ~Implementing https://github.com/rust-lang/rust/issues/64252.~ -- maybe some other time...
- Heavily restructuring up `item.rs` which is a mess (hopefully, no promises ^^).

r? @petrochenkov

4 years agoRollup merge of #64820 - ssomers:master, r=bluss
Mazdak Farrokhzad [Tue, 1 Oct 2019 21:56:20 +0000 (23:56 +0200)]
Rollup merge of #64820 - ssomers:master, r=bluss

BTreeSet intersection, is_subset & difference optimizations

...based on the range of values contained; in particular, a massive improvement when these ranges are disjoint (or merely touching), like in the neg-vs-pos benchmarks already in liballoc. Inspired by #64383 but none of the ideas there worked out.

I introduced another variant in IntersectionInner and in DifferenceInner, because I couldn't find a way to initialize these iterators as empty if there's no empty set around.

Also, reduced the size of "large" sets in test cases - if Miri can't handle it, it was needlessly slowing down everyone.

4 years agoRollup merge of #63416 - RalfJung:apfloat, r=eddyb
Mazdak Farrokhzad [Tue, 1 Oct 2019 21:56:16 +0000 (23:56 +0200)]
Rollup merge of #63416 - RalfJung:apfloat, r=eddyb

apfloat: improve doc comments

r? @eddyb @nagisa

4 years agoDon't mark zero-sized arrays as indirectly mutable when borrowed
Dylan MacKenzie [Tue, 1 Oct 2019 19:01:14 +0000 (12:01 -0700)]
Don't mark zero-sized arrays as indirectly mutable when borrowed

4 years agoPass attrs to `do_dataflow` in new const checker
Dylan MacKenzie [Tue, 1 Oct 2019 18:35:50 +0000 (11:35 -0700)]
Pass attrs to `do_dataflow` in new const checker

This is needed to dump graphviz results for the `IndirectlyMutableLocals` analysis.

4 years agochange .node -> .kind after rebase
Alex Zatelepin [Tue, 1 Oct 2019 17:04:41 +0000 (20:04 +0300)]
change .node -> .kind after rebase

4 years agoUpdate src/librustc/ty/mod.rs
Santiago Pastorino [Tue, 1 Oct 2019 16:03:33 +0000 (13:03 -0300)]
Update src/librustc/ty/mod.rs

Co-Authored-By: Oliver Scherer <github35764891676564198441@oli-obk.de>
4 years agoMake comment about dummy type a bit more clear
Santiago Pastorino [Tue, 1 Oct 2019 15:51:15 +0000 (12:51 -0300)]
Make comment about dummy type a bit more clear

4 years agofix test after rebase
Alex Zatelepin [Sun, 22 Sep 2019 14:09:10 +0000 (17:09 +0300)]
fix test after rebase

4 years agoaddress review comments
Alex Zatelepin [Wed, 18 Sep 2019 22:20:18 +0000 (01:20 +0300)]
address review comments

4 years agoadd tests
Alex Zatelepin [Wed, 18 Sep 2019 15:10:19 +0000 (18:10 +0300)]
add tests

4 years agofix spurious unreachable_code lints for try{} block ok-wrapping
Alex Zatelepin [Wed, 18 Sep 2019 15:08:56 +0000 (18:08 +0300)]
fix spurious unreachable_code lints for try{} block ok-wrapping

4 years agofix typo
Alex Zatelepin [Mon, 16 Sep 2019 14:16:17 +0000 (17:16 +0300)]
fix typo

4 years agoFix clippy warnings
Yuki Okushi [Tue, 1 Oct 2019 04:43:30 +0000 (13:43 +0900)]
Fix clippy warnings

4 years agoregression test for 64453 borrow check error.
Felix S. Klock II [Mon, 30 Sep 2019 09:05:04 +0000 (11:05 +0200)]
regression test for 64453 borrow check error.

4 years agoBTreeSet intersection, difference & is_subnet optimizations
Stein Somers [Sun, 22 Sep 2019 15:45:47 +0000 (17:45 +0200)]
BTreeSet intersection, difference & is_subnet optimizations

4 years agoRemove unneeded `fn main` blocks from docs
Lzu Tao [Tue, 1 Oct 2019 11:55:46 +0000 (11:55 +0000)]
Remove unneeded `fn main` blocks from docs

4 years agoUpdate cargo.
Michael Woerister [Tue, 1 Oct 2019 11:53:17 +0000 (13:53 +0200)]
Update cargo.

4 years agoChange to use exprPrecedence instead of exprKind.
Sam Radhakrishnan [Tue, 1 Oct 2019 09:00:22 +0000 (05:00 -0400)]
Change to use exprPrecedence instead of exprKind.

4 years agoImprove sidebar styling to make its integration easier
Guillaume Gomez [Tue, 1 Oct 2019 08:32:45 +0000 (10:32 +0200)]
Improve sidebar styling to make its integration easier

4 years agoAuto merge of #64946 - Centril:rollup-66mj5o0, r=Centril
bors [Tue, 1 Oct 2019 07:56:52 +0000 (07:56 +0000)]
Auto merge of #64946 - Centril:rollup-66mj5o0, r=Centril

Rollup of 10 pull requests

Successful merges:

 - #63674 (syntax: Support modern attribute syntax in the `meta` matcher)
 - #63931 (Stabilize macros in some more positions)
 - #64887 (syntax: recover trailing `|` in or-patterns)
 - #64895 (async/await: improve not-send errors)
 - #64896 (Remove legacy grammar)
 - #64907 (A small amount of tidying-up factored out from PR #64648)
 - #64928 (Add tests for some issues)
 - #64930 (Silence unreachable code lint from await desugaring)
 - #64935 (Improve code clarity)
 - #64937 (Deduplicate closure type errors)

Failed merges:

r? @ghost

4 years agoRollup merge of #64937 - estebank:dedup-closure-err, r=Centril
Mazdak Farrokhzad [Tue, 1 Oct 2019 07:55:39 +0000 (09:55 +0200)]
Rollup merge of #64937 - estebank:dedup-closure-err, r=Centril

Deduplicate closure type errors

Closure typing obligations flow in both direcitons to properly infer
types. Because of this, we will get 2 type errors whenever there's
an unfulfilled obligation. To avoid this, we deduplicate them in the
`InferCtxt`.

4 years agoRollup merge of #64935 - AnthonyMikh:librustc_errors/emmiter__code-clarity, r=estebank
Mazdak Farrokhzad [Tue, 1 Oct 2019 07:55:38 +0000 (09:55 +0200)]
Rollup merge of #64935 - AnthonyMikh:librustc_errors/emmiter__code-clarity, r=estebank

Improve code clarity

No commit except 55b54285c811b6ab12bb0ba001126fd5b7d3bd09 address performance, just making the existing code more clear.

r? @estebank

4 years agoRollup merge of #64930 - davidtwco:issue-61798-diverging-await, r=petrochenkov
Mazdak Farrokhzad [Tue, 1 Oct 2019 07:55:37 +0000 (09:55 +0200)]
Rollup merge of #64930 - davidtwco:issue-61798-diverging-await, r=petrochenkov

Silence unreachable code lint from await desugaring

Fixes #61798.

This PR silences the unreachable code lint when it originates from within an await desugaring.

4 years agoRollup merge of #64928 - JohnTitor:add-some-tests, r=Centril
Mazdak Farrokhzad [Tue, 1 Oct 2019 07:55:35 +0000 (09:55 +0200)]
Rollup merge of #64928 - JohnTitor:add-some-tests, r=Centril

Add tests for some issues

Closes #50571
Closes #58022
Closes #58344

4 years agoRollup merge of #64907 - alexreg:tidy-up, r=Mark-Simulacrum
Mazdak Farrokhzad [Tue, 1 Oct 2019 07:55:34 +0000 (09:55 +0200)]
Rollup merge of #64907 - alexreg:tidy-up, r=Mark-Simulacrum

A small amount of tidying-up factored out from PR #64648

As requested by @Mark-Simulacrum, I put this in a separate commit to make it easier to review. (As far as I can tell, no violations of the policy here, and they are simply in a separate PR because they're not directly related to the import of that PR.)

r? @Mark-Simulacrum

4 years agoRollup merge of #64896 - XAMPPRocky:remove-grammar, r=Centril
Mazdak Farrokhzad [Tue, 1 Oct 2019 07:55:33 +0000 (09:55 +0200)]
Rollup merge of #64896 - XAMPPRocky:remove-grammar, r=Centril

Remove legacy grammar

Revival of #50835 & #55545

On the #wg-grammar discord there was agreement that enough progress has been made to be able to remove the legacy grammar.

r? @Centril @qmx

cc @rust-lang/wg-grammar

4 years agoRollup merge of #64895 - davidtwco:issue-64130-async-error-definition, r=nikomatsakis
Mazdak Farrokhzad [Tue, 1 Oct 2019 07:55:31 +0000 (09:55 +0200)]
Rollup merge of #64895 - davidtwco:issue-64130-async-error-definition, r=nikomatsakis

async/await: improve not-send errors

cc #64130.

```
note: future does not implement `std::marker::Send` because this value is used across an await
  --> $DIR/issue-64130-non-send-future-diags.rs:15:5
   |
LL |     let g = x.lock().unwrap();
   |         - has type `std::sync::MutexGuard<'_, u32>`
LL |     baz().await;
   |     ^^^^^^^^^^^ await occurs here, with `g` maybe used later
LL | }
   | - `g` is later dropped here
```

r? @nikomatsakis

4 years agoRollup merge of #64887 - Centril:recover-trailing-vert, r=estebank
Mazdak Farrokhzad [Tue, 1 Oct 2019 07:55:29 +0000 (09:55 +0200)]
Rollup merge of #64887 - Centril:recover-trailing-vert, r=estebank

syntax: recover trailing `|` in or-patterns

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

For example (this also shows that we are sensitive to the typo `||`):

```
error: a trailing `|` is not allowed in an or-pattern
  --> $DIR/remove-leading-vert.rs:33:11
   |
LL |         A || => {}
   |         - ^^ help: remove the `||`
   |         |
   |         while parsing this or-pattern starting here
   |
   = note: alternatives in or-patterns are separated with `|`, not `||`
```

r? @estebank

4 years agoRollup merge of #63931 - petrochenkov:stabmac, r=Centril
Mazdak Farrokhzad [Tue, 1 Oct 2019 07:55:28 +0000 (09:55 +0200)]
Rollup merge of #63931 - petrochenkov:stabmac, r=Centril

Stabilize macros in some more positions

- Fn-like macros and attribute macros in `extern` blocks
- Fn-like procedural macros in type positions
- ~Attribute macros on inline modules~ (moved to https://github.com/rust-lang/rust/pull/64273)

Stabilization report: https://github.com/rust-lang/rust/pull/63931#issuecomment-526362396.

Closes https://github.com/rust-lang/rust/issues/49476
cc https://github.com/rust-lang/rust/issues/54727

4 years agoRollup merge of #63674 - petrochenkov:meta2, r=Centril
Mazdak Farrokhzad [Tue, 1 Oct 2019 07:55:26 +0000 (09:55 +0200)]
Rollup merge of #63674 - petrochenkov:meta2, r=Centril

syntax: Support modern attribute syntax in the `meta` matcher

Where "modern" means https://github.com/rust-lang/rust/pull/57367:
```
PATH
PATH `(` TOKEN_STREAM `)`
PATH `[` TOKEN_STREAM `]`
PATH `{` TOKEN_STREAM `}`
```

Unfortunately, `meta` wasn't future-proofed using the `FOLLOW` token set like other matchers (https://github.com/rust-lang/rust/issues/34011), so code like `$meta:meta {` or `$meta:meta [` may break, and we need a crater run to find out how often this happens in practice.

Closes https://github.com/rust-lang/rust/issues/49629 (by fully supporting `meta` rather than removing it.)

4 years agoRemove the `$lt_tcx` parameter from `direct_interners!`.
Nicholas Nethercote [Tue, 1 Oct 2019 06:07:57 +0000 (16:07 +1000)]
Remove the `$lt_tcx` parameter from `direct_interners!`.

It's not necessary.

4 years agoInline and remove `intern_method!`.
Nicholas Nethercote [Tue, 1 Oct 2019 06:03:25 +0000 (16:03 +1000)]
Inline and remove `intern_method!`.

It's only used in two places, and the code is shorter and more readable
with it gone.

4 years agoreplace try_for_each with try_fold to generate less code
Andreas Jonson [Tue, 1 Oct 2019 05:56:18 +0000 (07:56 +0200)]
replace try_for_each with try_fold to generate less code

removes two functions to inline by combining the check functions and extra call to try_for_each

4 years agoRemove special treatment for `_intern_canonical_var_infos`.
Nicholas Nethercote [Tue, 1 Oct 2019 05:49:37 +0000 (15:49 +1000)]
Remove special treatment for `_intern_canonical_var_infos`.

This is a leftover from when there were global and thread-local arenas.

4 years agoReorder the slice interners.
Nicholas Nethercote [Tue, 1 Oct 2019 05:48:25 +0000 (15:48 +1000)]
Reorder the slice interners.

So the order matches the order in `CtxtInterners`.

4 years agoAdd lower bound doctests for `saturating_{add,sub}` signed ints
Lzu Tao [Tue, 1 Oct 2019 05:46:50 +0000 (05:46 +0000)]
Add lower bound doctests for `saturating_{add,sub}` signed ints

4 years agosyntax: reformat passing of `FnHeader` to `parse_item_fn`.
Mazdak Farrokhzad [Tue, 1 Oct 2019 04:10:06 +0000 (06:10 +0200)]
syntax: reformat passing of `FnHeader` to `parse_item_fn`.

4 years agosyntax: de-closure-ify `check_or_expected`.
Mazdak Farrokhzad [Tue, 1 Oct 2019 03:55:28 +0000 (05:55 +0200)]
syntax: de-closure-ify `check_or_expected`.

4 years agosyntax: merge things back into `parse_visibility`.
Mazdak Farrokhzad [Tue, 1 Oct 2019 03:53:23 +0000 (05:53 +0200)]
syntax: merge things back into `parse_visibility`.

4 years agosyntax: put helpers of `parse_self_param` in the method.
Mazdak Farrokhzad [Tue, 1 Oct 2019 03:45:41 +0000 (05:45 +0200)]
syntax: put helpers of `parse_self_param` in the method.

4 years agosyntax: document some methods.
Mazdak Farrokhzad [Tue, 1 Oct 2019 03:13:42 +0000 (05:13 +0200)]
syntax: document some methods.

4 years agoAuto merge of #64932 - tmandry:rollup-7t8x1nz, r=tmandry
bors [Tue, 1 Oct 2019 02:31:48 +0000 (02:31 +0000)]
Auto merge of #64932 - tmandry:rollup-7t8x1nz, r=tmandry

Rollup of 9 pull requests

Successful merges:

 - #64377 (Add long error explanation for E0493)
 - #64786 (Use https for curl when building for linux)
 - #64828 (Graphviz debug output for generic dataflow analysis)
 - #64838 (Add long error explanation for E0550)
 - #64891 (Fix `vec![x; n]` with null raw fat pointer zeroing the pointer metadata)
 - #64893 (Zero-initialize `vec![None; n]` for `Option<&T>`, `Option<&mut T>` and `Option<Box<T>>`)
 - #64911 (Fixed a misleading documentation issue #64844)
 - #64921 (Add test for issue-64662)
 - #64923 (Add missing links for mem::needs_drop)

Failed merges:

 - #64918 (Add long error explanation for E0551)

r? @ghost

4 years agoDeduplicate closure type errors
Esteban Küber [Tue, 1 Oct 2019 00:48:22 +0000 (17:48 -0700)]
Deduplicate closure type errors

Closure typing obligations flow in both direcitons to properly infer
types. Because of this, we will get 2 type errors whenever there's
an unfulfilled obligation. To avoid this, we deduplicate them in the
`InferCtxt`.

4 years agoFix borrowck errors
AnthonyMikh [Tue, 1 Oct 2019 00:22:07 +0000 (03:22 +0300)]
Fix borrowck errors

Reborrowing doesn't work for loops

4 years agoHint type for `.sum()`
AnthonyMikh [Tue, 1 Oct 2019 00:04:01 +0000 (03:04 +0300)]
Hint type for `.sum()`

4 years agoAscript type explicitly
AnthonyMikh [Mon, 30 Sep 2019 23:53:44 +0000 (02:53 +0300)]
Ascript type explicitly

4 years agoFix errors
AnthonyMikh [Mon, 30 Sep 2019 23:38:35 +0000 (02:38 +0300)]
Fix errors

4 years ago(fmt) remove trailing whitespaces
AnthonyMikh [Mon, 30 Sep 2019 23:30:52 +0000 (02:30 +0300)]
(fmt) remove trailing whitespaces

4 years agoasync/await: improve obligation errors
David Wood [Wed, 25 Sep 2019 12:58:41 +0000 (13:58 +0100)]
async/await: improve obligation errors

This commit improves obligation errors for async/await:

```
note: future does not implement `std::marker::Send` because this value is used across an
      await
  --> $DIR/issue-64130-non-send-future-diags.rs:15:5
   |
LL |     let g = x.lock().unwrap();
   |         - has type `std::sync::MutexGuard<'_, u32>`
LL |     baz().await;
   |     ^^^^^^^^^^^ await occurs here, with `g` maybe used later
LL | }
   | - `g` is later dropped here
```

Signed-off-by: David Wood <david@davidtw.co>
4 years agoFixes #64919. Suggest fix based on operator precendence.
Sam Radhakrishnan [Mon, 30 Sep 2019 21:45:31 +0000 (17:45 -0400)]
Fixes #64919. Suggest fix based on operator precendence.

4 years agoUse pattern matching instead of indexing tuples
AnthonyMikh [Mon, 30 Sep 2019 22:12:36 +0000 (01:12 +0300)]
Use pattern matching instead of indexing tuples

4 years agoreview comments
Esteban Küber [Sat, 21 Sep 2019 16:53:25 +0000 (09:53 -0700)]
review comments

4 years agoAvoid ICE on return outside of fn with literal array
Esteban Küber [Sat, 21 Sep 2019 02:31:51 +0000 (19:31 -0700)]
Avoid ICE on return outside of fn with literal array

Do not ICE when encountering `enum E { A = return [0][0] }`.

4 years agoAddress review comments
Vadim Petrochenkov [Mon, 30 Sep 2019 21:58:30 +0000 (00:58 +0300)]
Address review comments

4 years agoSimplify a conditional in `collect_annotations`
AnthonyMikh [Mon, 30 Sep 2019 22:08:51 +0000 (01:08 +0300)]
Simplify a conditional in `collect_annotations`

Also avoid excessive cloning

4 years agoRollup merge of #64923 - lzutao:improve-doc-needs_drop, r=jonas-schievink
Tyler Mandry [Mon, 30 Sep 2019 21:38:32 +0000 (14:38 -0700)]
Rollup merge of #64923 - lzutao:improve-doc-needs_drop, r=jonas-schievink

Add missing links for mem::needs_drop

r? @jonas-schievink

4 years agoRollup merge of #64921 - JohnTitor:add-test-enum, r=varkor
Tyler Mandry [Mon, 30 Sep 2019 21:38:31 +0000 (14:38 -0700)]
Rollup merge of #64921 - JohnTitor:add-test-enum, r=varkor

Add test for issue-64662

Closes #64662
r? @varkor

4 years agoRollup merge of #64911 - hman523:64844, r=Dylan-DPC
Tyler Mandry [Mon, 30 Sep 2019 21:38:28 +0000 (14:38 -0700)]
Rollup merge of #64911 - hman523:64844, r=Dylan-DPC

Fixed a misleading documentation issue #64844

Made the suggested change from @steveklabnik on issue #64844

4 years agoRollup merge of #64893 - SimonSapin:vec-of-option-box, r=sfackler
Tyler Mandry [Mon, 30 Sep 2019 21:38:27 +0000 (14:38 -0700)]
Rollup merge of #64893 - SimonSapin:vec-of-option-box, r=sfackler

Zero-initialize `vec![None; n]` for `Option<&T>`, `Option<&mut T>` and `Option<Box<T>>`

4 years agoRollup merge of #64891 - SimonSapin:vec-of-fat-raw-ptr, r=sfackler
Tyler Mandry [Mon, 30 Sep 2019 21:38:25 +0000 (14:38 -0700)]
Rollup merge of #64891 - SimonSapin:vec-of-fat-raw-ptr, r=sfackler

Fix `vec![x; n]` with null raw fat pointer zeroing the pointer metadata

https://github.com/rust-lang/rust/pull/49496 introduced specialization based on:

```rust
unsafe impl<T: ?Sized> IsZero for *mut T {
    fn is_zero(&self) -> bool {
        (*self).is_null()
    }
}
```

… to call `RawVec::with_capacity_zeroed` for creating `Vec<*mut T>`, which is incorrect for fat pointers since `<*mut T>::is_null` only looks at the data component. That is, a fat pointer can be “null” without being made entirely of zero bits.

This commit fixes it by removing the `?Sized` bound on this impl (and the corresponding `*const T` one). This regresses `vec![x; n]` with `x` a null raw slice of length zero, but that seems exceptionally uncommon. (Vtable pointers are never null, so raw trait objects would not take the fast path anyway.)

An alternative to keep the `?Sized` bound (or even generalize to `impl<U: Copy> IsZero for U`) would be to cast to `&[u8]` of length `size_of::<U>()`, but the optimizer seems not to be able to propagate alignment information and sticks with comparing one byte at a time:

https://rust.godbolt.org/z/xQFkwL

----

Without the library change, the new test fails as follows:

```rust
---- vec::vec_macro_repeating_null_raw_fat_pointer stdout ----
[src/liballoc/tests/vec.rs:1301] ptr_metadata(raw_dyn) = 0x00005596ef95f9a8
[src/liballoc/tests/vec.rs:1306] ptr_metadata(vec[0]) = 0x0000000000000000
thread 'vec::vec_macro_repeating_null_raw_fat_pointer' panicked at 'assertion failed: vec[0] == null_raw_dyn', src/liballoc/tests/vec.rs:1307:5
```

4 years agoRollup merge of #64838 - GuillaumeGomez:long-err-explanation-e0550, r=oli-obk
Tyler Mandry [Mon, 30 Sep 2019 21:38:24 +0000 (14:38 -0700)]
Rollup merge of #64838 - GuillaumeGomez:long-err-explanation-e0550, r=oli-obk

Add long error explanation for E0550

Part of #61137