]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agotypeck/pat: inaccessible private fields
David Wood [Thu, 10 Sep 2020 11:32:45 +0000 (12:32 +0100)]
typeck/pat: inaccessible private fields

This commit adjusts the missing field diagnostic logic for struct
patterns in typeck to improve the diagnostic when the missing fields are
inaccessible.

Signed-off-by: David Wood <david@davidtw.co>
3 years agotypeck/expr: inaccessible private fields
David Wood [Wed, 9 Sep 2020 14:42:37 +0000 (15:42 +0100)]
typeck/expr: inaccessible private fields

This commit adjusts the missing field diagnostic logic for struct
expressions in typeck to improve the diagnostic when the missing
fields are inaccessible.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoAuto merge of #76291 - matklad:spacing, r=petrochenkov
bors [Thu, 10 Sep 2020 08:07:48 +0000 (08:07 +0000)]
Auto merge of #76291 - matklad:spacing, r=petrochenkov

Rename IsJoint -> Spacing

Builds on #76286 and might conflict with #76285

r? `@petrochenkov`

3 years agoAuto merge of #75573 - Aaron1011:feature/const-mutation-lint, r=oli-obk
bors [Thu, 10 Sep 2020 05:54:26 +0000 (05:54 +0000)]
Auto merge of #75573 - Aaron1011:feature/const-mutation-lint, r=oli-obk

Add CONST_ITEM_MUTATION lint

Fixes #74053
Fixes #55721

This PR adds a new lint `CONST_ITEM_MUTATION`.
Given an item `const FOO: SomeType = ..`, this lint fires on:

* Attempting to write directly to a field (`FOO.field = some_val`) or
  array entry (`FOO.array_field[0] = val`)
* Taking a mutable reference to the `const` item (`&mut FOO`), including
  through an autoderef `FOO.some_mut_self_method()`

The lint message explains that since each use of a constant creates a
new temporary, the original `const` item will not be modified.

3 years agoAuto merge of #76558 - tmandry:rollup-bskim2r, r=tmandry
bors [Thu, 10 Sep 2020 04:03:28 +0000 (04:03 +0000)]
Auto merge of #76558 - tmandry:rollup-bskim2r, r=tmandry

Rollup of 7 pull requests

Successful merges:

 - #74787 (Move `rustllvm` into `compiler/rustc_llvm`)
 - #76458 (Add drain_filter method to HashMap and HashSet)
 - #76472 (rustbuild: don't set PYTHON_EXECUTABLE and WITH_POLLY cmake vars since they are no longer supported by llvm)
 - #76497 (Use intra-doc links in `core::ptr`)
 - #76500 (Add -Zgraphviz_dark_mode and monospace font fix)
 - #76543 (Document btree's unwrap_unchecked)
 - #76556 (Revert #76285)

Failed merges:

r? `@ghost`

3 years agoRollup merge of #76556 - tmandry:revert-76285, r=tmandry
Tyler Mandry [Thu, 10 Sep 2020 04:02:38 +0000 (21:02 -0700)]
Rollup merge of #76556 - tmandry:revert-76285, r=tmandry

Revert #76285

Fixes #76399. Reverting because the issue is P-critical and there are no PRs up to fix it.

r? @Mark-Simulacrum
cc @matklad @dtolnay

3 years agoRollup merge of #76543 - ssomers:btree_cleanup_4, r=Mark-Simulacrum
Tyler Mandry [Thu, 10 Sep 2020 04:02:36 +0000 (21:02 -0700)]
Rollup merge of #76543 - ssomers:btree_cleanup_4, r=Mark-Simulacrum

Document btree's unwrap_unchecked

#74693's second wind

3 years agoRollup merge of #76500 - richkadel:mir-graphviz-dark, r=tmandry
Tyler Mandry [Thu, 10 Sep 2020 04:02:35 +0000 (21:02 -0700)]
Rollup merge of #76500 - richkadel:mir-graphviz-dark, r=tmandry

Add -Zgraphviz_dark_mode and monospace font fix

Many developers use a dark theme with editors and IDEs, but this
typically doesn't extend to graphviz output.

When I bring up a MIR graphviz document, the white background is
strikingly bright. This new option changes the colors used for graphviz
output to work better in dark-themed UIs.

<img width="1305" alt="Screen Shot 2020-09-09 at 3 00 31 PM" src="https://user-images.githubusercontent.com/3827298/92659478-4b9bff00-f2ad-11ea-8894-b40d3a873cb9.png">

Also fixed the monospace font for common graphviz renders (e.g., VS Code extensions), as described in https://github.com/rust-lang/rust/pull/76500#issuecomment-689837948

**Before:**
<img width="943" alt="Screen Shot 2020-09-09 at 2 48 44 PM" src="https://user-images.githubusercontent.com/3827298/92658939-47231680-f2ac-11ea-97ac-96727e4dd622.png">

**Now with fix:**
<img width="943" alt="Screen Shot 2020-09-09 at 2 49 02 PM" src="https://user-images.githubusercontent.com/3827298/92658959-51451500-f2ac-11ea-9aae-de982d466d6a.png">

3 years agoRollup merge of #76497 - camelid:intra-doc-links-for-core-ptr, r=jyn514
Tyler Mandry [Thu, 10 Sep 2020 04:02:33 +0000 (21:02 -0700)]
Rollup merge of #76497 - camelid:intra-doc-links-for-core-ptr, r=jyn514

Use intra-doc links in `core::ptr`

Part of #75080.

The only link that I did not change is a link to a function on the
`pointer` primitive because intra-doc links for the `pointer` primitive
don't work yet (see #63351).

---

@rustbot modify labels: A-intra-doc-links T-doc

3 years agoRollup merge of #76472 - matthiaskrgr:llvm_cmake_vars, r=Mark-Simulacrum
Tyler Mandry [Thu, 10 Sep 2020 04:02:32 +0000 (21:02 -0700)]
Rollup merge of #76472 - matthiaskrgr:llvm_cmake_vars, r=Mark-Simulacrum

rustbuild: don't set PYTHON_EXECUTABLE and WITH_POLLY cmake vars since they are no longer supported by llvm

This resolves

CMake Warning:
  Manually-specified variables were not used by the project:

    PYTHON_EXECUTABLE
    WITH_POLLY

