]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAuto merge of #62704 - Mark-Simulacrum:rollup-oi94s2j, r=Mark-Simulacrum
bors [Tue, 16 Jul 2019 05:03:20 +0000 (05:03 +0000)]
Auto merge of #62704 - Mark-Simulacrum:rollup-oi94s2j, r=Mark-Simulacrum

Rollup of 14 pull requests

Successful merges:

 - #62103 (Add debug assertions to write_bytes and copy*)
 - #62405 (Remove never_type feature requirement for exhaustive patterns)
 - #62491 (Fix Pin urls in Option documentation)
 - #62533 (Add missing links for CannotReallocInPlace type)
 - #62634 (Less unsafe in the array example of MaybeUninit docs)
 - #62639 (Make VaListImpl<'f> invariant over the 'f lifetime)
 - #62646 (Tweak wording in feature gate errors)
 - #62662 (add spaces in front of trait requirements in libcore/cell.rs)
 - #62668 (Fix #62660)
 - #62673 (miri validation: better error messages for dangling references)
 - #62680 (Actually call `visit_block_entry` in `DataflowResultsConsumer`)
 - #62685 (Add info about undefined behavior to as_ref suggestions)
 - #62689 (Fix typo in RawWaker::new documentation)
 - #62698 (SGX target: don't pretend to be GNU/Linux to LLVM)

Failed merges:

r? @ghost

4 years agoRollup merge of #62698 - jethrogb:jb/sgx-llvm-target, r=alexcrichton
Mark Rousskov [Mon, 15 Jul 2019 23:55:16 +0000 (19:55 -0400)]
Rollup merge of #62698 - jethrogb:jb/sgx-llvm-target, r=alexcrichton

SGX target: don't pretend to be GNU/Linux to LLVM

See https://github.com/rust-lang/rust/pull/62592 & https://github.com/rust-lang-nursery/compiler-builtins/issues/303

r? @alexcrichton

4 years agoRollup merge of #62689 - 0e4ef622:patch-1, r=Xanewok
Mark Rousskov [Mon, 15 Jul 2019 23:55:15 +0000 (19:55 -0400)]
Rollup merge of #62689 - 0e4ef622:patch-1, r=Xanewok

Fix typo in RawWaker::new documentation

poiner -> pointer

4 years agoRollup merge of #62685 - nathanwhit:as_ref_suggest_fix, r=estebank
Mark Rousskov [Mon, 15 Jul 2019 23:55:14 +0000 (19:55 -0400)]
Rollup merge of #62685 - nathanwhit:as_ref_suggest_fix, r=estebank

Add info about undefined behavior to as_ref suggestions

Fixes #61786. A very small fix, but suggestions on wording/content are welcomed.

4 years agoRollup merge of #62680 - ecstatic-morse:fix-dataflow-results-consumer, r=matthewjasper
Mark Rousskov [Mon, 15 Jul 2019 23:55:12 +0000 (19:55 -0400)]
Rollup merge of #62680 - ecstatic-morse:fix-dataflow-results-consumer, r=matthewjasper

Actually call `visit_block_entry` in `DataflowResultsConsumer`

This fixes a trivial bug in `DataflowResultsConsumer`: `visit_block_entry` is never called when visiting dataflow results.

A previous version of #62547 used this API and included this fix, but it has since switched to `DataflowResultsCursor` making this commit irrelevant.

4 years agoRollup merge of #62673 - RalfJung:validity-msg, r=oli-obk
Mark Rousskov [Mon, 15 Jul 2019 23:55:11 +0000 (19:55 -0400)]
Rollup merge of #62673 - RalfJung:validity-msg, r=oli-obk

miri validation: better error messages for dangling references

Cc @oli-obk

4 years agoRollup merge of #62668 - goodmanjonathan:fix-62660, r=estebank
Mark Rousskov [Mon, 15 Jul 2019 23:55:10 +0000 (19:55 -0400)]
Rollup merge of #62668 - goodmanjonathan:fix-62660, r=estebank

Fix #62660

If the explicitly given type of a `self` parameter fails to parse correctly, we need to propagate the error rather than dropping it and causing an ICE.

Fixes #62660.

4 years agoRollup merge of #62662 - DutchGhost:fix_space, r=sfackler
Mark Rousskov [Mon, 15 Jul 2019 23:55:08 +0000 (19:55 -0400)]
Rollup merge of #62662 - DutchGhost:fix_space, r=sfackler

add spaces in front of trait requirements in libcore/cell.rs

Adds spaces before trait requirements in `libcore/cell.rs`.

4 years agoRollup merge of #62646 - estebank:wording, r=petrochenkov
Mark Rousskov [Mon, 15 Jul 2019 23:55:07 +0000 (19:55 -0400)]
Rollup merge of #62646 - estebank:wording, r=petrochenkov

Tweak wording in feature gate errors

4 years agoRollup merge of #62639 - immunant:invariant_valistimpl, r=eddyb
Mark Rousskov [Mon, 15 Jul 2019 23:55:06 +0000 (19:55 -0400)]
Rollup merge of #62639 - immunant:invariant_valistimpl, r=eddyb

