Commit graph

127115 commits

Author SHA1 Message Date
Tyler Mandry
d013e60ad4
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
2020-09-09 21:02:33 -07:00
Tyler Mandry
9fa0794203
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
2020-09-09 21:02:32 -07:00
Tyler Mandry
fa56cf537f
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.
2020-09-09 21:02:27 -07:00
Tyler Mandry
f09372ab60
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`).
2020-09-09 21:02:24 -07:00
Andrew Lilley Brinker
01bf35010f Reword trivial_casts lint to better explain.
The current description of the trivial casts lint under the "allowed
by default" listing in the rustc book indicates the lint is for lints
which may be removed, which is less clear than saying it's for lints
which may be replaced by coercion (which is the wording used by the
error message included in the doc).

This commit changes the wording slightly to better describe what the
lint does.
2020-09-09 19:36:15 -07:00
Tyler Mandry
fdff7defc9 Revert "Rollup merge of #76285 - matklad:censor-spacing, r=petrochenkov"
This reverts commit 85cee57fd7, reversing
changes made to b4d3873024.
2020-09-10 02:18:46 +00:00
Tomasz Miąsko
00e64ba476 Validate removal of AscribeUserType, FakeRead, and Shallow borrow
Those statements are removed by CleanupNonCodegenStatements pass
in drop lowering phase, and should not occur afterwards.
2020-09-10 00:00:00 +00:00
Stein Somers
f42dac0ce0 Document btree's unwrap_unchecked 2020-09-10 00:25:59 +02:00
bors
97eb606e4b 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`
2020-09-09 22:17:42 +00:00
Tyler Mandry
32714eb6bc
Rollup merge of #76523 - tmiasko:non-use-context-coverage, r=wesleywiser
Remove unused PlaceContext::NonUse(NonUseContext::Coverage)

r? @richkadel / @wesleywiser
2020-09-09 15:06:07 -07:00
Tyler Mandry
09c614948f
Rollup merge of #76522 - matthiaskrgr:redundant_clone, r=jonas-schievink
remove redundant clones

(clippy::redundant_clone)
2020-09-09 15:06:05 -07:00
Tyler Mandry
09a364e984
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
2020-09-09 15:06:04 -07:00
Tyler Mandry
98f59bc2aa
Rollup merge of #76515 - jumbatm:issue76496-reproducibility-regression, r=oli-obk
SessionDiagnostic: Fix non-determinism in generated format string.

Fixes #76496.

r? @oli-obk
2020-09-09 15:06:02 -07:00
Tyler Mandry
c18fa460a4
Rollup merge of #76504 - Flying-Toast:master, r=lcnr
Capitalize safety comments
2020-09-09 15:06:00 -07:00
Tyler Mandry
342b406285
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.
2020-09-09 15:05:59 -07:00
Tyler Mandry
0d20cf8568
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.
2020-09-09 15:05:56 -07:00
Tyler Mandry
09bfb7ea2b
Rollup merge of #76473 - ortem:fix-gcc-warning, r=jonas-schievink
Add missed spaces to GCC-WARNING.txt
2020-09-09 15:05:54 -07:00
Tyler Mandry
df84ac74bd
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
2020-09-09 15:05:53 -07:00
Tyler Mandry
d0c2a2d37c
Rollup merge of #76430 - pickfire:patch-7, r=steveklabnik
Add align to rustc-attrs unstable book
2020-09-09 15:05:51 -07:00
Tyler Mandry
bab09684b4
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
2020-09-09 15:05:49 -07:00
Tyler Mandry
b4b8a52dcc
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
2020-09-09 15:05:47 -07:00
Tyler Mandry
5ea55518bc
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.
2020-09-09 15:05:45 -07:00
Tyler Mandry
07dbe49ce9
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
2020-09-09 15:05:43 -07:00
Stein Somers
2b54ab880c BTreeMap: pull the map's root out of NodeRef 2020-09-10 00:02:54 +02:00
Rich Kadel
f7aee330c7 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.
2020-09-09 14:49:32 -07:00
Camelid
884a1b4b9b Fix anchor links
#safety -> self#safety
2020-09-09 13:42:57 -07:00
Vadim Petrochenkov
10d3f8a484 Move rustllvm into rustc_llvm 2020-09-09 23:05:43 +03:00
bors
e2be5f568d 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`
2020-09-09 20:04:04 +00:00
carbotaniuman
bb57c9f91c Format 2020-09-09 13:44:22 -05:00
carbotaniuman
8f43fa0989 Add WeakInner<'_> and have Weak::inner() return it
This avoids overlapping a reference covering the data field,
which may be changed due in concurrent conditions. This fully
fixed the UB mainfested with `new_cyclic`.
2020-09-09 13:39:48 -05:00
Bastian Kauschke
74e07198a0 fix test on 32 bit systems 2020-09-09 20:10:23 +02:00
bors
d92155bf6a 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`
2020-09-09 17:40:46 +00:00
carbotaniuman
493c037699 Eliminate mut reference UB in Drop impl for Rc<T>
This changes `self.ptr.as_mut()` with `get_mut_unchecked` which
does not use an intermediate reference.  Arc<T> already handled this
case properly.
2020-09-09 12:14:18 -05:00
Mara Bos
43c7a9b72b Fix broken doc links in MaybeUninit. 2020-09-09 18:56:16 +02:00
Mara Bos
a94b2cb034 Add safety docs about T's invariants in MaybeUninit::assume_init_drop. 2020-09-09 18:55:36 +02:00
Matthias Krüger
de195f2d3d print the unit type () in related lint messages. 2020-09-09 17:59:13 +02:00
Tomasz Miąsko
0016405073 Remove unused PlaceContext::NonUse(NonUseContext::Coverage) 2020-09-09 17:02:19 +02:00
Matthias Krüger
4db10297c1 link to the Box docs in related lint documentation. 2020-09-09 16:54:24 +02:00
Matthias Krüger
be28b6235e remove redundant clones
(clippy::redundant_clone)
2020-09-09 16:32:55 +02:00
bors
b4bdc07ff5 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`
2020-09-09 13:33:01 +00:00
Stein Somers
8158d5623e BTreeMap: avoid aliasing by avoiding slices 2020-09-09 08:58:02 -04:00
Ralf Jung
7889373730 make as_leaf return a raw pointer, to reduce aliasing assumptions 2020-09-09 08:38:34 -04:00
Hameer Abbasi
5d7e7c25e4 Add revisions to const generic issue UI tests. 2020-09-09 13:28:41 +02:00
bors
683d1bcd40 Auto merge of #76513 - rust-lang:rust-analyzer-2020-09-09, r=jonas-schievink
⬆️ rust-analyzer

r? `@ghost`
2020-09-09 11:28:17 +00:00
jumbatm
8b392505ae Fix non-determinism in generated format string. 2020-09-09 21:23:25 +10:00
Jonas Schievink
e215e7901e ⬆️ rust-analyzer 2020-09-09 12:41:32 +02:00
Mara Bos
a14efd1d0a Rename MaybeUninit::read to assume_init_read. 2020-09-09 11:27:42 +02:00
Mara Bos
656a17b44d Rename MaybeUninit::drop to assume_init_drop. 2020-09-09 11:27:09 +02:00
bors
3f5e617e36 Auto merge of #76406 - GuillaumeGomez:create-e0774, r=pickfire,jyn514
Create E0774
2020-09-09 08:23:33 +00:00
Victor Ding
c81b43d8ac 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
2020-09-09 17:32:23 +10:00