]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAuto merge of #69636 - RalfJung:miri, r=nikomatsakis
bors [Wed, 4 Mar 2020 10:44:55 +0000 (10:44 +0000)]
Auto merge of #69636 - RalfJung:miri, r=nikomatsakis

update miri

Let's make that toolstate green again. :D

This bumps serde in the lockfile, so r? @oli-obk

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

4 years agoupdate miri
Ralf Jung [Wed, 4 Mar 2020 10:03:08 +0000 (11:03 +0100)]
update miri

4 years agopoint cargo-miri to the right xargo binary
Ralf Jung [Mon, 2 Mar 2020 21:43:31 +0000 (22:43 +0100)]
point cargo-miri to the right xargo binary

4 years agoAuto merge of #68952 - faern:stabilize-assoc-int-consts, r=dtolnay
bors [Wed, 4 Mar 2020 07:29:32 +0000 (07:29 +0000)]
Auto merge of #68952 - faern:stabilize-assoc-int-consts, r=dtolnay

Stabilize assoc_int_consts associated int/float constants

The next step in RFC https://github.com/rust-lang/rfcs/pull/2700 (tracking issue #68490). Stabilizing the associated constants that were added in #68325.

* Stabilize all constants under the `assoc_int_consts` feature flag.
* Update documentation on old constants to say they are soft-deprecated and the new ones should be preferred.
* Update documentation examples to use new constants.
* Remove `uint_macro` and use `int_macro` for all integer types since the macros were identical anyway.

r? @LukasKalbertodt

4 years agoAuto merge of #69550 - RalfJung:scalar, r=oli-obk
bors [Wed, 4 Mar 2020 04:10:58 +0000 (04:10 +0000)]
Auto merge of #69550 - RalfJung:scalar, r=oli-obk

interpret engine: Scalar cleanup

* Remove `to_ptr`
* Make `to_bits` private

r? @oli-obk

4 years agoAuto merge of #69678 - Dylan-DPC:rollup-yoaueud, r=Dylan-DPC
bors [Tue, 3 Mar 2020 23:26:38 +0000 (23:26 +0000)]
Auto merge of #69678 - Dylan-DPC:rollup-yoaueud, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #69565 (miri engine: turn some debug_assert into assert)
 - #69621 (use question mark operator in a few places.)
 - #69650 (cleanup more iterator usages (and other things))
 - #69653 (use conditions directly)
 - #69665 (Invoke OptimizerLastEPCallbacks in PreLinkThinLTO)
 - #69670 (Add explanation for E0379)

Failed merges:

r? @ghost

4 years agoRollup merge of #69670 - GuillaumeGomez:explain-e0379, r=Dylan-DPC
Dylan DPC [Tue, 3 Mar 2020 20:26:18 +0000 (21:26 +0100)]
Rollup merge of #69670 - GuillaumeGomez:explain-e0379, r=Dylan-DPC

Add explanation for E0379

r? @Dylan-DPC

4 years agoRollup merge of #69665 - tmiasko:new-pass-manager-thin-lto-opt, r=nikic
Dylan DPC [Tue, 3 Mar 2020 20:26:16 +0000 (21:26 +0100)]
Rollup merge of #69665 - tmiasko:new-pass-manager-thin-lto-opt, r=nikic

Invoke OptimizerLastEPCallbacks in PreLinkThinLTO

The default ThinLTO pre-link pipeline does not include optimizer last
extension points. Thus, when using the new LLVM pass manager & ThinLTO
& sanitizers on any opt-level different from zero, the sanitizer
function passes would be omitted from the pipeline.

Add optimizer last extensions points manually to the pipeline, but guard
registration with stage check in the case this behaviour changes in the
future.

4 years agoRollup merge of #69653 - matthiaskrgr:needless_bool, r=Dylan-DPC
Dylan DPC [Tue, 3 Mar 2020 20:26:15 +0000 (21:26 +0100)]
Rollup merge of #69653 - matthiaskrgr:needless_bool, r=Dylan-DPC

use conditions directly

4 years agoRollup merge of #69650 - matthiaskrgr:clnp, r=varkor
Dylan DPC [Tue, 3 Mar 2020 20:26:13 +0000 (21:26 +0100)]
Rollup merge of #69650 - matthiaskrgr:clnp, r=varkor

cleanup more iterator usages (and other things)

* Improve weird formatting by moving comment inside else-code block.
* Use .any(x) instead of .find(x).is_some() on iterators.
* Use .nth(x) instead of .skip(x).next() on iterators.
* Simplify conditions like  x + 1 <= y   to   x < y
* Use let instead of match to get value of enum with single variant.

4 years agoRollup merge of #69621 - matthiaskrgr:q, r=petrochenkov
Dylan DPC [Tue, 3 Mar 2020 20:26:12 +0000 (21:26 +0100)]
Rollup merge of #69621 - matthiaskrgr:q, r=petrochenkov

use question mark operator in a few places.

4 years agoRollup merge of #69565 - RalfJung:assert, r=eddyb
Dylan DPC [Tue, 3 Mar 2020 20:26:10 +0000 (21:26 +0100)]
Rollup merge of #69565 - RalfJung:assert, r=eddyb

miri engine: turn some debug_assert into assert

@eddyb said to avoid debug assertions in rustc. These checks here look like they are probably not too expensive. Cc @oli-obk

4 years agoAuto merge of #69506 - Centril:stmt-semi-none, r=petrochenkov
bors [Tue, 3 Mar 2020 19:57:07 +0000 (19:57 +0000)]
Auto merge of #69506 - Centril:stmt-semi-none, r=petrochenkov

encode `;` stmt without expr as `StmtKind::Empty`

Instead of encoding `;` statements without a an expression as a tuple in AST, encode it as `ast::StmtKind::Empty`.

r? @petrochenkov