Make VaListImpl<'f> invariant over the 'f lifetime

After doing some research on variance and going back to look at `VaList` and `VaListImpl`, I realized that `VaList<'a, 'f>` is invariant over the `'f` lifetime (and covariant over `'a`), but `VaListImpl<'f>` isn't invariant but probably should be. This patch makes `VaListImpl<'f>` invariant over `'f`.

r? @eddyb
cc @dlrobertson

4 years agoRollup merge of #62634 - llogiq:uninit-array-docs, r=RalfJung
Mark Rousskov [Mon, 15 Jul 2019 23:55:04 +0000 (19:55 -0400)]
Rollup merge of #62634 - llogiq:uninit-array-docs, r=RalfJung

Less unsafe in the array example of MaybeUninit docs

I believe this is an acceptable way to initialize elements of `[MaybeUninit<T>; _]` arrays. Miri agrees. Conceptually, we are working at the array level, above the `MaybeUninit`, and as we are replacing it wholesale, this should pose no problem to soundness. And the code is easier to read.

r? @RalfJung

4 years agoRollup merge of #62533 - GuillaumeGomez:missing-urls-CannotReallocInPlace, r=QuietMis...
Mark Rousskov [Mon, 15 Jul 2019 23:55:03 +0000 (19:55 -0400)]
Rollup merge of #62533 - GuillaumeGomez:missing-urls-CannotReallocInPlace, r=QuietMisdreavus

Add missing links for CannotReallocInPlace type

r? @QuietMisdreavus

4 years agoRollup merge of #62491 - GuillaumeGomez:fix-pin-urls-for-option, r=QuietMisdreavus
Mark Rousskov [Mon, 15 Jul 2019 23:55:01 +0000 (19:55 -0400)]
Rollup merge of #62491 - GuillaumeGomez:fix-pin-urls-for-option, r=QuietMisdreavus

Fix Pin urls in Option documentation

Fixes the following situation:

