Commit graph

151816 commits

Author SHA1 Message Date
Felix S. Klock II ee2bb1f338 temporarily ignore a test until we reland PR 83171. 2021-07-21 23:03:06 -04:00
Felix S. Klock II b6e9d069eb Allow some temporarily dead code.
I expect these two methods to come back very soon; noise of removing them to satisfy lint seems wrong.
2021-07-21 22:57:10 -04:00
Felix S. Klock II cf337d1119 Revert PR 81473 to resolve (on mainline) issues 81626 and 81658.
Revert "Add missing brace"

This reverts commit 85ad773049.

Revert "Simplify base_expr"

This reverts commit 899aae465e.

Revert "Warn write-only fields"

This reverts commit d3c69a4c0d.
2021-07-21 22:49:52 -04:00
bors 602150f21f Auto merge of #86946 - Aaron1011:eval-proj-obligation, r=nikomatsakis
Improve caching during trait evaluation

Previously, we would 'forget' that we had `'static` regions in some
place during trait evaluation. This lead to us producing
`EvaluatedToOkModuloRegions` when we could have produced
`EvaluatedToOk`, causing us to perform unnecessary work.

This PR preserves `'static` regions when we canonicalize a predicate for
`evaluate_obligation`, and when we 'freshen' a predicate during trait
evaluation. Thie ensures that evaluating a predicate containing
`'static` regions can produce `EvaluatedToOk` (assuming that we
don't end up introducing any region dependencies during evaluation).

Building off of this improved caching, we use
`predicate_must_hold_considering_regions` during fulfillment of
projection predicates to see if we can skip performing additional work.
We already do this for trait predicates, but doing this for projection
predicates lead to mixed performance results without the above caching
improvements.
2021-07-21 23:18:19 +00:00
Aaron Hill 3291218f47
Improve caching during trait evaluation
Previously, we would 'forget' that we had `'static` regions in some
place during trait evaluation. This lead to us producing
`EvaluatedToOkModuloRegions` when we could have produced
`EvaluatedToOk`, causing us to perform unnecessary work.

This PR preserves `'static` regions when we canonicalize a predicate for
`evaluate_obligation`, and when we 'freshen' a predicate during trait
evaluation. Thie ensures that evaluating a predicate containing
`'static` regions can produce `EvaluatedToOk` (assuming that we
don't end up introducing any region dependencies during evaluation).

Building off of this improved caching, we use
`predicate_must_hold_considering_regions` during fulfillment of
projection predicates to see if we can skip performing additional work.
We already do this for trait predicates, but doing this for projection
predicates lead to mixed performance results without the above caching
improvements.
2021-07-21 17:54:05 -05:00
bors 32c9b7b091 Auto merge of #87351 - ehuss:rollup-pga85az, r=ehuss
Rollup of 5 pull requests

Successful merges:

 - #81864 (docs: GlobalAlloc: completely replace example with one that works)
 - #87024 (rustdoc: show count of item contents when hidden)
 - #87278 (⬆️ rust-analyzer)
 - #87326 (Update cargo)
 - #87346 (Rename force-warns to force-warn)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-21 19:50:10 +00:00
Eric Huss 43e25751ff
Rollup merge of #87346 - rylev:rename-force-warn, r=nikomatsakis
Rename force-warns to force-warn

The renames the `--force-warns` option to `--force-warn`. This mirrors other lint options like `--warn` and `--deny` which are in the singular.

r? `@nikomatsakis`

cc `@ehuss` - this option is being used by Cargo. How do we make sure the transition to using the new name is as smooth as possible?
2021-07-21 10:12:30 -07:00
Eric Huss b9e3f3d5a2
Rollup merge of #87326 - ehuss:update-cargo, r=ehuss
Update cargo

6 commits in 27277d966b3cfa454d6dea7f724cb961c036251c..4e143fd131e0c16cefd008456e974236ca54e62e
2021-07-16 00:50:39 +0000 to 2021-07-20 21:55:45 +0000
- Named profile updates (rust-lang/cargo#9685)
- Inform build scripts of rustc compiler context (rust-lang/cargo#9601)
- Factor version preferences into a struct (rust-lang/cargo#9703)
- docs: Fix sentence & update link for GitLab CI docs (rust-lang/cargo#9704)
- Deduplicate compiler diagnostics. (rust-lang/cargo#9675)
- Re-enable future-incompatible tests. (rust-lang/cargo#9698)
2021-07-21 10:12:29 -07:00
Eric Huss a0dad6bfca
Rollup merge of #87278 - lnicola:rust-analyzer-2021-07-19, r=lnicola
⬆️ rust-analyzer
2021-07-21 10:12:28 -07:00
Eric Huss 7a19fbad67
Rollup merge of #87024 - weihanglo:issue-85494, r=Manishearth
rustdoc: show count of item contents when hidden

Resolves #85494
2021-07-21 10:12:27 -07:00
Eric Huss a3e1259c4d
Rollup merge of #81864 - ijackson:globalalloc-example, r=Amanieu
docs: GlobalAlloc: completely replace example with one that works

Since this is an example, this could really do with some review from someone familiar with unsafe stuff!

I made the example no longer `no_run` since it works for me.

Fixes #81847
2021-07-21 10:12:26 -07:00
bors 05f2326c05 Auto merge of #87347 - GuillaumeGomez:rollup-ke92xxc, r=GuillaumeGomez
Rollup of 9 pull requests

Successful merges:

 - #87187 (Fix NixOS detection)
 - #87206 (avoid temporary vectors/reuse iterators)
 - #87230 (Fix docblock <table> overflow)
 - #87273 (Recognize bounds on impls as const bounds)
 - #87279 (Add comments explaining the unix command-line argument support.)
 - #87301 (Fix typo in compile.rs)
 - #87311 (Get back the more precise suggestion spans of old regionck)
 - #87321 (Add long explanation for E0722)
 - #87342 (Add long explanation for E0757)

Failed merges:

 - #87270 (Don't display <table> in item summary)

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-21 13:54:22 +00:00
Guillaume Gomez 3a8bc0d7da
Rollup merge of #87342 - midgleyc:add-E0757-long, r=GuillaumeGomez
Add long explanation for E0757

Helps with #61137
2021-07-21 15:52:53 +02:00
Guillaume Gomez 23ecb8b0cf
Rollup merge of #87321 - midgleyc:add-E0722-long, r=GuillaumeGomez
Add long explanation for E0722

Helps with #61137
2021-07-21 15:52:52 +02:00
Guillaume Gomez fc1032647b
Rollup merge of #87311 - oli-obk:nll_suggestion_span, r=estebank
Get back the more precise suggestion spans of old regionck

I noticed that when you turn on nll, the structured suggestion replaces a snippet instead of appending a snippet. It seems clearer to the user to only highlight the newly added characters instead of the entire `impl Trait` (and old regionck already does it this way).

r? ``@estebank``
2021-07-21 15:52:51 +02:00
Guillaume Gomez c6aaadc33e
Rollup merge of #87301 - chinmaydd:chinmaydd-patch-1-1, r=jyn514
Fix typo in compile.rs
2021-07-21 15:52:50 +02:00
Guillaume Gomez eb54ddd123
Rollup merge of #87279 - sunfishcode:document-unix-argv, r=RalfJung
Add comments explaining the unix command-line argument support.

Following up on #87236, add comments to the unix command-line argument
support explaining that the code doesn't mutate the system-provided
argc/argv, and that this is why the code doesn't need a lock or special
memory ordering.

r? ```@RalfJung```
2021-07-21 15:52:49 +02:00
Guillaume Gomez 1008ace95c
Rollup merge of #87273 - fee1-dead:impl-const-impl-bounds, r=oli-obk
Recognize bounds on impls as const bounds

r? ```@oli-obk```
2021-07-21 15:52:47 +02:00
Guillaume Gomez e6380a699b
Rollup merge of #87230 - GuillaumeGomez:docblock-table-overflow, r=notriddle
Fix docblock <table> overflow

Before:

![Screenshot from 2021-07-18 00-05-23](https://user-images.githubusercontent.com/3050060/126050272-ce08bc5f-74ff-4135-bc12-d708d87470cc.png)

After:

![Screenshot from 2021-07-18 00-03-55](https://user-images.githubusercontent.com/3050060/126050273-42f41b4d-ad57-4a87-91de-18e63f8504ec.png)

cc `@SergioBenitez`

r? `@notriddle`
2021-07-21 15:52:46 +02:00
Guillaume Gomez 358b2cc0b9
Rollup merge of #87206 - matthiaskrgr:clippy_collect, r=davidtwco
avoid temporary vectors/reuse iterators

Avoid collecting an interator just to re-iterate immediately.
Rather reuse the previous iterator. (clippy::needless_collect)
2021-07-21 15:52:45 +02:00
Guillaume Gomez 2861265f26
Rollup merge of #87187 - oxalica:fix-nixos-detect, r=nagisa
Fix NixOS detection

Use `/etc/os-release` instead of `/etc/NIXOS` for detection.
The latter one does not exist on NixOS when using tmpfs as root.
2021-07-21 15:52:44 +02:00
Ryan Levick 800c5f9202 Rename force-warns to force-warn 2021-07-21 15:41:10 +02:00
Chris Midgley 8b75fecedd docs: normalise wording in line with docs 2021-07-21 14:13:46 +01:00
Chris Midgley 3e981e2209 docs: add additional links for ffi_pure / ffi_const 2021-07-21 14:13:40 +01:00
Chris Midgley 27ffc3725a Add long explanation for E0757 2021-07-21 13:31:47 +01:00
Ian Jackson 03d7001564 docs: GlobalAlloc: Make example only require 4096-aligned static
Alignments > 4k are not supported,
  https://github.com/rust-lang/rust/issues/70022
  https://github.com/rust-lang/rust/issues/70144

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-07-21 12:37:59 +01:00
Chris Midgley b24d4915b8 docs: add newline before example 2021-07-21 10:58:35 +01:00
Chris Midgley adc5de601f docs: remove spurious main functions 2021-07-21 10:57:27 +01:00
Chris Midgley e09d782609 add working code example 2021-07-21 10:29:20 +01:00
bors cf932aa584 Auto merge of #86847 - tlyu:stdin-forwarders, r=joshtriplett
add `Stdin::lines`, `Stdin::split` forwarder methods

Add forwarder methods `Stdin::lines` and `Stdin::split`, which consume
and lock a `Stdin` handle, and forward on to the corresponding `BufRead`
methods. This should make it easier for beginners to use those iterator
constructors without explicitly dealing with locks or lifetimes.

Replaces #86412.
~~Based on #86846 to get the tracking issue number for the `stdio_locked` feature.~~ Rebased after merge, so it's only one commit now.

r? `@joshtriplett`
`@rustbot` label +A-io +C-enhancement +D-newcomer-roadblock +T-libs-api
2021-07-21 06:06:37 +00:00
bors ac575b64ed Auto merge of #82653 - jyn514:submodules-on-demand, r=Mark-Simulacrum
Update all submodules that rustbuild doesn't depend on lazily

This only updates the submodules the first time they're needed, instead
of unconditionally the first time you run x.py.

Ideally, this would move *all* submodules to rustbuild and not exclude some tools and
backtrace. Unfortunately, cargo requires all `Cargo.toml` files in the
whole workspace to be present to build any crate.

On my machine, this takes the time for an initial submodule clone (for
`x.py --help`) from 55.70 to 15.87 seconds.

Helps with https://github.com/rust-lang/rust/issues/76653. Builds on https://github.com/rust-lang/rust/pull/86015 and should not be merged before (only the last commit is relevant).
2021-07-21 03:36:21 +00:00
Joshua Nelson 2ac0e9b694 Update all submodules that rustbuild doesn't depend on lazily
This only updates the submodules the first time they're needed, instead
of unconditionally the first time you run x.py.

Ideally, this would move *all* submodules and not exclude some tools and
backtrace. Unfortunately, cargo requires all `Cargo.toml` files in the
whole workspace to be present to build any crate.

On my machine, this takes the time for an initial submodule clone (for
`x.py --help`) from 55.70 to 15.87 seconds.

This uses exactly the same logic as the LLVM update used, modulo some
minor cleanups:
- Use a local variable for `src.join(relative_path)`
- Remove unnecessary arrays for `book!` macro and make the macro simpler to use
- Add more comments
2021-07-20 23:07:12 -04:00
bors fabf502a7a Auto merge of #87168 - the8472:flatten-len, r=scottmcm
implement TrustedLen for Flatten/FlatMap if the U: IntoIterator == [T; N]

This only works if arrays are passed directly instead of array iterators
because we need to be sure that they have not been advanced before
Flatten does its size calculation.

resolves #87094
2021-07-20 23:47:48 +00:00
Eric Huss f4981b4aed Update cargo 2021-07-20 16:08:41 -07:00
Chris Midgley 320d049e87 Add long explanation for E0722 2021-07-20 20:30:07 +01:00
bors b41936b92c Auto merge of #87312 - ehuss:update-books, r=ehuss
Update books

## reference

6 commits in ab60513a3a5a0591e237fddff5d027a982648392..82d75cf423e4a7824fb36e73ccb18519d6900610
2021-07-05 08:27:31 -0700 to 2021-07-15 06:49:08 -0700
- fix wording/punctuation in "Lifetime bounds" (rust-lang/reference#1062)
- mention implicit `Sized` bound in more places (rust-lang/reference#1053)
-  (rust-lang/reference#1060)
- Remove inner attributes from non-block expressions. (rust-lang/reference#1051)
- Add note about the sign of the remainder (rust-lang/reference#1073)
- Clarify closure capture modes slightly (rust-lang/reference#1064)

## book

21 commits in a90f07f1e9a7fc75dc9105a6c6f16d5c13edceb0..eac55314210519238652f12b30fec9daea61f7fe
2021-07-05 14:43:12 -0400 to 2021-07-19 11:08:01 -0400
-  (rust-lang/book#2791)
- Add Deref trait to overload the deref operator in appendix table
- Revise linker installation instructions. Fixes rust-lang/book#2151.
- Clarify number literal type suffixes. Fixes rust-lang/book#1979.
- Add a note that lifetimes are coming up but aren't required
- Zip creates an iterator, not a vector. Fixes rust-lang/book#2762.
- Add Thai translation to the appendix. Connects to rust-lang/book#2636
- Derive Copy and Clone for Point to match stdlib docs example; fixes rust-lang/book#2657
- Make the definition of Option match the stdlib's, fixes rust-lang/book#2634
- Explain double quote backslash; closes rust-lang/book#2597
- Don't use the term 'anonymous struct' to fix rust-lang/book#2584
- Reword a sentence to fix rust-lang/book#2525
- Add Hindi translation. Connects to rust-lang/book#2496
- Remove unsafe Ferris designations from code. Fixes rust-lang/book#2555
- Add Traditional Chinese translation. Connects to rust-lang/book#2470
- Remove some more references to the authors field
- Make Appendix E be a link
- fix line wrapping
- remove description about the authors field
- remove the authors field
- remove the authors field

## rust-by-example

6 commits in 028f93a61500fe8f746ee7cc6b204ea6c9f42935..1db6bb483cc87ad3b424d9aba764fe622960a1be
2021-07-06 06:28:53 -0300 to 2021-07-15 06:17:42 -0300
- Updated the file destructure_tuple.md (rust-lang/rust-by-example#1452)
- Fix nomenclature around methods (rust-lang/rust-by-example#1450)
- std_misc/path.md: update `Show` to `Display` (rust-lang/rust-by-example#1449)
- Fix up github action (rust-lang/rust-by-example#1451)
- Remove github pages
- Support GitHub Actions (rust-lang/rust-by-example#1330)

## rustc-dev-guide

2 commits in 60e282559104035985331645907c3d9f842312c5..93422c21baca585dc88357ec886a48f6ddc7d665
2021-07-05 11:21:03 -0400 to 2021-07-13 12:45:58 -0400
- Update for merge of CrateDisambiguator into StableCrateId
- Minor capitalization fix (rust-lang/rustc-dev-guide#1170)

## edition-guide

8 commits in 5d57b3832f8d308a9f478ce0a69799548f27ad4d..af696ce8ea526445590ae0ca66a8128d2a95a69a
2021-07-05 10:33:32 +0200 to 2021-07-20 11:38:03 -0400
- Add migration section for panic-macro-consistency (rust-lang/edition-guide#258)
- Update transitioning chapter. (rust-lang/edition-guide#255)
- Add details on migrating the Cargo feature resolver. (rust-lang/edition-guide#259)
- Improve panic macro consistency summary (rust-lang/edition-guide#256)
- Add migration details to or-patterns guide (rust-lang/edition-guide#252)
- Add migration section to into-iterator (rust-lang/edition-guide#253)
- Add Rust 2021 prelude migration details (rust-lang/edition-guide#251)
- Provide more information about disjoint capture in closures and migration instructions (rust-lang/edition-guide#246)

## embedded-book

1 commits in 506840eb73b0749336e1d5274e16d6393892ee82..09986cd352404eb4659db44613b27cac9aa652fc
2021-06-24 00:01:32 +0000 to 2021-07-18 19:26:46 +0000
- Stop referring to the alloc crate as unstable  (rust-embedded/book#297)
2021-07-20 18:44:35 +00:00
oxalica 919a8a5028
Fix NixOS detection
Use `/etc/os-release` instead of `/etc/NIXOS`.
The latter one does not exist on NixOS when using tmpfs as root.
2021-07-21 00:38:41 +08:00
Eric Huss e74d3c708b Update books 2021-07-20 09:10:17 -07:00
bors 39d8d3ab6a Auto merge of #87247 - crlf0710:merge-libterm-into-libtest, r=nagisa
Merge libterm into libtest

I think it's quite clear at this point that rust won't stablize the current libterm APIs to the outside world. And its only user is libtest. The compiler doesn't use this api at all. So I'm merging the crate into libtest as a module.

This also allows me to remove 15% of the libterm code, since these APIs are dead-code now.
2021-07-20 16:03:47 +00:00
Oli Scherer b3594f0d1d Get back the more precise suggestion spans of old regionck 2021-07-20 15:05:51 +00:00
Ian Jackson 07e11e8495 docs: GlobalAlloc: completely replace example with one that works
Since this is an example, this could really do with some review from
someone familiar with unsafe stuff !

I made the example no longer `no_run` since it works for me.

Fixes #81847

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2021-07-20 14:49:35 +01:00
bors 5c0ca08c66 Auto merge of #87310 - spastorino:update_miri, r=RalfJung
Update MIRI

Fixes #87306

r? `@RalfJung`
2021-07-20 13:37:02 +00:00
Santiago Pastorino 70891af43f
Update MIRI 2021-07-20 09:52:19 -03:00
bors da7d405357 Auto merge of #87244 - jackh726:issue-71883, r=estebank
Better diagnostics with mismatched types due to implicit static lifetime

Fixes #78113

I think this is my first diagnostics PR...definitely happy to hear thoughts on the direction/implementation here.

I was originally just trying to solve the error above, where the lifetime on a GAT was causing a cryptic "mismatched types" error. But as I was writing this, I realized that this (unintentionally) also applied to a different case: `wf-in-foreign-fn-decls-issue-80468.rs`. I'm not sure if this diagnostic should get a new error code, or even reuse an existing one. And, there might be some ways to make this even more generalized. Also, the error is a bit more lengthy and verbose than probably needed. So thoughts there are welcome too.

This PR essentially ended up adding a new nice region error pass that triggers if a type doesn't match the self type of an impl which is selected because of a predicate because of an implicit static bound on that self type.

r? `@estebank`
2021-07-20 10:56:08 +00:00
bors 718d53b0cb Auto merge of #87224 - RalfJung:miri-ptr-oob, r=oli-obk
miri: better ptr-out-of-bounds errors

For offsets larger than `isize::MAX`, display them as negative offsets.

r? `@oli-obk`
2021-07-20 08:15:15 +00:00
bors a72c360a30 Auto merge of #87141 - spastorino:remove_impl_trait_in_bindings, r=oli-obk
Remove impl trait in bindings

Closes #86729

r? `@oli-obk`
2021-07-20 05:34:22 +00:00
jackh726 ae02491984 Better errors when we don't have implicit statics in trait objects 2021-07-19 23:46:11 -04:00
Chinmay Deshpande 64f4e34d69
Fix typo in compile.rs 2021-07-19 20:03:03 -07:00
bors c9aa2595d9 Auto merge of #84959 - camsteffen:lint-suggest-group, r=estebank
Suggest lint groups

Fixes rust-lang/rust-clippy#6986
2021-07-20 02:11:55 +00:00
bors 6535449a00 Auto merge of #87284 - Aaron1011:remove-paren-special, r=petrochenkov
Remove special case for `ExprKind::Paren` in `MutVisitor`

The special case breaks several useful invariants (`ExpnId`s are
globally unique, and never change). This special case
was added back in 2016 in https://github.com/rust-lang/rust/pull/34355

r? `@petrochenkov`
2021-07-19 23:50:23 +00:00