4 years agoAuto merge of #69371 - tmiasko:weak-lang-cycle, r=alexcrichton
bors [Tue, 3 Mar 2020 16:38:02 +0000 (16:38 +0000)]
Auto merge of #69371 - tmiasko:weak-lang-cycle, r=alexcrichton

Improve linking of crates with circular dependencies

Previously, the code responsible for handling the cycles between crates
introduces through weak lang items, would keep a set of missing language
items:

* extending it with items missing from the current crate,
* removing items provided by the current crate,
* grouping the crates when the set changed from non-empty back to empty.

This could produce incorrect results, if a lang item was missing from a
crate that comes after the crate that provides it (in the loop iteration
order). In that case the grouping would not take place.

The changes here address this specific failure scenario by keeping track
of two separate sets of crates. Those that are required to link successfully,
and those that are available for linking.

Verified using test case from #69368.

4 years agoAuto merge of #69482 - lqd:poloniusup, r=nikomatsakis
bors [Tue, 3 Mar 2020 13:27:52 +0000 (13:27 +0000)]
Auto merge of #69482 - lqd:poloniusup, r=nikomatsakis

Polonius: update `polonius-engine` to 0.12.0

Since @albins won't have the time to finish up #68993 for a while, I'll take care of the trivial remaining tasks (rebasing, taking care of tidy/rustfmt).

I'll r? @nikomatsakis since they're assigned to #68993, but have actually [already reviewed it pre-rebase](https://github.com/rust-lang/rust/pull/68993#issuecomment-586413089).

When CI passes: I'll notify bors and close #68993, since this PR supersedes it.

4 years agoAdd explanation for E0379
Guillaume Gomez [Tue, 3 Mar 2020 12:30:17 +0000 (13:30 +0100)]
Add explanation for E0379

4 years agoAdd regression test for linking issue with start-group / end-group
Tomasz Miąsko [Tue, 3 Mar 2020 00:00:00 +0000 (00:00 +0000)]
Add regression test for linking issue with start-group / end-group

4 years agoImprove linking of crates with circular dependencies
Tomasz Miąsko [Sat, 22 Feb 2020 00:00:00 +0000 (00:00 +0000)]
Improve linking of crates with circular dependencies

Previously, the code responsible for handling the cycles between crates
introduces through weak lang items, would keep a set of missing language
items:

* extending it with items missing from the current crate,
* removing items provided by the current crate,
* grouping the crates when the set changed from non-empty back to empty.

This could produce incorrect results, if a lang item was missing from a
crate that comes after the crate that provides it (in the loop iteration
order). In that case the grouping would not take place.

The changes here address this specific failure scenario by keeping track
of two separate sets of crates. Those that are required to link successfully,
and those that are available for linking.

Verified using test case from 69368.

4 years agouse question mark operator in a few places.
Matthias Krüger [Sun, 1 Mar 2020 21:04:42 +0000 (22:04 +0100)]
use question mark operator in a few places.

4 years agoAuto merge of #69666 - JohnTitor:rollup-6nt3op0, r=JohnTitor
bors [Tue, 3 Mar 2020 10:18:57 +0000 (10:18 +0000)]
Auto merge of #69666 - JohnTitor:rollup-6nt3op0, r=JohnTitor

Rollup of 9 pull requests

Successful merges:

 - #69213 (Improve documentation on iterators length)
 - #69609 (Remove `usable_size` APIs)
 - #69619 (more cleanups)
 - #69620 (doc(librustc_error_codes): add long error explanation for E0719)
 - #69626 (Toolstate: don't duplicate nightly tool list.)
 - #69628 (Fix a leak in `DiagnosticBuilder::into_diagnostic`.)
 - #69633 (Update my mailmap entry)
 - #69634 (clean up E0378 explanation)
 - #69637 (Don't convert Results to Options just for matching.)

Failed merges:

r? @ghost

4 years agoRollup merge of #69637 - matthiaskrgr:if_let_some_result, r=ecstatic-morse
Yuki Okushi [Tue, 3 Mar 2020 08:50:17 +0000 (17:50 +0900)]
Rollup merge of #69637 - matthiaskrgr:if_let_some_result, r=ecstatic-morse

Don't convert Results to Options just for matching.

4 years agoRollup merge of #69634 - GuillaumeGomez:clean-up-e0378, r=Dylan-DPC
Yuki Okushi [Tue, 3 Mar 2020 08:50:16 +0000 (17:50 +0900)]
Rollup merge of #69634 - GuillaumeGomez:clean-up-e0378, r=Dylan-DPC

clean up E0378 explanation

r? @Dylan-DPC

4 years agoRollup merge of #69633 - XAMPPRocky:master, r=Dylan-DPC
Yuki Okushi [Tue, 3 Mar 2020 08:50:14 +0000 (17:50 +0900)]
Rollup merge of #69633 - XAMPPRocky:master, r=Dylan-DPC

Update my mailmap entry

superceding #68891

4 years agoRollup merge of #69628 - nnethercote:fix-DiagnosticBuilder-into_diagnostic-leak,...
Yuki Okushi [Tue, 3 Mar 2020 08:50:13 +0000 (17:50 +0900)]
Rollup merge of #69628 - nnethercote:fix-DiagnosticBuilder-into_diagnostic-leak, r=Centril

Fix a leak in `DiagnosticBuilder::into_diagnostic`.

Fixes #69600.

r? @Centril

4 years agoRollup merge of #69626 - ehuss:toolstate-nightly-cleanup, r=Mark-Simulacrum
Yuki Okushi [Tue, 3 Mar 2020 08:50:11 +0000 (17:50 +0900)]
Rollup merge of #69626 - ehuss:toolstate-nightly-cleanup, r=Mark-Simulacrum

Toolstate: don't duplicate nightly tool list.