![Screenshot from 2019-07-08 13-24-59](https://user-images.githubusercontent.com/3050060/60806822-55dfdc00-a184-11e9-9ee3-279e82fc92bd.png)

r? @QuietMisdreavus

4 years agoRollup merge of #62405 - hellow554:patch-1, r=varkor
Mark Rousskov [Mon, 15 Jul 2019 23:55:00 +0000 (19:55 -0400)]
Rollup merge of #62405 - hellow554:patch-1, r=varkor

Remove never_type feature requirement for exhaustive patterns

I **think** this resolves #51221
At least for me, it doesn't ICE anymore and all tests are still passing, so LGTM

4 years agoRollup merge of #62103 - RalfJung:debug-assert, r=alexcrichton
Mark Rousskov [Mon, 15 Jul 2019 23:54:58 +0000 (19:54 -0400)]
Rollup merge of #62103 - RalfJung:debug-assert, r=alexcrichton

Add debug assertions to write_bytes and copy*

Looks like @nitnelave  went MIA in https://github.com/rust-lang/rust/pull/58783, so I am re-submitting their PR, tweaked just a bit. I took care to preserve commit authorship.

Cc https://github.com/rust-lang/rust/issues/53871

4 years agoSGX target: don't pretend to be GNU/Linux to LLVM
Jethro Beekman [Mon, 15 Jul 2019 18:23:39 +0000 (11:23 -0700)]
SGX target: don't pretend to be GNU/Linux to LLVM

4 years agoAuto merge of #62687 - gnzlbg:stdarch, r=alexcrichton
bors [Mon, 15 Jul 2019 16:00:48 +0000 (16:00 +0000)]
Auto merge of #62687 - gnzlbg:stdarch, r=alexcrichton

Update stdsimd to stdarch

The stdsimd repository no longer lives in `rust-lang-nursery/stdsimd` but now lives in `rust-lang/stdarch` instead. This PR updates the stdsimd submodule to the stdarch master branch.

4 years agoFix typo in RawWaker::new documentation
0e4ef622 [Mon, 15 Jul 2019 15:03:53 +0000 (10:03 -0500)]
Fix typo in RawWaker::new documentation

poiner -> pointer

4 years agobump compiler_builtins
Ralf Jung [Mon, 15 Jul 2019 14:58:07 +0000 (16:58 +0200)]
bump compiler_builtins

4 years agoignore some codegen tests in debug mode
Ralf Jung [Tue, 25 Jun 2019 07:40:50 +0000 (09:40 +0200)]
ignore some codegen tests in debug mode

4 years agoAdd debug assertions to write_bytes and copy*
Valentin Tolmer [Wed, 27 Feb 2019 16:10:59 +0000 (17:10 +0100)]
Add debug assertions to write_bytes and copy*

4 years agoUpdate stdarch
gnzlbg [Mon, 15 Jul 2019 14:29:12 +0000 (16:29 +0200)]
Update stdarch

4 years agoAuto merge of #62667 - petrochenkov:printattr2, r=Mark-Simulacrum
bors [Mon, 15 Jul 2019 12:29:53 +0000 (12:29 +0000)]
Auto merge of #62667 - petrochenkov:printattr2, r=Mark-Simulacrum

pprust: Improve pretty-printing of delimited token groups

The commit "Do not convert attributes into `MetaItem`s for printing" fixes https://github.com/rust-lang/rust/issues/62628.

Other commits fix regressions from abandoning `MetaItem`s, and make formatting for attributes, macro calls, macro definitions and other delimited token groups better and more consistent.

r? @Mark-Simulacrum

4 years agoAdd rtm and f16c features to libcore
gnzlbg [Mon, 15 Jul 2019 11:57:34 +0000 (13:57 +0200)]
Add rtm and f16c features to libcore

4 years agoUpdate the stdarch submodule
gnzlbg [Mon, 15 Jul 2019 11:53:44 +0000 (13:53 +0200)]
Update the stdarch submodule

4 years agopprust: Support `macro` macros
Vadim Petrochenkov [Sun, 14 Jul 2019 13:09:39 +0000 (16:09 +0300)]
pprust: Support `macro` macros

4 years agopprust: Fix formatting regressions from the previous commits
Vadim Petrochenkov [Sat, 13 Jul 2019 21:11:59 +0000 (00:11 +0300)]
pprust: Fix formatting regressions from the previous commits

Fix some remaining cases of bad formatting
Update some failing tests

4 years agopprust: Do not convert attributes into `MetaItem`s for printing
Vadim Petrochenkov [Sat, 13 Jul 2019 20:24:58 +0000 (23:24 +0300)]
pprust: Do not convert attributes into `MetaItem`s for printing

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

4 years agopprust: Remove the box from `print_tts`
Vadim Petrochenkov [Sat, 13 Jul 2019 20:11:04 +0000 (23:11 +0300)]
pprust: Remove the box from `print_tts`

Wrap the whole attribute into a box instead

4 years agopprust: Use `print_mac_common` for delimited token groups
Vadim Petrochenkov [Sat, 13 Jul 2019 20:08:29 +0000 (23:08 +0300)]
pprust: Use `print_mac_common` for delimited token groups

4 years agopprust: Use `print_mac_common` for attributes
Vadim Petrochenkov [Sat, 13 Jul 2019 18:01:04 +0000 (21:01 +0300)]
pprust: Use `print_mac_common` for attributes

4 years agopprust: Use `print_mac_common` for `macro_rules` definitions
Vadim Petrochenkov [Sat, 13 Jul 2019 17:35:46 +0000 (20:35 +0300)]
pprust: Use `print_mac_common` for `macro_rules` definitions

4 years agopprust: Move some methods to the `PrintState` trait
Vadim Petrochenkov [Sat, 13 Jul 2019 16:11:07 +0000 (19:11 +0300)]
pprust: Move some methods to the `PrintState` trait

So that path and macro argument printing code can be shared

4 years agoAuto merge of #62629 - matthewjasper:cleanup-borrowck-errors, r=petrochenkov
bors [Mon, 15 Jul 2019 09:05:18 +0000 (09:05 +0000)]
Auto merge of #62629 - matthewjasper:cleanup-borrowck-errors, r=petrochenkov

Cleanup borrowck errors

This removes some of the unnecessary code that allowed sharing error reporting between two borrow checkers.

closes #59193

4 years agoAuto merge of #62674 - RalfJung:miri-abi, r=eddyb
bors [Mon, 15 Jul 2019 05:40:41 +0000 (05:40 +0000)]
Auto merge of #62674 - RalfJung:miri-abi, r=eddyb

RustIntrinsic and PlatformIntrinsic are also the same ABI as Rust

r? @eddyb

4 years agoAdd info about undefined behavior to as_ref suggestions
nathanwhit [Sun, 14 Jul 2019 19:05:25 +0000 (15:05 -0400)]
Add info about undefined behavior to as_ref suggestions

4 years agoAuto merge of #62670 - estebank:extern-fn-with-body, r=petrochenkov
bors [Mon, 15 Jul 2019 02:13:55 +0000 (02:13 +0000)]
Auto merge of #62670 - estebank:extern-fn-with-body, r=petrochenkov

Detect `fn` with a body in an `extern` block

Fix #62109.

4 years agoMake VaListImpl<'f> invariant over the 'f lifetime
Andrei Homescu [Fri, 12 Jul 2019 22:32:46 +0000 (15:32 -0700)]
Make VaListImpl<'f> invariant over the 'f lifetime

4 years agoAuto merge of #62643 - estebank:parse-recovery-type-errs, r=petrochenkov
bors [Sun, 14 Jul 2019 22:51:05 +0000 (22:51 +0000)]
Auto merge of #62643 - estebank:parse-recovery-type-errs, r=petrochenkov

Do not emit type errors after parse error in last statement of block

When recovering from a parse error inside a block, do not emit type
errors generating on that block's recovered return expression.

Fix #57383.

4 years agoActually call `visit_block_entry` in `DataflowResultsConsumer`
Dylan MacKenzie [Tue, 9 Jul 2019 21:28:02 +0000 (14:28 -0700)]
Actually call `visit_block_entry` in `DataflowResultsConsumer`

Previously, this callback was never actually called.

4 years ago`pub(crate)` -> `crate`
Matthew Jasper [Sat, 13 Jul 2019 08:37:19 +0000 (09:37 +0100)]
`pub(crate)` -> `crate`

The borrow checker code is already using `crate` extensively, so prefer
being consistent with it.

4 years agoMove suggest_ref_mut into rustc_mir::borrow_check
Matthew Jasper [Fri, 12 Jul 2019 19:42:21 +0000 (20:42 +0100)]
Move suggest_ref_mut into rustc_mir::borrow_check

4 years agoRemove BorrowckErrors trait
Matthew Jasper [Fri, 12 Jul 2019 19:37:06 +0000 (20:37 +0100)]
Remove BorrowckErrors trait

Its methods are now inherent methods of `MirBorrowckCtxt`

4 years agoRemove rustc_mir::borrowck_errors::Origin
Matthew Jasper [Fri, 12 Jul 2019 19:05:33 +0000 (20:05 +0100)]
Remove rustc_mir::borrowck_errors::Origin

4 years agoRemove unused BorrowckErrors methods
Matthew Jasper [Fri, 12 Jul 2019 18:59:25 +0000 (19:59 +0100)]
Remove unused BorrowckErrors methods

4 years agoAuto merge of #62638 - estebank:issue-62554, r=petrochenkov
bors [Sun, 14 Jul 2019 17:29:17 +0000 (17:29 +0000)]
Auto merge of #62638 - estebank:issue-62554, r=petrochenkov

Use snippet instead of pprinting statement

Fix #62554.

4 years agoAuto merge of #62610 - Stargateur:fix-miri-error-cstring-into_inner, r=RalfJung
bors [Sun, 14 Jul 2019 13:52:40 +0000 (13:52 +0000)]
Auto merge of #62610 - Stargateur:fix-miri-error-cstring-into_inner, r=RalfJung

Fix miri error in into_inner() of CString

Fix #62553

I choice to not transmute because I think it's more unsafe and in case the structure change this code should always work.

r? @RalfJung

4 years agoLess unsafe in the array example of MaybeUninit docs
Andre Bogus [Fri, 12 Jul 2019 20:13:48 +0000 (22:13 +0200)]
Less unsafe in the array example of MaybeUninit docs

4 years agoremove outdated comment
Ralf Jung [Sun, 14 Jul 2019 10:23:52 +0000 (12:23 +0200)]
remove outdated comment

4 years agoAuto merge of #62464 - GuillaumeGomez:add-missing-urls-osstr, r=QuietMisdreavus
bors [Sun, 14 Jul 2019 10:23:05 +0000 (10:23 +0000)]
Auto merge of #62464 - GuillaumeGomez:add-missing-urls-osstr, r=QuietMisdreavus

Add missing urls for osstr

r? @QuietMisdreavus

4 years agoRustIntrinsic and PlatformIntrinsic are also the same ABI as Rust
Ralf Jung [Sun, 14 Jul 2019 09:58:12 +0000 (11:58 +0200)]
RustIntrinsic and PlatformIntrinsic are also the same ABI as Rust

4 years agomiri validation: better error messages for dangling references
Ralf Jung [Sun, 14 Jul 2019 09:39:10 +0000 (11:39 +0200)]
miri validation: better error messages for dangling references

4 years agoreview comment
Esteban Küber [Sun, 14 Jul 2019 05:25:23 +0000 (22:25 -0700)]
review comment

4 years agoAuto merge of #62331 - wesleywiser:fix_early_return_leak, r=matthewjasper
bors [Sun, 14 Jul 2019 05:25:08 +0000 (05:25 +0000)]
Auto merge of #62331 - wesleywiser:fix_early_return_leak, r=matthewjasper

Fix leak when early returning out of `box` syntax

Fixes #62289

r? @matthewjasper

4 years agoDetect `fn` with a body in an `extern` block
Esteban Küber [Sun, 14 Jul 2019 04:15:21 +0000 (21:15 -0700)]
Detect `fn` with a body in an `extern` block

4 years agoDon't drop DiagnosticBuilder if parsing fails
Jonathan Goodman [Sun, 14 Jul 2019 00:34:06 +0000 (19:34 -0500)]
Don't drop DiagnosticBuilder if parsing fails

If the explicitly given type of a `self` parameter fails to parse correctly,
we need to propagate the error rather than dropping it and causing an ICE.

Fixes #62660.

4 years agoAuto merge of #62560 - pietroalbini:tools-builders-on-prs, r=alexcrichton
bors [Sun, 14 Jul 2019 00:20:54 +0000 (00:20 +0000)]
Auto merge of #62560 - pietroalbini:tools-builders-on-prs, r=alexcrichton

ci: add a pr builder to test tools when submodules are updated

This PR adds the x86_64-gnu-tools builders to PRs where submodules are updated.

Since it's not possible to *start* the builder only when submodule changes are detected, I opted into adding a "decider" task at the start of the job which sets the `SKIP_JOB` environment variable when submodules are not updated, and I gated the most time-consuming tasks (the actual build and artifacts upload) on the variable not being there. All of this is conditionally included in the `steps/run.yml` only when a template parameter is present, so it should only affect that builder on PRs.

The cost for this should be a dummy builder running for 2/3 minutes for each PR, and we should be able to handle it.

Fixes https://github.com/rust-lang/rust/issues/61837
r? @alexcrichton

4 years agoAuto merge of #62584 - eddyb:circular-math-is-hard, r=pnkfelix
bors [Sat, 13 Jul 2019 20:45:40 +0000 (20:45 +0000)]
Auto merge of #62584 - eddyb:circular-math-is-hard, r=pnkfelix

 rustc_codegen_ssa: fix range check in codegen_get_discr.

Fixes #61696, see https://github.com/rust-lang/rust/issues/61696#issuecomment-505473018 for more details.

In short, I had wanted to use `x - a <= b - a` to check whether `x` is in `a..=b` (as it's 1 comparison instead of 2 *and* `b - a` is guaranteed to fit in the same data type, while `b` itself might not), but I ended up with `x - a + c <= b - a + c` instead, because `x - a + c` was the final value needed.

That latter comparison is equivalent to checking that `x` is in `(a - c)..=b`, i.e. it also includes `(a - c)..a`, not just `a..=b`, so if `c` is not `0`, it will cause false positives.

This presented itself as the non-niche ("dataful") variant sometimes being treated like a niche variant, in the presence of uninhabited variants (which made `c`, aka the index of the first niche variant, arbitrarily large).

r? @nagisa, @rkruppe or @oli-obk

4 years agoreview comments
Esteban Küber [Sat, 13 Jul 2019 20:37:31 +0000 (13:37 -0700)]
review comments

4 years agoTweak wording in feature gate errors
Esteban Küber [Sat, 13 Jul 2019 02:33:51 +0000 (19:33 -0700)]
Tweak wording in feature gate errors

4 years agoAuto merge of #62659 - Centril:rollup-90oz643, r=Centril
bors [Sat, 13 Jul 2019 17:11:36 +0000 (17:11 +0000)]
Auto merge of #62659 - Centril:rollup-90oz643, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #62577 (Add an AtomicCell abstraction)
 - #62585 (Make struct_tail normalize when possible)
 - #62604 (Handle errors during error recovery gracefully)
 - #62636 (rustbuild: Improve assert about building tools once)
 - #62651 (Make some rustc macros more hygienic)

Failed merges:

r? @ghost

4 years agoadd spaces in front of trait requirements
Dodo [Sat, 13 Jul 2019 15:15:16 +0000 (17:15 +0200)]
add spaces in front of trait requirements

4 years agoRollup merge of #62651 - matthewjasper:rustc-macro-hygiene, r=petrochenkov
Mazdak Farrokhzad [Sat, 13 Jul 2019 14:18:41 +0000 (16:18 +0200)]
Rollup merge of #62651 - matthewjasper:rustc-macro-hygiene, r=petrochenkov

Make some rustc macros more hygienic

4 years agoRollup merge of #62636 - alexcrichton:assert-build-cargo-once, r=Mark-Simulacrum
Mazdak Farrokhzad [Sat, 13 Jul 2019 14:18:40 +0000 (16:18 +0200)]
Rollup merge of #62636 - alexcrichton:assert-build-cargo-once, r=Mark-Simulacrum

rustbuild: Improve assert about building tools once

In developing #61557 I noticed that there were two parts of our tools
that were rebuilt twice on CI. One was rustfmt fixed in #61557, but
another was Cargo. The actual fix for Cargo's double compile was
rust-lang/cargo#7010 and took some time to propagate here. In an effort
to continue to assert that Cargo is itself not compiled twice, I updated
the assertion in rustbuild at the time of working on #61557 but couldn't
land it because the fix wouldn't be ready until the next bootstrap.

The next bootstrap is now here, so the fix can now land! This does not
change the behavior of rustbuild but it is intended to catch the
previous iteration of compiling cargo twice. The main update here was to
consider more files than those in `$target/release/deps` but also
consider those in `$target/release`. That's where, for example,
`libcargo.rlib` shows up and it's the file we learn about, and that's
what we want to deduplicate.

4 years agoRollup merge of #62604 - estebank:unemitted-err-ice, r=pnkfelix
Mazdak Farrokhzad [Sat, 13 Jul 2019 14:18:38 +0000 (16:18 +0200)]
Rollup merge of #62604 - estebank:unemitted-err-ice, r=pnkfelix

Handle errors during error recovery gracefully

Fix #62546.

4 years agoRollup merge of #62585 - pnkfelix:issue-60431-make-struct-tail-normalize-when-possibl...
Mazdak Farrokhzad [Sat, 13 Jul 2019 14:18:37 +0000 (16:18 +0200)]
Rollup merge of #62585 - pnkfelix:issue-60431-make-struct-tail-normalize-when-possible, r=eddyb

Make struct_tail normalize when possible

As noted in commit message: this replaces the existing methods to extract the struct tail(s) with new entry points that make the handling of normalization explicit.

Most of the places that call `struct_tail` are during codegen, post type-checking, and therefore they can get away with using `tcx.normalize_erasing_regions` (this is the entry point `struct_tail_erasing_lifetimes`)

For other cases that may arise, one can use the core method, which is parameterized over the normalization `Ty -> Ty` closure (`struct_tail_with_normalize`).

Or one can use the trivial entry point that does not normalization (`struct_tail_without_normalization`)

----

I spent a little while trying to make a test that exposed the bug via `impl Trait` rather than a projection, but I failed to find something that tripped up the current nightly `rustc`.
 * I have *not* spent any time trying to make tests that trip up the other places where `struct_tail` was previously being called. While I do think the task of making such tests could be worthwhile, I am simply running out of time. (Its also possible that the layout code is always the first point called, and thus it may be pointless to try to come up with such tests.)

I also spent a little time discussing with @eddyb where this code should live. They suggested moving `struct_tail` and its sibling `struct_lockstep_tails` to the `LayoutCx`.  But in the interest of time, I have left that refactoring (which may be questionable at this point) to a follow-up task.

----

Fix #60431

4 years agoRollup merge of #62577 - Zoxc:atomic-cell, r=matthewjasper
Mazdak Farrokhzad [Sat, 13 Jul 2019 14:18:35 +0000 (16:18 +0200)]
Rollup merge of #62577 - Zoxc:atomic-cell, r=matthewjasper

Add an AtomicCell abstraction

Split out from https://github.com/rust-lang/rust/pull/61923.

4 years agoAuto merge of #62468 - rust-lang:mutable-overloaded-operators, r=estebank
bors [Sat, 13 Jul 2019 13:44:40 +0000 (13:44 +0000)]
Auto merge of #62468 - rust-lang:mutable-overloaded-operators, r=estebank

Improve diagnostics for invalid mutation through overloaded operators

Closes #58864
Closes #52941
Closes #57839

4 years agoAuto merge of #60266 - albins:polonius-liveness, r=nikomatsakis
bors [Sat, 13 Jul 2019 10:15:40 +0000 (10:15 +0000)]
Auto merge of #60266 - albins:polonius-liveness, r=nikomatsakis

Fact generation for liveness calculations in Polonius

This PR tracks ongoing work to extend `rustc` with support for generating variable use, definition, and later also drop output for the Polonius solver, the whole of which is being tracked in [Polonius Issue #104](https://github.com/rust-lang/polonius/issues/104).

4 years agoMake `register_[long_]diagnostics` hygienic
Matthew Jasper [Sat, 13 Jul 2019 09:02:40 +0000 (10:02 +0100)]
Make `register_[long_]diagnostics` hygienic

4 years agoMake `newtype_index` hygienic and use allow_internal_unstable
Matthew Jasper [Sat, 13 Jul 2019 08:55:14 +0000 (09:55 +0100)]
Make `newtype_index` hygienic and use allow_internal_unstable

4 years agoFix miri error in into_inner() of CString
Antoine PLASKOWSKI [Fri, 12 Jul 2019 07:30:58 +0000 (09:30 +0200)]
Fix miri error in into_inner() of CString

4 years agoAuto merge of #61953 - Centril:shared-from-iter, r=RalfJung
bors [Sat, 13 Jul 2019 06:49:02 +0000 (06:49 +0000)]
Auto merge of #61953 - Centril:shared-from-iter, r=RalfJung

Add `impl<T> FromIterator<T> for Arc/Rc<[T]>`

Add implementations of `FromIterator<T> for Arc/Rc<[T]>` with symmetrical logic.

This also takes advantage of specialization in the case of iterators with known length (`TrustedLen`) to elide the final allocation/copying from a `Vec<T>` into `Rc<[T]>` because we can allocate the space for the `Rc<[T]>` directly when the size is known. This is the primary motivation and why this is to be preferred over `iter.collect::<Vec<_>>().into(): Rc<[T]>`.

Moreover, this PR does some refactoring in some places.

r? @RalfJung for the code
cc @alexcrichton from T-libs

4 years agoAuto merge of #62613 - lzutao:clippy-up, r=Manishearth
bors [Sat, 13 Jul 2019 03:12:20 +0000 (03:12 +0000)]
Auto merge of #62613 - lzutao:clippy-up, r=Manishearth

submodules: Update clippy from 316da7eb to b0290424

r? @Manishearth

4 years agoDo not emit type errors after parse error in last statement of block
Esteban Küber [Sat, 13 Jul 2019 01:37:57 +0000 (18:37 -0700)]
Do not emit type errors after parse error in last statement of block

When recovering from a parse error inside a block, do not emit type
errors generating on that block's recovered return expression.

Fix #57383.

4 years agoAuto merge of #62635 - Centril:rollup-potvfnk, r=Centril
bors [Fri, 12 Jul 2019 23:37:39 +0000 (23:37 +0000)]
Auto merge of #62635 - Centril:rollup-potvfnk, r=Centril

Rollup of 12 pull requests

Successful merges:

 - #61535 (Coherence test when a generic type param has a default value from an associated type)
 - #62274 (rustc_mir: follow FalseUnwind's real_target edge in qualify_consts.)
 - #62431 (Add messages to `Option`'s and `Result`'s `must_use` annotation for `is_*`)
 - #62453 (in which we suggest anonymizing single-use lifetimes in paths )
 - #62568 (Replace unsafe_destructor_blind_to_params with may_dangle)
 - #62578 (Add test for #49919)
 - #62595 (Document that the crate keyword refers to the project root)
 - #62599 (move mem::uninitialized deprecation back by 1 release, to 1.39)
 - #62605 (Emit dropped unemitted errors to aid in ICE debugging)
 - #62607 (Correctly break out of recovery loop)
 - #62608 (`async unsafe fn` tests)
 - #62623 (downgrade indirect_structural_match lint to allow)

Failed merges:

r? @ghost

4 years agoadd tests
Esteban Küber [Fri, 12 Jul 2019 21:31:10 +0000 (14:31 -0700)]
add tests

4 years agoUse snippet instead of pprinting statement
Esteban Küber [Fri, 12 Jul 2019 21:01:13 +0000 (14:01 -0700)]
Use snippet instead of pprinting statement

4 years agorustbuild: Improve assert about building tools once
Alex Crichton [Thu, 6 Jun 2019 14:56:07 +0000 (07:56 -0700)]
rustbuild: Improve assert about building tools once

In developing #61557 I noticed that there were two parts of our tools
that were rebuilt twice on CI. One was rustfmt fixed in #61557, but
another was Cargo. The actual fix for Cargo's double compile was
rust-lang/cargo#7010 and took some time to propagate here. In an effort
to continue to assert that Cargo is itself not compiled twice, I updated
the assertion in rustbuild at the time of working on #61557 but couldn't
land it because the fix wouldn't be ready until the next bootstrap.

The next bootstrap is now here, so the fix can now land! This does not
change the behavior of rustbuild but it is intended to catch the
previous iteration of compiling cargo twice. The main update here was to
consider more files than those in `$target/release/deps` but also
consider those in `$target/release`. That's where, for example,
`libcargo.rlib` shows up and it's the file we learn about, and that's
what we want to deduplicate.

4 years agorustfmt all the things!
Albin Stjerna [Fri, 12 Jul 2019 20:49:15 +0000 (22:49 +0200)]
rustfmt all the things!

4 years agopolonius: add generation of liveneness-related facts
Albin Stjerna [Fri, 12 Jul 2019 20:48:02 +0000 (22:48 +0200)]
polonius: add generation of liveneness-related facts

Notably contains an ugly hack to generate initialization information for
variables that will go away when we have that functionality in Polonius.

4 years agoRollup merge of #62623 - pnkfelix:issue-62614-downgrade-indirect-structural-match...
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:54 +0000 (22:46 +0200)]
Rollup merge of #62623 - pnkfelix:issue-62614-downgrade-indirect-structural-match-lint-to-allow, r=zackmdavis

downgrade indirect_structural_match lint to allow

This is a short-term band-aid for the regression aspect of #62614.

4 years agoRollup merge of #62608 - delan:async-unsafe-fn-tests, r=Centril
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:53 +0000 (22:46 +0200)]
Rollup merge of #62608 - delan:async-unsafe-fn-tests, r=Centril

`async unsafe fn` tests

- cc #62121

r? @Centril

4 years agoRollup merge of #62607 - estebank:this-mem-is-out-of-control, r=petrochenkov
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:52 +0000 (22:46 +0200)]
Rollup merge of #62607 - estebank:this-mem-is-out-of-control, r=petrochenkov