3 years agoRollup merge of #76458 - mbrubeck:hash_drain_filter, r=Amanieu
Tyler Mandry [Thu, 10 Sep 2020 04:02:27 +0000 (21:02 -0700)]
Rollup merge of #76458 - mbrubeck:hash_drain_filter, r=Amanieu

Add drain_filter method to HashMap and HashSet

Add `HashMap::drain_filter` and `HashSet::drain_filter`, implementing part of rust-lang/rfcs#2140.  These new methods are unstable.  The tracking issue is #59618.

The added iterators behave the same as `BTreeMap::drain_filter` and `BTreeSet::drain_filter`, except their iteration order is arbitrary.  The unit tests are adapted from `alloc::collections::btree`.

This branch rewrites `HashSet` to be a wrapper around `hashbrown::HashSet` rather than `std::collections::HashMap`.
 (Both are themselves wrappers around `hashbrown::HashMap`, so the in-memory representation is the same either way.)  This lets `std` re-use more iterator code from `hashbrown`.  Without this change, we would need to duplicate much more code to implement `HashSet::drain_filter`.

This branch also updates the `hashbrown` crate to version 0.9.0.  Aside from changes related to the `DrainFilter` iterators, this version only changes features that are not used in libstd or rustc.  And it updates `indexmap` to version 1.6.0, whose only change is compatibility with `hashbrown` 0.9.0.

3 years agoRollup merge of #74787 - petrochenkov:rustllvm, r=cuviper
Tyler Mandry [Thu, 10 Sep 2020 04:02:24 +0000 (21:02 -0700)]
Rollup merge of #74787 - petrochenkov:rustllvm, r=cuviper

Move `rustllvm` into `compiler/rustc_llvm`

The `rustllvm` directory is not self-contained, it contains C++ code built by a build script of the `rustc_llvm` crate which is then linked into that crate.
So it makes sense to make `rustllvm` a part of `rustc_llvm` and move it into its directory.
I replaced `rustllvm` with more obvious `llvm-wrapper` as the subdirectory name, but something like `llvm-adapter` would work as well, other suggestions are welcome.

To make things more confusing, the Rust side of FFI functions defined in `rustllvm` can be found in `rustc_codegen_llvm` rather than in `rustc_llvm`. Perhaps they need to be moved as well, but this PR doesn't do that.

The presence of multiple LLVM-related directories in `src` (`llvm-project`, `rustllvm`, `librustc_llvm`, `librustc_codegen_llvm` and their predecessors) historically confused me and made me wonder about their purpose.
With this PR we will have LLVM itself (`llvm-project`), a FFI crate (`rustc_llvm`, kind of `llvm-sys`) and a codegen backend crate using LLVM through the FFI crate (`rustc_codegen_llvm`).

3 years agoRevert "Rollup merge of #76285 - matklad:censor-spacing, r=petrochenkov"
Tyler Mandry [Thu, 10 Sep 2020 02:18:46 +0000 (02:18 +0000)]
Revert "Rollup merge of #76285 - matklad:censor-spacing, r=petrochenkov"

This reverts commit 85cee57fd791d670d92dc61e0ad71594128dd45a, reversing
changes made to b4d387302416c90a3f70211770292d8d8ab5e07d.

3 years agoDocument btree's unwrap_unchecked
Stein Somers [Thu, 23 Jul 2020 18:15:47 +0000 (20:15 +0200)]
Document btree's unwrap_unchecked

3 years agoAuto merge of #76540 - tmandry:rollup-5ogt8x0, r=tmandry
bors [Wed, 9 Sep 2020 22:17:42 +0000 (22:17 +0000)]
Auto merge of #76540 - tmandry:rollup-5ogt8x0, r=tmandry

Rollup of 14 pull requests

Successful merges:

 - #75094 (Add `-Z combine_cgu` flag)
 - #75984 (Improve unresolved use error message)
 - #76141 (Address review comments about config.toml from rustc-dev-guide PR)
 - #76313 (Improved the MIR spanview output)
 - #76430 (Add align to rustc-attrs unstable book)
 - #76465 (Add a script to automatically update Rust/Clang versions in documentation)
 - #76473 (Add missed spaces to GCC-WARNING.txt)
 - #76481 (Convert repetitive target_pointer_width checks to const solution.)
 - #76493 (Remove a stray ignore-tidy-undocumented-unsafe)
 - #76504 (Capitalize safety comments)
 - #76515 (SessionDiagnostic: Fix non-determinism in generated format string.)
 - #76516 (Enable GitHub Releases synchronization)
 - #76522 (remove redundant clones)
 - #76523 (Remove unused PlaceContext::NonUse(NonUseContext::Coverage))

Failed merges:

r? `@ghost`

3 years agoRollup merge of #76523 - tmiasko:non-use-context-coverage, r=wesleywiser
Tyler Mandry [Wed, 9 Sep 2020 22:06:07 +0000 (15:06 -0700)]
Rollup merge of #76523 - tmiasko:non-use-context-coverage, r=wesleywiser

Remove unused PlaceContext::NonUse(NonUseContext::Coverage)

r? @richkadel / @wesleywiser

3 years agoRollup merge of #76522 - matthiaskrgr:redundant_clone, r=jonas-schievink
Tyler Mandry [Wed, 9 Sep 2020 22:06:05 +0000 (15:06 -0700)]
Rollup merge of #76522 - matthiaskrgr:redundant_clone, r=jonas-schievink

remove redundant clones

(clippy::redundant_clone)

3 years agoRollup merge of #76516 - pietroalbini:github-releases, r=Mark-Simulacrum
Tyler Mandry [Wed, 9 Sep 2020 22:06:04 +0000 (15:06 -0700)]
Rollup merge of #76516 - pietroalbini:github-releases, r=Mark-Simulacrum

Enable GitHub Releases synchronization