Just some cleanup, seems good to avoid duplicating this list.

4 years agoRollup merge of #69620 - thekuom:doc/61137-add-long-error-code-e0719, r=davidtwco
Yuki Okushi [Tue, 3 Mar 2020 08:50:10 +0000 (17:50 +0900)]
Rollup merge of #69620 - thekuom:doc/61137-add-long-error-code-e0719, r=davidtwco

doc(librustc_error_codes): add long error explanation for E0719

Reference issue #61137

- Updated error_codes.rs
- Added E0719.md in error_codes
- Updated necessary test .stderr files

4 years agoRollup merge of #69619 - matthiaskrgr:misc, r=eddyb
Yuki Okushi [Tue, 3 Mar 2020 08:50:08 +0000 (17:50 +0900)]
Rollup merge of #69619 - matthiaskrgr:misc, r=eddyb

more cleanups

* use starts_with() instead of chars().next() == Some(x)
* use subsec_micros() instead of subsec_nanos() / 1000
* use for (idx, item) in iter.enumerate() instead of manually counting loop iterations with variables
* use values() or keys() respectively when iterating only over keys or values of maps.

4 years agoRollup merge of #69609 - TimDiekmann:excess, r=Amanieu
Yuki Okushi [Tue, 3 Mar 2020 08:50:06 +0000 (17:50 +0900)]
Rollup merge of #69609 - TimDiekmann:excess, r=Amanieu

Remove `usable_size` APIs

This removes the usable size APIs:
- remove `usable_size` (obv)
- change return type of allocating methods to include the allocated size
- remove `_excess` API

r? @Amanieu
closes rust-lang/wg-allocators#17

4 years agoRollup merge of #69213 - LeSeulArtichaut:improve-doc-iter, r=steveklabnik
Yuki Okushi [Tue, 3 Mar 2020 08:50:04 +0000 (17:50 +0900)]
Rollup merge of #69213 - LeSeulArtichaut:improve-doc-iter, r=steveklabnik

Improve documentation on iterators length

Attempts to resolve #66491. @the8472 does this help?

r? @steveklabnik

4 years agoFix check for __msan_keep_going in sanitizer-recover test
Tomasz Miąsko [Tue, 3 Mar 2020 00:00:00 +0000 (00:00 +0000)]
Fix check for __msan_keep_going in sanitizer-recover test

Match `@__msan_keep_going = weak_odr constant i32 1`.

4 years agoAdd test for -Znew-llvm-pass-manager -Clto=thin -Zsanitizer=...
Tomasz Miąsko [Tue, 3 Mar 2020 00:00:00 +0000 (00:00 +0000)]
Add test for -Znew-llvm-pass-manager -Clto=thin -Zsanitizer=...

Additionally verify that the current implementation of LLVM version
check (which uses lexicographic ordering) is good enough to exclude
versions before LLVM 9, where the new LLVM pass manager is unsupported.

4 years agoInvoke OptimizerLastEPCallbacks in PreLinkThinLTO
Tomasz Miąsko [Tue, 3 Mar 2020 00:00:00 +0000 (00:00 +0000)]
Invoke OptimizerLastEPCallbacks in PreLinkThinLTO

The default ThinLTO pre-link pipeline does not include optimizer last
extension points. Thus, when using the new LLVM pass manager & ThinLTO
& sanitizers on any opt-level different from zero, the sanitizer
function passes would be omitted from the pipeline.

Add optimizer last extensions points manually to the pipeline, but guard
registration with stage check in the case this behaviour changes in the
future.

4 years agoAuto merge of #69247 - CAD97:remove-chalk, r=nikomatsakis
bors [Tue, 3 Mar 2020 04:31:01 +0000 (04:31 +0000)]
Auto merge of #69247 - CAD97:remove-chalk, r=nikomatsakis

Remove experimental chalk option