Correctly break out of recovery loop

Fix #61858.

4 years agoRollup merge of #62605 - estebank:emit-dropped-err, r=pnkfelix
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:50 +0000 (22:46 +0200)]
Rollup merge of #62605 - estebank:emit-dropped-err, r=pnkfelix

Emit dropped unemitted errors to aid in ICE debugging

4 years agoRollup merge of #62599 - RalfJung:uninit, r=cramertj
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:49 +0000 (22:46 +0200)]
Rollup merge of #62599 - RalfJung:uninit, r=cramertj

move mem::uninitialized deprecation back by 1 release, to 1.39

As per discussion at https://github.com/rust-lang/rust/issues/53491#issuecomment-509271182. Three releases also agrees with the precedent from `trim_left/right`. Three releases means that even nightly users (including rustc itself) get a full cycle from when the announcement is made in the stable release to when nightly starts to warn.

4 years agoRollup merge of #62595 - ngoldbaum:path-clarity-doc, r=Centril
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:47 +0000 (22:46 +0200)]
Rollup merge of #62595 - ngoldbaum:path-clarity-doc, r=Centril

Document that the crate keyword refers to the project root

:wave: this is my first rust contribution so I hope I'm doing everything correctly. Help very much appreciated if I'm not.

As far as I can tell this use of `crate` is only documented [in the edition guide for rust 2018](https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-clarity.html#the-crate-keyword-refers-to-the-current-crate). However it should probably be in the documentation for the `crate` keyword itself. This adds that documentation.

4 years agoRollup merge of #62578 - JohnTitor:add-test-for-49919, r=alexcrichton
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:46 +0000 (22:46 +0200)]
Rollup merge of #62578 - JohnTitor:add-test-for-49919, r=alexcrichton