This PR enables the triagebot feature to automatically populate [GitHub Releases](https://github.com/rust-lang/rust/releases) for this repository based on the changelog. See https://github.com/rust-lang/triagebot/pull/811 for the implementation of this feature on triagebot's side, and more insights on how it works.

Note: once this lands people subscribed to the ~~firehose~~ rust-lang/rust repository will probably receive a ton of notifications for all the releases being created, but this should be a one-time thing.

r? @Mark-Simulacrum
cc @rust-lang/release

3 years agoRollup merge of #76515 - jumbatm:issue76496-reproducibility-regression, r=oli-obk
Tyler Mandry [Wed, 9 Sep 2020 22:06:02 +0000 (15:06 -0700)]
Rollup merge of #76515 - jumbatm:issue76496-reproducibility-regression, r=oli-obk

SessionDiagnostic: Fix non-determinism in generated format string.

Fixes #76496.

r? @oli-obk

3 years agoRollup merge of #76504 - Flying-Toast:master, r=lcnr
Tyler Mandry [Wed, 9 Sep 2020 22:06:00 +0000 (15:06 -0700)]
Rollup merge of #76504 - Flying-Toast:master, r=lcnr

Capitalize safety comments

3 years agoRollup merge of #76493 - moonheart08:unique-quick, r=jyn514
Tyler Mandry [Wed, 9 Sep 2020 22:05:59 +0000 (15:05 -0700)]
Rollup merge of #76493 - moonheart08:unique-quick, r=jyn514

Remove a stray ignore-tidy-undocumented-unsafe

There were no undocumented unsafe blocks in the file. This shouldn't require any special review.

3 years agoRollup merge of #76481 - moonheart08:vec_deque_constify, r=sfackler
Tyler Mandry [Wed, 9 Sep 2020 22:05:56 +0000 (15:05 -0700)]
Rollup merge of #76481 - moonheart08:vec_deque_constify, r=sfackler

Convert repetitive target_pointer_width checks to const solution.

Simply a quick code tidying change. Not sure if more needs to be said.

3 years agoRollup merge of #76473 - ortem:fix-gcc-warning, r=jonas-schievink
Tyler Mandry [Wed, 9 Sep 2020 22:05:54 +0000 (15:05 -0700)]
Rollup merge of #76473 - ortem:fix-gcc-warning, r=jonas-schievink

Add missed spaces to GCC-WARNING.txt

3 years agoRollup merge of #76465 - jyn514:auto-versioning, r=elichai
Tyler Mandry [Wed, 9 Sep 2020 22:05:53 +0000 (15:05 -0700)]
Rollup merge of #76465 - jyn514:auto-versioning, r=elichai

Add a script to automatically update Rust/Clang versions in documentation

From https://github.com/rust-lang/rust/pull/76402#issuecomment-687974508.

r? @elichai

3 years agoRollup merge of #76430 - pickfire:patch-7, r=steveklabnik
Tyler Mandry [Wed, 9 Sep 2020 22:05:51 +0000 (15:05 -0700)]
Rollup merge of #76430 - pickfire:patch-7, r=steveklabnik

Add align to rustc-attrs unstable book

3 years agoRollup merge of #76313 - richkadel:mir-spanview-2, r=wesleywiser
Tyler Mandry [Wed, 9 Sep 2020 22:05:49 +0000 (15:05 -0700)]
Rollup merge of #76313 - richkadel:mir-spanview-2, r=wesleywiser

Improved the MIR spanview output

* Adds missing "tail" spans (spans that continue beyond the end of
overlapping spans)
* Adds a caret to highlight empty spans associated with MIR elements
that have a position, but otherwise would not be visible.
* Adds visual pointing brackets at the beginning and end of each span

<img width="590" alt="Screen Shot 2020-09-03 at 8 38 08 PM" src="https://user-images.githubusercontent.com/3827298/92202571-25510c00-ee34-11ea-89bc-89eea939476d.png">
<img width="1061" alt="Screen Shot 2020-09-03 at 8 41 04 PM" src="https://user-images.githubusercontent.com/3827298/92202629-49145200-ee34-11ea-8fda-fc6e62c80736.png">
<img width="1113" alt="Screen Shot 2020-09-06 at 5 42 57 PM" src="https://user-images.githubusercontent.com/3827298/92339198-ca085f00-f069-11ea-96d1-c01ced50e2ba.png">
<img width="1692" alt="Screen Shot 2020-09-06 at 5 45 54 PM" src="https://user-images.githubusercontent.com/3827298/92339209-d4c2f400-f069-11ea-94c0-b4d36c200878.png">

r? @tmandry
FYI: @wesleywiser

3 years agoRollup merge of #76141 - jyn514:config.toml, r=Mark-Simulacrum
Tyler Mandry [Wed, 9 Sep 2020 22:05:47 +0000 (15:05 -0700)]
Rollup merge of #76141 - jyn514:config.toml, r=Mark-Simulacrum

Address review comments about config.toml from rustc-dev-guide PR

This info was lost in https://github.com/rust-lang/rust/pull/74334. See also https://github.com/rust-lang/rustc-dev-guide/pull/795#pullrequestreview-478197674.
r? @Mark-Simulacrum or @eddyb

3 years agoRollup merge of #75984 - kornelski:typeormodule, r=matthewjasper
Tyler Mandry [Wed, 9 Sep 2020 22:05:45 +0000 (15:05 -0700)]
Rollup merge of #75984 - kornelski:typeormodule, r=matthewjasper

Improve unresolved use error message

"use of undeclared type or module `foo`" doesn't mention that it could be a crate.

This error can happen when users forget to add a dependency to `Cargo.toml`, so I think it's important to mention that it could be a missing crate.

I've used a heuristic based on Rust's naming conventions. It complains about an unknown type if the ident starts with an upper-case letter, and crate or module otherwise. It seems to work very well. The expanded error help covers both an unknown type and a missing crate case.

3 years agoRollup merge of #75094 - 0dvictor:cgu, r=oli-obk
Tyler Mandry [Wed, 9 Sep 2020 22:05:43 +0000 (15:05 -0700)]
Rollup merge of #75094 - 0dvictor:cgu, r=oli-obk

Add `-Z combine_cgu` flag

Introduce a compiler option to let rustc combines all regular CGUs into a single one at the end of compilation.

Part of Issue #64191

3 years agoAlso fixed monospace font for d3-graphviz engine
Rich Kadel [Wed, 9 Sep 2020 21:49:32 +0000 (14:49 -0700)]
Also fixed monospace font for d3-graphviz engine

VS code graphviz extensions use d3-graphviz, which supports `Courier`
fontname but does not support `monospace`. This caused graphs to render
poorly because the text sizes were wrong.

3 years agoFix anchor links
Camelid [Wed, 9 Sep 2020 20:42:57 +0000 (13:42 -0700)]
Fix anchor links

#safety -> self#safety

3 years agoMove `rustllvm` into `rustc_llvm`
Vadim Petrochenkov [Sun, 26 Jul 2020 17:11:30 +0000 (20:11 +0300)]
Move `rustllvm` into `rustc_llvm`

3 years agoAuto merge of #74595 - lcnr:ConstEvaluatable-fut-compat, r=oli-obk
bors [Wed, 9 Sep 2020 20:04:04 +0000 (20:04 +0000)]
Auto merge of #74595 - lcnr:ConstEvaluatable-fut-compat, r=oli-obk

make `ConstEvaluatable` more strict

relevant zulip discussion: https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/.60ConstEvaluatable.60.20generic.20functions/near/204125452

Let's see how much this impacts. Depending on how this goes this should probably be a future compat warning.

Short explanation: we currently forbid anonymous constants which depend on generic types, e.g. `[0; std::mem::size_of::<T>]` currently errors.

We previously checked this by evaluating the constant and returned an error if that failed. This however allows things like
```rust
const fn foo<T>() -> usize {
    if std::mem::size_of::<*mut T>() < 8 { // size of *mut T does not depend on T
        std::mem::size_of::<T>()
    } else {
        8
    }
}

fn test<T>() {
    let _ = [0; foo::<T>()];
}
```
which is a backwards compatibility hazard. This also has worrying interactions with mir optimizations (https://github.com/rust-lang/rust/pull/74491#issuecomment-661890421) and intrinsics (#74538).

r? `@oli-obk` `@eddyb`

3 years agofix test on 32 bit systems
Bastian Kauschke [Wed, 9 Sep 2020 18:10:23 +0000 (20:10 +0200)]
fix test on 32 bit systems

3 years agoAuto merge of #73971 - ssomers:slice_slasher, r=Mark-Simulacrum
bors [Wed, 9 Sep 2020 17:40:46 +0000 (17:40 +0000)]
Auto merge of #73971 - ssomers:slice_slasher, r=Mark-Simulacrum

BTreeMap mutable iterators should not take any reference to visited nodes during iteration

Fixes #73915, overlapping mutable references during BTreeMap iteration

r? `@RalfJung`

3 years agoRemove unused PlaceContext::NonUse(NonUseContext::Coverage)
Tomasz Miąsko [Wed, 9 Sep 2020 00:00:00 +0000 (00:00 +0000)]
Remove unused PlaceContext::NonUse(NonUseContext::Coverage)

3 years agoremove redundant clones
Matthias Krüger [Wed, 9 Sep 2020 14:32:55 +0000 (16:32 +0200)]
remove redundant clones

(clippy::redundant_clone)

3 years agoAuto merge of #76445 - jyn514:doctests, r=Mark-Simulacrum,ollie27
bors [Wed, 9 Sep 2020 13:33:01 +0000 (13:33 +0000)]
Auto merge of #76445 - jyn514:doctests, r=Mark-Simulacrum,ollie27

Make rustdoc output deterministic for UI tests

Closes https://github.com/rust-lang/rust/issues/76442 (hopefully, since it's non-deterministic I don't have a way to test).

r? `@Mark-Simulacrum`
cc `@GuillaumeGomez`

3 years agoBTreeMap: avoid aliasing by avoiding slices
Stein Somers [Sun, 16 Aug 2020 17:07:30 +0000 (19:07 +0200)]
BTreeMap: avoid aliasing by avoiding slices

3 years agomake as_leaf return a raw pointer, to reduce aliasing assumptions
Ralf Jung [Thu, 2 Jul 2020 08:36:56 +0000 (10:36 +0200)]
make as_leaf return a raw pointer, to reduce aliasing assumptions

3 years agoAuto merge of #76513 - rust-lang:rust-analyzer-2020-09-09, r=jonas-schievink
bors [Wed, 9 Sep 2020 11:28:17 +0000 (11:28 +0000)]
Auto merge of #76513 - rust-lang:rust-analyzer-2020-09-09, r=jonas-schievink

:arrow_up: rust-analyzer

r? `@ghost`

3 years agoFix non-determinism in generated format string.
jumbatm [Wed, 9 Sep 2020 11:23:25 +0000 (21:23 +1000)]
Fix non-determinism in generated format string.

3 years ago:arrow_up: rust-analyzer
Jonas Schievink [Wed, 9 Sep 2020 10:41:32 +0000 (12:41 +0200)]
:arrow_up: rust-analyzer

3 years agoAuto merge of #76406 - GuillaumeGomez:create-e0774, r=pickfire,jyn514
bors [Wed, 9 Sep 2020 08:23:33 +0000 (08:23 +0000)]
Auto merge of #76406 - GuillaumeGomez:create-e0774, r=pickfire,jyn514

Create E0774

3 years agoAdd `-Z combine_cgu` flag
Victor Ding [Wed, 9 Sep 2020 04:51:16 +0000 (14:51 +1000)]
Add `-Z combine_cgu` flag

Introduce a compiler option to let rustc combines all regular CGUs into
a single one at the end of compilation.

Part of Issue #64191

3 years agoAuto merge of #76463 - camelid:improve-E0607-explanation, r=jyn514
bors [Wed, 9 Sep 2020 06:33:03 +0000 (06:33 +0000)]
Auto merge of #76463 - camelid:improve-E0607-explanation, r=jyn514

Improve wording of E0607 explanation

`@rustbot` modify labels: A-diagnostics C-enhancement

3 years agoAuto merge of #76453 - camelid:fix-css-crate-list, r=GuillaumeGomez,ollie27
bors [Wed, 9 Sep 2020 04:35:40 +0000 (04:35 +0000)]
Auto merge of #76453 - camelid:fix-css-crate-list, r=GuillaumeGomez,ollie27

rustdoc: Fix font CSS for crate lists

I had put it in the wrong file in #76126. This should fix it now. Thank
you to `@ollie27` for pointing this out!

---

`@rustbot` modify labels: T-rustdoc C-bug

3 years agoAuto merge of #76418 - jyn514:readme, r=Dylan-DPC
bors [Wed, 9 Sep 2020 02:40:27 +0000 (02:40 +0000)]
Auto merge of #76418 - jyn514:readme, r=Dylan-DPC

Move sections about contributing closer together in the README

This makes it easier to find what to do if you're interested in contributing.

3 years agoCapitalize safety comments
Flying-Toast [Wed, 9 Sep 2020 02:37:18 +0000 (22:37 -0400)]
Capitalize safety comments

3 years agoCapitalize safety comments
Flying-Toast [Wed, 9 Sep 2020 02:26:44 +0000 (22:26 -0400)]
Capitalize safety comments

3 years agoFix broken link
Camelid [Wed, 9 Sep 2020 02:24:57 +0000 (19:24 -0700)]
Fix broken link

`write` is ambiguous because there's also a macro called `write`.

Also removed unnecessary and potentially confusing link to a function in
its own docs.

3 years agoTests for HashMap/HashSet::drain_filter
Matt Brubeck [Mon, 7 Sep 2020 17:07:15 +0000 (10:07 -0700)]
Tests for HashMap/HashSet::drain_filter

3 years agoAdd HashMap::drain_filter and HashSet::drain_filter
Matt Brubeck [Mon, 10 Aug 2020 20:06:48 +0000 (13:06 -0700)]
Add HashMap::drain_filter and HashSet::drain_filter

Implements #59618.

3 years agoImplement HashSet in terms of hashbrown::HashSet
Matt Brubeck [Mon, 10 Aug 2020 23:19:54 +0000 (16:19 -0700)]
Implement HashSet in terms of hashbrown::HashSet

3 years agoUpdate to hashbrown 0.9
Matt Brubeck [Thu, 3 Sep 2020 20:32:53 +0000 (13:32 -0700)]
Update to hashbrown 0.9

3 years agoAdd -Zgraphviz_dark_mode
Rich Kadel [Tue, 8 Sep 2020 23:08:35 +0000 (16:08 -0700)]
Add -Zgraphviz_dark_mode

Many developers use a dark theme with editors and IDEs, but this
typically doesn't extend to graphviz output.

When I bring up a MIR graphviz document, the white background is
strikingly bright. This new option changes the colors used for graphviz
output to work better in dark-themed UIs.

3 years agoAuto merge of #76502 - Dylan-DPC:rollup-2c4zz0t, r=Dylan-DPC
bors [Wed, 9 Sep 2020 00:08:13 +0000 (00:08 +0000)]
Auto merge of #76502 - Dylan-DPC:rollup-2c4zz0t, r=Dylan-DPC

Rollup of 10 pull requests

Successful merges:

 - #76162 (Make duration_since documentation more clear)
 - #76355 (remove public visibility previously needed for rustfmt)
 - #76374 (Improve ayu doc source line number contrast)
 - #76379 (rustbuild: Remove `Mode::Codegen`)
 - #76389 (Fix HashMap visualizers in Visual Studio (Code))
 - #76396 (Fix typo in tracking issue template)
 - #76401 (Add help note to unconstrained const parameter)
 - #76402 (Update linker-plugin-lto.md to contain up to rust 1.46)
 - #76403 (Fix documentation for TyCtxt::all_impls)
 - #76498 (Update cargo)

Failed merges:

 - #76458 (Add drain_filter method to HashMap and HashSet)

r? `@ghost`

3 years agoRollup merge of #76498 - ehuss:update-cargo, r=ehuss
Dylan DPC [Tue, 8 Sep 2020 23:35:26 +0000 (01:35 +0200)]
Rollup merge of #76498 - ehuss:update-cargo, r=ehuss

Update cargo

8 commits in 126907a7cfccbe93778530e6a6bbaa3adb6c515c..875e0123259b0b6299903fe4aea0a12ecde9324f
2020-08-31 20:42:11 +0000 to 2020-09-08 20:17:21 +0000
- Lowercase and remove periods in error messages for consistency (rust-lang/cargo#8655)
- Allow running build-man.sh from any directory (rust-lang/cargo#8682)
- docs: add details for cargo check pass where cargo build fail (rust-lang/cargo#8677)
- Fix nightly exported_priv_warning test. (rust-lang/cargo#8678)
- fix mdbook test with ```ignore/text/sh/console (rust-lang/cargo#8674)
- End CACHEDIR.TAG with newline (rust-lang/cargo#8672)
- Fixed the fossil repo initialization actually run commands (rust-lang/cargo#8671)
- Remove asciidoc attribute in cargo-metadata man page. (rust-lang/cargo#8670)

3 years agoRollup merge of #76403 - scileo:doc-all-impls, r=lcnr
Dylan DPC [Tue, 8 Sep 2020 23:35:23 +0000 (01:35 +0200)]
Rollup merge of #76403 - scileo:doc-all-impls, r=lcnr

Fix documentation for TyCtxt::all_impls

`TyCtxt::all_impls` documentation was wrong about the return type.

3 years agoRollup merge of #76402 - elichai:patch-2, r=wesleywiser
Dylan DPC [Tue, 8 Sep 2020 23:35:22 +0000 (01:35 +0200)]
Rollup merge of #76402 - elichai:patch-2, r=wesleywiser

Update linker-plugin-lto.md to contain up to rust 1.46

Hi,
this is the same as https://github.com/rust-lang/rust/pull/72290, if anyone has suggestions on how to automate this please say :)
otherwise, you can check the versions I've added via:

```sh
$ rustup install 1.44.0
$ rustc +1.44.0 -Vv
rustc 1.44.0 (49cae5576 2020-06-01)
binary: rustc
commit-hash: 49cae55760da0a43428eba73abcb659bb70cf2e4
commit-date: 2020-06-01
host: x86_64-unknown-linux-gnu
release: 1.44.0
LLVM version: 9.0

$ rustup install 1.45.0
$ rustc +1.45.0 -Vv
rustc 1.45.0 (5c1f21c3b 2020-07-13)
binary: rustc
commit-hash: 5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2
commit-date: 2020-07-13
host: x86_64-unknown-linux-gnu
release: 1.45.0
LLVM version: 10.0

$ rustup install 1.46.0
$ rustc +stable -Vv
rustc 1.46.0 (04488afe3 2020-08-24)
binary: rustc
commit-hash: 04488afe34512aa4c33566eb16d8c912a3ae04f9
commit-date: 2020-08-24
host: x86_64-unknown-linux-gnu
release: 1.46.0
LLVM version: 10.0
```

3 years agoRollup merge of #76401 - JulianKnodt:i68366, r=lcnr
Dylan DPC [Tue, 8 Sep 2020 23:35:20 +0000 (01:35 +0200)]
Rollup merge of #76401 - JulianKnodt:i68366, r=lcnr

Add help note to unconstrained const parameter

Resolves #68366, since it is currently intended behaviour.
If demonstrating `T -> U` is injective, there should be an additional word that it is not **yet** supported.

r? @lcnr

3 years agoRollup merge of #76396 - dylni:fix-typo-in-tracking-issue-template, r=jonas-schievink
Dylan DPC [Tue, 8 Sep 2020 23:35:18 +0000 (01:35 +0200)]
Rollup merge of #76396 - dylni:fix-typo-in-tracking-issue-template, r=jonas-schievink

Fix typo in tracking issue template

3 years agoRollup merge of #76389 - MaulingMonkey:pr-natvis-hashmap-vsc, r=petrochenkov
Dylan DPC [Tue, 8 Sep 2020 23:35:17 +0000 (01:35 +0200)]
Rollup merge of #76389 - MaulingMonkey:pr-natvis-hashmap-vsc, r=petrochenkov

Fix HashMap visualizers in Visual Studio (Code)

CDB (as used in unit tests) doesn't care that we're using static_cast between unrelated types (`u8*` to `tuple<$T1, $T2>*`).
Visual Studio & Visual Studio Code care.  These should've been reinterpret_cast or C casts.

Credit to @petrochenkov per https://github.com/rust-lang/rust/issues/76352 for helping catch this.

### Testing

```cmd
x.py test --stage 1 src/tools/tidy
x.py test --stage 1 --build x86_64-pc-windows-msvc src\test\debuginfo
```

3 years agoRollup merge of #76379 - petrochenkov:nodegen, r=Mark-Simulacrum
Dylan DPC [Tue, 8 Sep 2020 23:35:15 +0000 (01:35 +0200)]
Rollup merge of #76379 - petrochenkov:nodegen, r=Mark-Simulacrum

rustbuild: Remove `Mode::Codegen`

It's no longer used.

3 years agoRollup merge of #76374 - pickfire:patch-4, r=Cldfire
Dylan DPC [Tue, 8 Sep 2020 23:35:13 +0000 (01:35 +0200)]
Rollup merge of #76374 - pickfire:patch-4, r=Cldfire

Improve ayu doc source line number contrast

Improve contrast of foreground line number.

Before

![image](https://user-images.githubusercontent.com/4687791/92305696-1bf2ab80-efbc-11ea-8b5c-a24c4f6261e0.png)

After

![image](https://user-images.githubusercontent.com/4687791/92305700-2a40c780-efbc-11ea-9061-dbfcb1e71980.png)

r? @Cldfire

I think we should add the line for light and dark theme too, it looks better and clearer that way.

3 years agoRollup merge of #76355 - calebcartwright:reduce-rustfmt-visibility, r=nikomatsakis
Dylan DPC [Tue, 8 Sep 2020 23:35:11 +0000 (01:35 +0200)]
Rollup merge of #76355 - calebcartwright:reduce-rustfmt-visibility, r=nikomatsakis

remove public visibility previously needed for rustfmt

`submod_path_from_attr` in rustc_expand::module was previously public because it was also consumed by rustfmt. However, we've done a bit of refactoring in rustfmt and no longer need to use this function.

This changes the visibility to the parent mod as was originally going to be done before the rustfmt dependency was realized (https://github.com/rust-lang/rust/commit/c189565edc5c9fc516170885b3a3061b936205fb#diff-cd1b379893bae95f7991d5a3f3c6d337R201)

3 years agoRollup merge of #76162 - abrausch:documentation-fix-duration_since, r=jyn514
Dylan DPC [Tue, 8 Sep 2020 23:35:10 +0000 (01:35 +0200)]
Rollup merge of #76162 - abrausch:documentation-fix-duration_since, r=jyn514

Make duration_since documentation more clear

3 years agoUpdate cargo
Eric Huss [Tue, 8 Sep 2020 22:10:21 +0000 (15:10 -0700)]
Update cargo

3 years agoAdjust Clippy for CONST_ITEM_MUTATION lint
Aaron Hill [Tue, 8 Sep 2020 21:59:43 +0000 (17:59 -0400)]
Adjust Clippy for CONST_ITEM_MUTATION lint

We no longer lint assignments to const item fields in the
`temporary_assignment` lint, since this is now covered by the
`CONST_ITEM_MUTATION` lint.

Additionally, we `#![allow(const_item_mutation)]` in the
`borrow_interior_mutable_const.rs` test. Clippy UI tests are run with
`-D warnings`, which seems to cause builtin lints to prevent Clippy
lints from running.

3 years agoUse intra-doc links in `core::ptr`
Camelid [Tue, 8 Sep 2020 21:36:36 +0000 (14:36 -0700)]
Use intra-doc links in `core::ptr`

The only link that I did not change is a link to a function on the
`pointer` primitive because intra-doc links for the `pointer` primitive
don't work yet (see #63351).

3 years agoMake duration_since documentation more clear
Alexander Brausch [Mon, 31 Aug 2020 14:20:24 +0000 (16:20 +0200)]
Make duration_since documentation more clear

3 years agoRemove a stray ignore-tidy-undocumented-unsafe
moonheart08 [Tue, 8 Sep 2020 20:00:47 +0000 (15:00 -0500)]
Remove a stray ignore-tidy-undocumented-unsafe
There were no undocumented unsafe blocks in the file.

3 years agoUpdate tests
Guillaume Gomez [Sat, 5 Sep 2020 12:55:15 +0000 (14:55 +0200)]
Update tests

3 years agoCreate new E0774 code error
Guillaume Gomez [Sat, 5 Sep 2020 12:55:08 +0000 (14:55 +0200)]
Create new E0774 code error

3 years agoUpdate library/alloc/src/collections/vec_deque.rs
Braden Nelson [Tue, 8 Sep 2020 18:11:08 +0000 (13:11 -0500)]
Update library/alloc/src/collections/vec_deque.rs

Replace lshift with multiply

Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
3 years agoAuto merge of #76332 - Mark-Simulacrum:bootstrap-llvm, r=pietroalbini
bors [Tue, 8 Sep 2020 16:01:26 +0000 (16:01 +0000)]
Auto merge of #76332 - Mark-Simulacrum:bootstrap-llvm, r=pietroalbini

Add rust-dev component to support rustc development

This is preparatory work for permitting rustc developers to use CI-built LLVM rather than building it locally. Unlike distro-built LLVM, CI built LLVM is essentially guaranteed to behave perfectly for local development -- it is fully up to date, and carries all necessary patches.

This is a separate PR from #76349 because it needs to land before that one, since we want a master build with the full CI LLVM to be available for easier testing.

3 years agoConvert MAXIMUM_ZST_CAPACITY to be calculated in a
moonheart08 [Tue, 8 Sep 2020 15:35:35 +0000 (10:35 -0500)]
Convert MAXIMUM_ZST_CAPACITY to be calculated in a
const instead of multiple target_pointer_width checks.

3 years agofix test
Bastian Kauschke [Tue, 8 Sep 2020 14:47:19 +0000 (16:47 +0200)]
fix test

3 years agoadd tracking issue, fix rebase
Bastian Kauschke [Tue, 1 Sep 2020 14:17:41 +0000 (16:17 +0200)]
add tracking issue, fix rebase

3 years agoadd tests
Bastian Kauschke [Thu, 6 Aug 2020 20:32:12 +0000 (22:32 +0200)]
add tests

3 years agoreview
Bastian Kauschke [Thu, 6 Aug 2020 20:12:21 +0000 (22:12 +0200)]
review

3 years agoconvert to future compat lint
Bastian Kauschke [Thu, 6 Aug 2020 08:48:36 +0000 (10:48 +0200)]
convert to future compat lint

3 years agomake `ConstEvaluatable` more strict
Bastian Kauschke [Thu, 6 Aug 2020 08:00:08 +0000 (10:00 +0200)]
make `ConstEvaluatable` more strict

3 years agoAuto merge of #76469 - RalfJung:miri, r=RalfJung
bors [Tue, 8 Sep 2020 11:56:09 +0000 (11:56 +0000)]
Auto merge of #76469 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/76337
r? `@ghost` Cc `@rust-lang/miri`

3 years agorustbuild: don't set PYTHON_EXECUTABLE and WITH_POLLY cmake vars since they are no...
Matthias Krüger [Tue, 8 Sep 2020 09:32:25 +0000 (11:32 +0200)]
rustbuild: don't set PYTHON_EXECUTABLE and WITH_POLLY cmake vars since they are no longer supported by llvm

CMake Warning:
  Manually-specified variables were not used by the project:

    PYTHON_EXECUTABLE
    WITH_POLLY

3 years agoAuto merge of #76308 - wesleywiser:enable_simplifyarmidentity_mir_opt, r=oli-obk
bors [Tue, 8 Sep 2020 09:27:23 +0000 (09:27 +0000)]
Auto merge of #76308 - wesleywiser:enable_simplifyarmidentity_mir_opt, r=oli-obk

Enable the SimplifyArmIdentity MIR optimization at mir-opt-level=1

r? `@ghost`

3 years agoAdd missed spaces to GCC-WARNING.txt
ortem [Tue, 8 Sep 2020 09:20:49 +0000 (12:20 +0300)]
Add missed spaces to GCC-WARNING.txt

3 years agoupdate Miri
Ralf Jung [Tue, 8 Sep 2020 08:50:52 +0000 (10:50 +0200)]
update Miri

3 years agotriagebot: enable github releases synchronization
Pietro Albini [Tue, 8 Sep 2020 08:43:52 +0000 (10:43 +0200)]
triagebot: enable github releases synchronization

3 years agoAuto merge of #76423 - Mark-Simulacrum:stable-bootstrap, r=jyn514
bors [Tue, 8 Sep 2020 07:08:50 +0000 (07:08 +0000)]
Auto merge of #76423 - Mark-Simulacrum:stable-bootstrap, r=jyn514

Make bootstrap build on beta

This is generally a good idea, and will help with being able to build bootstrap
without Python over time as it means we can "just" build with cargo +beta build
rather than needing the user to set environment variables. This is a minor step,
but a necessary one on that road.

r? `@jyn514`

3 years agoAuto merge of #75585 - RalfJung:demotion, r=oli-obk
bors [Tue, 8 Sep 2020 05:13:42 +0000 (05:13 +0000)]
Auto merge of #75585 - RalfJung:demotion, r=oli-obk

Do not promote &mut of a non-ZST ever

Since ~pre-1.0~ 1.36, we have accepted code like this:
```rust
static mut TEST: &'static mut [i32] = {
    let x = &mut [1,2,3];
    x
};
```
I tracked it back to https://github.com/rust-lang/rust/pull/21744, but unfortunately could not find any discussion or RFC that would explain why we thought this was a good idea. And it's not, it breaks all sorts of things -- see https://github.com/rust-lang/rust/issues/75556.

To fix https://github.com/rust-lang/rust/issues/75556, we have to stop promoting non-ZST mutable references no matter the context, which is what this PR does. It's a breaking change.

Notice that this still works, since it does not rely on promotion:
```rust
static mut TEST: &'static mut [i32] = &mut [0,1,2];
```

Cc `@rust-lang/wg-const-eval`

3 years agoAuto merge of #76210 - Mark-Simulacrum:tracing-update, r=oli-obk
bors [Tue, 8 Sep 2020 03:22:31 +0000 (03:22 +0000)]
Auto merge of #76210 - Mark-Simulacrum:tracing-update, r=oli-obk

Tracing update

This does not bring the more significant changes that are coming down the pipeline, but since I've already prepared the PR leaving it up :)

See https://github.com/rust-lang/rust/pull/76210#issuecomment-685065938:
> Unfortunately, tracing 0.1.20 — which contained the change to reduce the amount of code generated by the tracing macros — had to be yanked, as it broke previously-compiling code for some downstream crates. I've not yet had the chance to fix this and release a new patch. So, in order to benefit from the changes to reduce generated code, you'll need to wait until there's a new version of tracing as well as tracing-attributes and tracing-core.

3 years agoAdd a script to automatically update Rust/Clang versions
Joshua Nelson [Tue, 8 Sep 2020 02:06:23 +0000 (22:06 -0400)]
Add a script to automatically update Rust/Clang versions

3 years agoAdd "For example,"
Camelid [Tue, 8 Sep 2020 01:48:22 +0000 (18:48 -0700)]
Add "For example,"

3 years agoImprove wording of E0607 explanation
Camelid [Tue, 8 Sep 2020 01:25:14 +0000 (18:25 -0700)]
Improve wording of E0607 explanation

3 years agoUnstable book rust-attrs does not work on generics
Ivan Tham [Tue, 8 Sep 2020 01:08:25 +0000 (09:08 +0800)]
Unstable book rust-attrs does not work on generics

Co-authored-by: Peter Todd <pete@petertodd.org>
3 years agoAuto merge of #75138 - jumbatm:session-diagnostic-derive, r=oli-obk
bors [Tue, 8 Sep 2020 00:58:43 +0000 (00:58 +0000)]
Auto merge of #75138 - jumbatm:session-diagnostic-derive, r=oli-obk

Add derive macro for specifying diagnostics using attributes.

Introduces `#[derive(SessionDiagnostic)]`, a derive macro for specifying structs that can be converted to Diagnostics using directions given by attributes on the struct and its fields. Currently, the following attributes have been implemented:
- `#[code = "..."]` -- this sets the Diagnostic's error code, and must be provided on the struct iself (ie, not on a field). Equivalent to calling `code`.
- `#[message = "..."]` -- this sets the Diagnostic's primary error message.
- `#[label = "..."]` -- this must be applied to fields of type `Span`, and is equivalent to `span_label`
- `#[suggestion(..)]` -- this allows a suggestion message to be supplied. This attribute must be applied to a field of type `Span` or `(Span, Applicability)`, and is equivalent to calling `span_suggestion`. Valid arguments are:
    - `message = "..."` -- this sets the suggestion message.
    - (Optional) `code = "..."` -- this suggests code for the suggestion. Defaults to empty.

`suggestion`also  comes with other variants: `#[suggestion_short(..)]`, `#[suggestion_hidden(..)]` and `#[suggestion_verbose(..)]` which all take the same keys.

Within the strings passed to each attribute, fields can be referenced without needing to be passed explicitly into the format string -- eg, `#[error = "{ident} already declared"] ` will set the error message to `format!("{} already declared", &self.ident)`. Any fields on the struct can be referenced in this way.

Additionally, for any of these attributes, Option fields can be used to only optionally apply the decoration -- for example:

```rust
#[derive(SessionDiagnostic)]
#[code = "E0123"]
struct SomeKindOfError {
    ...
    #[suggestion(message = "informative error message")]
    opt_sugg: Option<(Span, Applicability)>
    ...
}
```
will not emit a suggestion if `opt_sugg` is `None`.

We plan on iterating on this macro further; this PR is a start.

Closes #61132.

r? `@oli-obk`

3 years agoMake rustdoc output deterministic for UI tests
Joshua Nelson [Tue, 8 Sep 2020 00:32:09 +0000 (20:32 -0400)]
Make rustdoc output deterministic for UI tests

3 years agoAuto merge of #76044 - ecstatic-morse:dataflow-lattice, r=oli-obk
bors [Mon, 7 Sep 2020 21:29:43 +0000 (21:29 +0000)]
Auto merge of #76044 - ecstatic-morse:dataflow-lattice, r=oli-obk

Support dataflow problems on arbitrary lattices

This PR implements last of the proposed extensions I mentioned in the design meeting for the original dataflow refactor. It extends the current dataflow framework to work with arbitrary lattices, not just `BitSet`s. This is a prerequisite for dataflow-enabled MIR const-propagation. Personally, I am skeptical of the usefulness of doing const-propagation pre-monomorphization, since many useful constants only become known after monomorphization (e.g. `size_of::<T>()`) and users have a natural tendency to hand-optimize the rest. It's probably worth exprimenting with, however, and others have shown interest cc `@rust-lang/wg-mir-opt.`

The `Idx` associated type is moved from `AnalysisDomain` to `GenKillAnalysis` and replaced with an associated `Domain` type that must implement `JoinSemiLattice`. Like before, each `Analysis` defines the "bottom value" for its domain, but can no longer override the dataflow join operator. Analyses that want to use set intersection must now use the `lattice::Dual` newtype. `GenKillAnalysis` impls have an additional requirement that `Self::Domain: BorrowMut<BitSet<Self::Idx>>`, which effectively means that they must use `BitSet<Self::Idx>` or `lattice::Dual<BitSet<Self::Idx>>` as their domain.

Most of these changes were mechanical. However, because a `Domain` is no longer always a powerset of some index type, we can no longer use an `IndexVec<BasicBlock, GenKillSet<A::Idx>>>` to store cached block transfer functions. Instead, we use a boxed `dyn Fn` trait object. I discuss a few alternatives to the current approach in a commit message.

The majority of new lines of code are to preserve existing Graphviz diagrams for those unlucky enough to have to debug dataflow analyses. I find these diagrams incredibly useful when things are going wrong and considered regressing them unacceptable, especially the pretty-printing of `MovePathIndex`s, which are used in many dataflow analyses. This required a parallel `fmt` trait used only for printing dataflow domains, as well as a refactoring of the `graphviz` module now that we cannot expect the domain to be a `BitSet`. Some features did have to be removed, such as the gen/kill display mode (which I didn't use but existed to mirror the output of the old dataflow framework) and line wrapping. Since I had to rewrite much of it anyway, I took the opportunity to switch to a `Visitor` for printing dataflow state diffs instead of using cursors, which are error prone for code that must be generic over both forward and backward analyses. As a side-effect of this change, we no longer have quadratic behavior when writing graphviz diagrams for backward dataflow analyses.

r? `@pnkfelix`

3 years agorustdoc: Fix font CSS for crate lists
Camelid [Mon, 7 Sep 2020 20:54:31 +0000 (13:54 -0700)]
rustdoc: Fix font CSS for crate lists

I had put it in the wrong file in #76126. This should fix it now. Thank
you to @ollie27 for pointing this out!