As suggested by @nikomatsakis [here](https://github.com/rust-lang/rust/pull/68807#issuecomment-583339932).

The current version of chalk used by the experimental `-Zchalk` flag is [v0.9.0, which is over a year old](https://crates.io/crates/chalk-engine). Since v0.9.0, chalk has seen [a lot of further development](https://github.com/rust-lang/chalk/compare/41dfe13...master), and the intent is to eventually upgrade rustc to use a more recent chalk.

However, it will take a decent chunk of effort to upgrade the current experimental chalk support, and it is currently [blocking at least some PRs](https://github.com/rust-lang/rust/pull/68807) due to chalk:0.9.0's use of unstable features. So for the interim until the next chalk release and experimental rustc integration, we remove the chalk-specific code from rustc.

4 years agouse conditions directly
Matthias Krüger [Tue, 3 Mar 2020 01:07:15 +0000 (02:07 +0100)]
use conditions directly

4 years agoImprove weird formatting by moving comment inside else-code block.
Matthias Krüger [Mon, 2 Mar 2020 19:17:10 +0000 (20:17 +0100)]
Improve weird formatting by moving comment inside else-code block.

4 years agoUse .any(x) instead of .find(x).is_some() on iterators.
Matthias Krüger [Mon, 2 Mar 2020 19:01:03 +0000 (20:01 +0100)]
Use .any(x) instead of .find(x).is_some() on iterators.

4 years agoUse .nth(x) instead of .skip(x).next() on iterators.
Matthias Krüger [Mon, 2 Mar 2020 18:36:12 +0000 (19:36 +0100)]
Use .nth(x) instead of .skip(x).next() on iterators.

4 years agoSimplify conditions like x + 1 <= y to x < y
Matthias Krüger [Mon, 2 Mar 2020 17:53:56 +0000 (18:53 +0100)]
Simplify conditions like  x + 1 <= y   to   x < y

4 years agoUse let instead of match to get value of enum with single variant.
Matthias Krüger [Mon, 2 Mar 2020 17:43:05 +0000 (18:43 +0100)]
Use let instead of match to get value of enum with single variant.

4 years agoRemove chalk integration
CAD97 [Mon, 17 Feb 2020 20:32:37 +0000 (15:32 -0500)]
Remove chalk integration

4 years agoRemove `usable_size` APIs
Tim Diekmann [Mon, 2 Mar 2020 23:08:24 +0000 (00:08 +0100)]
Remove `usable_size` APIs

4 years agoAuto merge of #69627 - ehuss:update-cargo-clippy, r=Dylan-DPC
bors [Mon, 2 Mar 2020 22:58:48 +0000 (22:58 +0000)]
Auto merge of #69627 - ehuss:update-cargo-clippy, r=Dylan-DPC

Update cargo, clippy

Closes #69601

## cargo

16 commits in e57bd02999c9f40d52116e0beca7d1dccb0643de..bda50510d1daf6e9c53ad6ccf603da6e0fa8103f
2020-02-21 20:20:10 +0000 to 2020-03-02 18:05:34 +0000
- Fix rare failure in collision_export test. (rust-lang/cargo#7956)
- Ignore broken Cargo.toml in git sources (rust-lang/cargo#7947)
- Add more fingerprint mtime debug logging. (rust-lang/cargo#7952)
- Fix plugin tests for latest nightly. (rust-lang/cargo#7955)
- Simplified usage code of SipHasher (rust-lang/cargo#7945)
- Add a special case for git config discovery inside tests (rust-lang/cargo#7944)
- Fixes issue rust-lang/cargo#7543 (rust-lang/cargo#7946)
- Filter out cfgs which should not be used during build (rust-lang/cargo#7943)
- Provide extra context on a query failure. (rust-lang/cargo#7934)
- Try to clarify `cargo metadata`'s relationship with the workspace. (rust-lang/cargo#7927)
- Update libgit2 dependency (rust-lang/cargo#7939)
- Fix link in comment (rust-lang/cargo#7936)
- Enable `cargo doc --open` tests on macos. (rust-lang/cargo#7932)
- build-std: remove sysroot probe (rust-lang/cargo#7931)
- Try to clarify how feature flags work on the "current" package. (rust-lang/cargo#7928)
- Add extra details in the new feature resolver doc comment. (rust-lang/cargo#7918)

## clippy

6 commits in fc5d0cc583cb1cd35d58fdb7f3e0cfa12dccd6c0..8b7f7e667268921c278af94ae30a61e87a22b22b
2020-02-24 05:58:17 +0000 to 2020-03-02 20:00:31 +0000
- Rustup to rust-lang/rust#69469 (rust-lang-nursery/rust-clippy#5254)
- Some rustups (rust-lang-nursery/rust-clippy#5247)
- Update git2 to 0.12 (rust-lang-nursery/rust-clippy#5232)
- Rustup to rust-lang/rust#61812 (rust-lang-nursery/rust-clippy#5231)
- Add lint to improve floating-point expressions (rust-lang-nursery/rust-clippy#4897)
- Do not run deploy action on other repos (rust-lang-nursery/rust-clippy#5222)

4 years agoApply suggestions from code review
LeSeulArtichaut [Mon, 2 Mar 2020 20:42:55 +0000 (21:42 +0100)]
Apply suggestions from code review

4 years agoUpdate cargo, clippy
Eric Huss [Mon, 2 Mar 2020 01:11:57 +0000 (17:11 -0800)]
Update cargo, clippy

4 years agoToolstate: don't duplicate nightly tool list.
Eric Huss [Mon, 2 Mar 2020 00:06:36 +0000 (16:06 -0800)]
Toolstate: don't duplicate nightly tool list.

4 years agoDon't convert Results to Options just for matching.
Matthias Krüger [Sun, 1 Mar 2020 23:09:17 +0000 (00:09 +0100)]
Don't convert Results to Options just for matching.

4 years agoAuto merge of #69635 - Dylan-DPC:rollup-2oh8uu5, r=Dylan-DPC
bors [Mon, 2 Mar 2020 12:48:26 +0000 (12:48 +0000)]
Auto merge of #69635 - Dylan-DPC:rollup-2oh8uu5, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #68682 (Add documentation to compiler intrinsics)
 - #69544 (Unrevert "Remove `checked_add` in `Layout::repeat`")
 - #69617 (constify mem::forget)
 - #69622 (Rename `syntax` in librustc_ast/README.md)
 - #69623 (stash API: remove panic to fix ICE.)
 - #69624 (Toolstate: Don't block beta week on already broken tools.)

Failed merges:

 - #69626 (Toolstate: don't duplicate nightly tool list.)

r? @ghost

4 years agoRollup merge of #69624 - ehuss:toolstate-beta-regress, r=Mark-Simulacrum
Dylan DPC [Mon, 2 Mar 2020 12:42:43 +0000 (13:42 +0100)]
Rollup merge of #69624 - ehuss:toolstate-beta-regress, r=Mark-Simulacrum

Toolstate: Don't block beta week on already broken tools.

This changes it so that tools are allowed to be broken entering the beta week if they are already broken.  This restores the original behavior before the changes in #69332.

Closes #68458

4 years agoRollup merge of #69623 - Centril:fix-69396-tmp, r=petrochenkov
Dylan DPC [Mon, 2 Mar 2020 12:42:41 +0000 (13:42 +0100)]
Rollup merge of #69623 - Centril:fix-69396-tmp, r=petrochenkov

stash API: remove panic to fix ICE.

Implements the temporary solution suggested in https://github.com/rust-lang/rust/pull/69537#issuecomment-593143975.
Fixes https://github.com/rust-lang/rust/issues/69396.

r? @petrochenkov

4 years agoRollup merge of #69622 - LeSeulArtichaut:patch-2, r=Centril
Dylan DPC [Mon, 2 Mar 2020 12:42:40 +0000 (13:42 +0100)]
Rollup merge of #69622 - LeSeulArtichaut:patch-2, r=Centril

Rename `syntax` in librustc_ast/README.md

Related to e94d3b7.
r? @petrochenkov

4 years agoRollup merge of #69617 - DutchGhost:master, r=LukasKalbertodt
Dylan DPC [Mon, 2 Mar 2020 12:42:38 +0000 (13:42 +0100)]
Rollup merge of #69617 - DutchGhost:master, r=LukasKalbertodt

constify mem::forget

implements https://github.com/rust-lang/rust/issues/69616

4 years agoRollup merge of #69544 - lqd:unrevert-67174, r=Mark-Simulacrum
Dylan DPC [Mon, 2 Mar 2020 12:42:37 +0000 (13:42 +0100)]
Rollup merge of #69544 - lqd:unrevert-67174, r=Mark-Simulacrum

Unrevert "Remove `checked_add` in `Layout::repeat`"

This reapplies @kraai's original `libcore::alloc::Layout::repeat` change from #67174 which was temporarily reverted in #69241. Now that the proper LLVM fix has been cherry-picked, we can unrevert the revert.

This change was originally reviewed by @hanna-kruppe on the initial PR.

cc @RalfJung

4 years agoRollup merge of #68682 - LeSeulArtichaut:stable-intrinsics, r=steveklabnik
Dylan DPC [Mon, 2 Mar 2020 12:42:35 +0000 (13:42 +0100)]
Rollup merge of #68682 - LeSeulArtichaut:stable-intrinsics, r=steveklabnik

Add documentation to compiler intrinsics

This adds documentation to the compiler intrinsics having stable standard implementations.

Relates to #34338 (cc @bstrie)

r? @steveklabnik (for reassignment?)

4 years agoclean up E0378 explanation
Guillaume Gomez [Mon, 2 Mar 2020 12:10:24 +0000 (13:10 +0100)]
clean up E0378 explanation

4 years agouse values() or keys() respectively when iterating only over keys or values of maps.
Matthias Krüger [Sun, 1 Mar 2020 19:56:30 +0000 (20:56 +0100)]
use values() or keys() respectively when iterating only over keys or values of maps.

4 years agoUpdate my mailmap entry
Erin Power [Mon, 2 Mar 2020 11:04:09 +0000 (12:04 +0100)]
Update my mailmap entry

4 years agoactually mark the function const
DutchGhost [Mon, 2 Mar 2020 10:00:20 +0000 (11:00 +0100)]
actually mark the function const

4 years agoAuto merge of #69257 - RalfJung:layout-visitor, r=eddyb
bors [Mon, 2 Mar 2020 09:37:35 +0000 (09:37 +0000)]
Auto merge of #69257 - RalfJung:layout-visitor, r=eddyb

Adjust Miri value visitor, and doc-comment layout components

I realized that I still didn't have quite the right intuition for how our `LayoutDetails` work, so I had to adjust the Miri value visitor to the things I understood better now. I also added some doc-comments to `LayoutDetails` as a hopefully canonical place to note such things.

The main visitor change is that we *first* look at all the fields (according to `FieldPlacement`), and *then* check the variants and handle `Multiple` appropriately. I did not quite realize how orthogonal "fields" and "variants" are.
I also moved the check for the scalar ABI to *after* checking all the fields; this leads to better (more type-driven) error messages.

And it looks like we can finally remove that magic hack for `ty::Generator`. :D

r? @oli-obk for the Miri/visitor changes and @eddyb for the layout docs
The Miri PR is at: https://github.com/rust-lang/miri/pull/1178

4 years agoAuto merge of #69469 - matthewjasper:type-flags, r=cramertj
bors [Mon, 2 Mar 2020 06:30:52 +0000 (06:30 +0000)]
Auto merge of #69469 - matthewjasper:type-flags, r=cramertj

Clean up TypeFlags

* Add a new method `has_infer_types_or_consts` that's used instead of `has_infer_types` most of the time, since there's generally no reason to only consider types.
*  Remove `has_closure_types`/`HAS_TY_CLOSURE`, because closures are no longer implicitly linked to the `InferCtxt`.
* Reorder flags to group similar ones together
* Make some flags more granular
* Compute `HAS_FREE_LOCAL_NAMES` from the other flags
* Add some more doc comments

4 years agoFix a leak in `DiagnosticBuilder::into_diagnostic`.
Nicholas Nethercote [Mon, 2 Mar 2020 00:47:49 +0000 (11:47 +1100)]
Fix a leak in `DiagnosticBuilder::into_diagnostic`.

Fixes #69600.

4 years agoAuto merge of #69442 - jakevossen5:master, r=Mark-Simulacrum
bors [Mon, 2 Mar 2020 03:16:22 +0000 (03:16 +0000)]
Auto merge of #69442 - jakevossen5:master, r=Mark-Simulacrum

`--explain` disambiguates no long description and invalid error codes

Closes #44710

First code contribution here, so feedback is very much appreciated!

cc @zackmdavis
cc @Mark-Simulacrum

4 years agoAuto merge of #69432 - petrochenkov:alldeps, r=eddyb
bors [Mon, 2 Mar 2020 00:07:06 +0000 (00:07 +0000)]
Auto merge of #69432 - petrochenkov:alldeps, r=eddyb

rustc_metadata: Load metadata for indirect macro-only dependencies

Imagine this dependency chain between crates
```
Executable crate -> Library crate -> Macro crate
```
where "Library crate" uses the macros from "Macro crate" for some code generation, but doesn't reexport them any further.

Currently, when compiling "Executable crate" we don't even load metadata for it, because why would we want to load any metadata from "Macro crate" if it already did all its code generation job when compiling "Library crate".
Right?

Wrong!
Hygiene data and spans (https://github.com/rust-lang/rust/issues/68686, https://github.com/rust-lang/rust/pull/68941) from "Macro crate" still may need to be decoded from "Executable crate".
So we'll have to load them properly.

Questions:
- How this will affect compile times for larger crate trees in practice? How to measure it?
Hygiene/span encoding/decoding will necessarily slow down compilation because right now we just don't do some work that we should do, but this introduces a whole new way to slow down things. E.g. loading metadata for `syn` (and its dependencies) when compiling your executable if one of its library dependencies uses it.
- We are currently detecting whether a crate reexports macros from "Macro crate" or not, could we similarly detect whether a crate "reexports spans" and keep it unloaded if it doesn't?
Or at least "reexports important spans" affecting hygiene, we can probably lose spans that only affect diagnostics.

4 years agoToolstate: Don't block beta week on already broken tools.
Eric Huss [Sun, 1 Mar 2020 23:46:38 +0000 (15:46 -0800)]
Toolstate: Don't block beta week on already broken tools.

4 years agostash API: remove panic to fix ICE.
Mazdak Farrokhzad [Sun, 1 Mar 2020 23:07:23 +0000 (00:07 +0100)]
stash API: remove panic to fix ICE.

4 years agoRename `syntax` in librustc_ast/README.md
LeSeulArtichaut [Sun, 1 Mar 2020 22:56:03 +0000 (23:56 +0100)]
Rename `syntax` in librustc_ast/README.md

4 years agoencode `;` stmt w/o expr as `StmtKind::Empty`
Mazdak Farrokhzad [Thu, 27 Feb 2020 03:10:42 +0000 (04:10 +0100)]
encode `;` stmt w/o expr as `StmtKind::Empty`

4 years agoClean up TypeFlags
Matthew Jasper [Sat, 22 Feb 2020 15:09:17 +0000 (15:09 +0000)]
Clean up TypeFlags

* Reorder flags to group similar ones together
* Make some flags more granular
* Compute `HAS_FREE_LOCAL_NAMES` from the other flags
* Remove `HAS_TY_CLOSURE`
* Add some more doc comments

4 years agoFix use of `has_infer_types`
Matthew Jasper [Sat, 22 Feb 2020 14:10:17 +0000 (14:10 +0000)]
Fix use of `has_infer_types`

* Add a new method `has_infer_types_or_consts` that's used instead most
  of the time, since there's generally no reason to only consider types.
*  Remove use of `has_closure_types`, because closures are no longer
  implicitly linked to the `InferCtxt`.

4 years agodoc(librustc_error_codes): add long error explanation for E0719
Matthew Kuo [Sun, 1 Mar 2020 20:15:44 +0000 (14:15 -0600)]
doc(librustc_error_codes): add long error explanation for E0719

Progresses #61137

4 years agoAuto merge of #69408 - RalfJung:canonical-alloc-id, r=oli-obk
bors [Sun, 1 Mar 2020 20:53:04 +0000 (20:53 +0000)]
Auto merge of #69408 - RalfJung:canonical-alloc-id, r=oli-obk

Miri: let machine canonicalize AllocIDs

This implements the rustc side of the plan I laid out [here](https://github.com/rust-lang/miri/pull/1147#issuecomment-581868901).

Miri PR: https://github.com/rust-lang/miri/pull/1190

4 years agouse for (idx, item) in iter.enumerate() instead of manually counting loop iteration...
Matthias Krüger [Sun, 1 Mar 2020 19:21:09 +0000 (20:21 +0100)]
use  for (idx, item) in iter.enumerate()  instead of manually counting loop iterations by variables

4 years agouse subdsec_micros() instead of subsec_nanos() / 1000
Matthias Krüger [Sun, 1 Mar 2020 19:09:14 +0000 (20:09 +0100)]
use subdsec_micros() instead of subsec_nanos() / 1000

4 years agouse starts_with() instead of chars().next() == Some(x)
Matthias Krüger [Sun, 1 Mar 2020 19:03:56 +0000 (20:03 +0100)]
use starts_with() instead of chars().next() == Some(x)

4 years agoconstify mem::forget
DutchGhost [Sun, 1 Mar 2020 19:42:35 +0000 (20:42 +0100)]
constify mem::forget

4 years agoAuto merge of #69612 - Dylan-DPC:rollup-f180gcc, r=Dylan-DPC
bors [Sun, 1 Mar 2020 17:39:05 +0000 (17:39 +0000)]
Auto merge of #69612 - Dylan-DPC:rollup-f180gcc, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #69504 (Use assert_ne in hash tests)
 - #69554 (Cleanup e0374)
 - #69568 (Clarify explanation of Vec<T> 'fn resize')
 - #69569 (simplify boolean expressions)
 - #69577 (Clean up E0375 explanation)
 - #69598 (rustdoc: HTML escape crate version)
 - #69607 (Clean up E0376 explanation)

Failed merges:

r? @ghost

4 years agoRollup merge of #69607 - GuillaumeGomez:cleanup-e0376, r=Dylan-DPC
Dylan DPC [Sun, 1 Mar 2020 16:23:36 +0000 (17:23 +0100)]
Rollup merge of #69607 - GuillaumeGomez:cleanup-e0376, r=Dylan-DPC

Clean up E0376 explanation

r? @Dylan-DPC

4 years agoRollup merge of #69598 - ollie27:rustdoc_crate-version_escape, r=GuillaumeGomez
Dylan DPC [Sun, 1 Mar 2020 16:23:34 +0000 (17:23 +0100)]
Rollup merge of #69598 - ollie27:rustdoc_crate-version_escape, r=GuillaumeGomez

rustdoc: HTML escape crate version

As `--crate-version` accepts arbitrary strings they need to be escaped.

r? @GuillaumeGomez

4 years agoRollup merge of #69577 - GuillaumeGomez:cleanup-e0375, r=Dylan-DPC
Dylan DPC [Sun, 1 Mar 2020 16:23:32 +0000 (17:23 +0100)]
Rollup merge of #69577 - GuillaumeGomez:cleanup-e0375, r=Dylan-DPC

Clean up E0375 explanation

r? @Dylan-DPC

4 years agoRollup merge of #69569 - matthiaskrgr:nonminimal_bool, r=mark-Simulacrum
Dylan DPC [Sun, 1 Mar 2020 16:23:30 +0000 (17:23 +0100)]
Rollup merge of #69569 - matthiaskrgr:nonminimal_bool, r=mark-Simulacrum

simplify boolean expressions

4 years agoRollup merge of #69568 - JOE1994:patch-2, r=Dylan-DPC
Dylan DPC [Sun, 1 Mar 2020 16:23:29 +0000 (17:23 +0100)]
Rollup merge of #69568 - JOE1994:patch-2, r=Dylan-DPC

Clarify explanation of Vec<T> 'fn resize'

1. Clarified on what should implement `Clone` trait.
2. Minor grammar fix:
to be able clone => to be able **to** clone

4 years agoRollup merge of #69554 - GuillaumeGomez:cleanup-e0374, r=Dylan-DPC
Dylan DPC [Sun, 1 Mar 2020 16:23:27 +0000 (17:23 +0100)]
Rollup merge of #69554 - GuillaumeGomez:cleanup-e0374, r=Dylan-DPC

Cleanup e0374

r? @Dylan-DPC

4 years agoRollup merge of #69504 - MichaelMcDonnell:hash_assert_ne, r=LukasKalbertodt
Dylan DPC [Sun, 1 Mar 2020 16:23:26 +0000 (17:23 +0100)]
Rollup merge of #69504 - MichaelMcDonnell:hash_assert_ne, r=LukasKalbertodt

Use assert_ne in hash tests

The hash tests were written before the assert_ne macro was added to the standard library. The assert_ne macro provides better output in case of a failure.

4 years agoRemove assert that had been replaced by assert_ne
Michael Mc Donnell [Thu, 27 Feb 2020 14:47:44 +0000 (06:47 -0800)]
Remove assert that had been replaced by assert_ne

4 years agoAuto merge of #69380 - Zoxc:parent-module, r=michaelwoerister
bors [Sun, 1 Mar 2020 14:21:03 +0000 (14:21 +0000)]
Auto merge of #69380 - Zoxc:parent-module, r=michaelwoerister

Use a query to get parent modules

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

r? @michaelwoerister

4 years agoClean up E0376 explanation
Guillaume Gomez [Sun, 1 Mar 2020 11:03:38 +0000 (12:03 +0100)]
Clean up E0376 explanation

4 years agoAuto merge of #69606 - JohnTitor:rollup-i3nrrcf, r=JohnTitor
bors [Sun, 1 Mar 2020 11:03:16 +0000 (11:03 +0000)]
Auto merge of #69606 - JohnTitor:rollup-i3nrrcf, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #69397 (bootstrap: Remove commit hash from LLVM version suffix to avoid rebuilds)
 - #69549 (Improve MinGW detection when cross compiling )
 - #69562 (Don't `bug` when taking discriminant of generator during dataflow)
 - #69579 (parser: Remove `Parser::prev_span`)
 - #69580 (use .copied() instead of .map(|x| *x) on iterators)
 - #69583 (Do not ICE on invalid type node after parse recovery)
 - #69605 (Use `opt_def_id()` over `def_id()`)

Failed merges:

r? @ghost

4 years agoRollup merge of #69605 - JohnTitor:opt-def-id, r=petrochenkov
Yuki Okushi [Sun, 1 Mar 2020 10:28:15 +0000 (19:28 +0900)]
Rollup merge of #69605 - JohnTitor:opt-def-id, r=petrochenkov

Use `opt_def_id()` over `def_id()`

Fixes #69588

4 years agoRollup merge of #69583 - LeSeulArtichaut:ice-69378, r=Centril
Yuki Okushi [Sun, 1 Mar 2020 10:28:13 +0000 (19:28 +0900)]
Rollup merge of #69583 - LeSeulArtichaut:ice-69378, r=Centril

Do not ICE on invalid type node after parse recovery

Closes #69378.
r? @estebank

4 years agoRollup merge of #69580 - matthiaskrgr:map_clone, r=Centril
Yuki Okushi [Sun, 1 Mar 2020 10:28:12 +0000 (19:28 +0900)]
Rollup merge of #69580 - matthiaskrgr:map_clone, r=Centril

use .copied() instead of .map(|x| *x) on iterators

4 years agoRollup merge of #69579 - petrochenkov:noprevspan, r=Centril
Yuki Okushi [Sun, 1 Mar 2020 10:28:10 +0000 (19:28 +0900)]
Rollup merge of #69579 - petrochenkov:noprevspan, r=Centril

parser: Remove `Parser::prev_span`

Follow-up to https://github.com/rust-lang/rust/pull/69384.
r? @Centril

4 years agoRollup merge of #69562 - ecstatic-morse:dataflow-generator-discriminant, r=oli-obk
Yuki Okushi [Sun, 1 Mar 2020 10:28:09 +0000 (19:28 +0900)]
Rollup merge of #69562 - ecstatic-morse:dataflow-generator-discriminant, r=oli-obk

Don't `bug` when taking discriminant of generator during dataflow

The proper fix for rust-lang/rust-clippy#5239. `Rvalue::Discriminant` is used on generators as well as `enum`s. This didn't cause a test failure in `rustc` since we don't need to do any dataflow passes until after the generator transform that adds the `Rvalue::Discriminant`.

This required a small refactoring. `diff -w` is beneficial.

r? @oli-obk
cc @JohnTitor

4 years agoRollup merge of #69549 - mati865:mingw, r=kennytm
Yuki Okushi [Sun, 1 Mar 2020 10:28:07 +0000 (19:28 +0900)]
Rollup merge of #69549 - mati865:mingw, r=kennytm

Improve MinGW detection when cross compiling

Official mingw-w64 builds, MSYS2 and LLVM MinGW provide both `gcc.exe` and `$ARCH-w64-mingw32-gcc.exe` so they should not regress but I included CI changes to verify it though `@bors try` (I don't have permission).

This change will come handy when cross compiling from Linux or Cygwin since they use `gcc` as native compiler and `$ARCH-w64-mingw32-gcc.exe` for MinGW. This means users will no longer have to override the linker.

4 years agoRollup merge of #69397 - tmiasko:llvm-version-suffix, r=nagisa
Yuki Okushi [Sun, 1 Mar 2020 10:28:05 +0000 (19:28 +0900)]
Rollup merge of #69397 - tmiasko:llvm-version-suffix, r=nagisa

bootstrap: Remove commit hash from LLVM version suffix to avoid rebuilds

The custom LLVM version suffix was introduced to avoid unintentional
library names conflicts. By default it included the LLVM submodule
commit hash. Changing the version suffix requires the complete LLVM
rebuild, and since then every change to the submodules required it as
well.

Remove the commit hash from version suffix to avoid complete rebuilds,
while leaving the `rust` string, the release number and release channel
to disambiguate the library name.

Context: version suffix was introduced by #59173 as solution to #59034.

Resolves #68715.

4 years agoAuto merge of #69295 - ecstatic-morse:unified-dataflow-generators, r=tmandry
bors [Sun, 1 Mar 2020 07:53:13 +0000 (07:53 +0000)]
Auto merge of #69295 - ecstatic-morse:unified-dataflow-generators, r=tmandry

Use new dataflow framework for generators

#65672 introduced a new dataflow framework that can handle arbitrarily complex transfer functions as well as ones expressed as a series of gen/kill operations. This PR ports the analyses used to implement generators to the new framework so that we can remove the old one. See #68241 for a prior example of this. The new framework has some superficial API changes, but this shouldn't alter the generator passes in any way.

r? @tmandry

4 years agoUse `opt_def_id()` over `def_id()`
Yuki Okushi [Sun, 1 Mar 2020 06:15:29 +0000 (15:15 +0900)]
Use `opt_def_id()` over `def_id()`

4 years agoAuto merge of #68943 - ecstatic-morse:no-useless-drop-on-enum-variants, r=matthewjasper
bors [Sun, 1 Mar 2020 04:42:21 +0000 (04:42 +0000)]
Auto merge of #68943 - ecstatic-morse:no-useless-drop-on-enum-variants, r=matthewjasper

Skip `Drop` terminators for enum variants without drop glue

Split out from #68528.

When doing drop elaboration for an `enum` that may or may not be moved out of (an open drop), we check the discriminant of the `enum` to see whether the live variant has any drop flags and then check the drop flags to see whether we need to drop each field. Sometimes, however, the live
variant has no move paths and thus no drop flags. In this case, we still emit a drop terminator
for the entire enum after checking the enum discriminant. This drop shim will check the discriminant of the enum *again* and then drop the fields of the active variant. If the active variant has no drop glue, nothing will be done.

This commit skips emitting the drop terminator during drop elaboration when the "otherwise" variants, those without move paths, have no drop glue. A common example of this scenario is when an `Option` is moved from, since `Option::None` never needs drop glue. Below is a fragment the pre-codegen CFG for `Option::unwrap_or` in which we check the drop flag (`_5`) for `self` (`_1`), before and after the change.

Before:

![image](https://user-images.githubusercontent.com/29463364/74078927-52942380-49e5-11ea-8e34-4b9d6d94ef25.png)

After:

![image](https://user-images.githubusercontent.com/29463364/74078945-78b9c380-49e5-11ea-8302-b043c4a7515a.png)

This change doesn't do much on its own, but it is a prerequisite to get the perf gains from #68528.

cc @arielb1

4 years agoAuto merge of #69592 - petrochenkov:nosyntax, r=Centril
bors [Sun, 1 Mar 2020 01:36:58 +0000 (01:36 +0000)]
Auto merge of #69592 - petrochenkov:nosyntax, r=Centril

Rename `libsyntax` to `librustc_ast`

This was the last rustc crate that wasn't following the `rustc_*` naming convention.

Follow-up to https://github.com/rust-lang/rust/pull/67763.

4 years agorustdoc: HTML escape crate version
Oliver Middleton [Sat, 29 Feb 2020 23:39:26 +0000 (23:39 +0000)]
rustdoc: HTML escape crate version

As `--crate-version` accepts arbitrary strings they need to be escaped.

4 years agoAuto merge of #69590 - Dylan-DPC:rollup-i3z0sic, r=Dylan-DPC
bors [Sat, 29 Feb 2020 20:23:10 +0000 (20:23 +0000)]
Auto merge of #69590 - Dylan-DPC:rollup-i3z0sic, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #69504 (Use assert_ne in hash tests)
 - #69571 (remove unneeded .as_ref() calls.)
 - #69572 (use .iter() instead of .into_iter() on references)
 - #69581 (fix aliasing violation in align_to_mut)
 - #69582 (improve transmute and Vec::from_raw_parts docs)
 - #69584 (Correct comment to match behavior)
 - #69587 (rustc_parse: Tweak the function parameter name check)

Failed merges:

r? @ghost

4 years agoRename `syntax` to `rustc_ast` in source code
Vadim Petrochenkov [Sat, 29 Feb 2020 17:37:32 +0000 (20:37 +0300)]
Rename `syntax` to `rustc_ast` in source code