Add test for #49919

Closes #49919

4 years agoRollup merge of #62568 - lzutao:replace_may_dangle, r=matthewjasper
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:44 +0000 (22:46 +0200)]
Rollup merge of #62568 - lzutao:replace_may_dangle, r=matthewjasper

Replace unsafe_destructor_blind_to_params with may_dangle

This PR will completely remove support for `#[unsafe_destructor_blind_to_params]` attribute,
which is deprecated in #38970 by `[may_dangle]` unsafe  attribute.

Closes #34761

4 years agoRollup merge of #62453 - zackmdavis:single_path, r=estebank
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:43 +0000 (22:46 +0200)]
Rollup merge of #62453 - zackmdavis:single_path, r=estebank

in which we suggest anonymizing single-use lifetimes in paths

Following @nikomatsakis's [October 2017 comment](https://github.com/rust-lang/rust/issues/44752#issuecomment-340885834).

![path_anon_suggest](https://user-images.githubusercontent.com/1076988/60761598-e2619180-a000-11e9-9144-1bdf8eb848e3.png)

r? @estebank
cc @eddyb (you were saying something about running single-use-lifetimes against the tree the other week?)

4 years agoRollup merge of #62431 - czipperz:add-messages-to-must-use-is_-methods, r=scottmcm
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:41 +0000 (22:46 +0200)]
Rollup merge of #62431 - czipperz:add-messages-to-must-use-is_-methods, r=scottmcm

Add messages to `Option`'s and `Result`'s `must_use` annotation for `is_*`

r? @RalfJung

4 years agoRollup merge of #62274 - eddyb:const-false-unwind, r=pnkfelix
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:40 +0000 (22:46 +0200)]
Rollup merge of #62274 - eddyb:const-false-unwind, r=pnkfelix

rustc_mir: follow FalseUnwind's real_target edge in qualify_consts.

As far as I can tell, this was accidentally omitted from #47802.
Fixes #62272.

r? @matthewjasper or @nikomatsakis

4 years agoRollup merge of #61535 - ohadravid:test-generic-with-default-assiociated-type-re...
Mazdak Farrokhzad [Fri, 12 Jul 2019 20:46:38 +0000 (22:46 +0200)]
Rollup merge of #61535 - ohadravid:test-generic-with-default-assiociated-type-re-rebalance-coherence, r=nikomatsakis

Coherence test when a generic type param has a default value from an associated type

A followup on #61400.
Before `re_rebalance_coherence`, this fails to compile (even though it should be accepted).
`re_rebalance_coherence` had no direct test for this, and I wanted to (a) make sure it doesn't regress in the future and (b) get it on record that this is actually the intended behavior.

4 years agoUpgrade Polonius
Albin Stjerna [Fri, 12 Jul 2019 20:41:00 +0000 (22:41 +0200)]
Upgrade Polonius

4 years agoadd test case
Esteban Küber [Fri, 12 Jul 2019 18:13:03 +0000 (11:13 -0700)]
add test case

4 years agorustc_codegen_ssa: fix range check in codegen_get_discr.
Eduard-Mihai Burtescu [Thu, 4 Jul 2019 08:18:06 +0000 (11:18 +0300)]
rustc_codegen_ssa: fix range check in codegen_get_discr.

4 years agoChange `indirect_structural_match` lint to allow-by-default.
Felix S. Klock II [Fri, 12 Jul 2019 13:32:12 +0000 (15:32 +0200)]
Change `indirect_structural_match` lint to allow-by-default.

This is a way to address the regression aspect of rust-lang/rust#62614 in the
short term without actually fixing the bug. (My thinking is that the bug that
this lint detects has gone undetected for this long, it can wait a bit longer
until I or someone else has a chance to put in a proper fix that accounts for
rust-lang/rust#62614.)

4 years agoTurn `indirect_structural_match` lint on explicitly in ui tests.
Felix S. Klock II [Fri, 12 Jul 2019 13:27:21 +0000 (15:27 +0200)]
Turn `indirect_structural_match` lint on explicitly in ui tests.

4 years agoAuto merge of #61462 - GuillaumeGomez:fix-local-storage, r=Manishearth
bors [Fri, 12 Jul 2019 12:04:25 +0000 (12:04 +0000)]
Auto merge of #61462 - GuillaumeGomez:fix-local-storage, r=Manishearth

[rustdoc] Fix storage usage when disabled

Fixes #61239.

@starblue: Can you give a try to this change please? I tried on chrome and firefox and both worked so if you're using another web browser, that might be useful. :)

r? @Manishearth

4 years agoUpdate docs to reflect review feedback.
Felix S. Klock II [Fri, 12 Jul 2019 09:34:23 +0000 (11:34 +0200)]
Update docs to reflect review feedback.