Commit graph

151931 commits

Author SHA1 Message Date
The8472
e015e9da71 implement fold() on array::IntoIter to improve flatten().collect() perf
```
# old
test vec::bench_flat_map_collect                         ... bench:   2,244,024 ns/iter (+/- 18,903)

# new
test vec::bench_flat_map_collect                         ... bench:     172,863 ns/iter (+/- 2,141)
```
2021-07-24 19:24:11 +02:00
bors
18840b0719 Auto merge of #87296 - Aaron1011:inert-warn, r=petrochenkov
Warn on inert attributes used on bang macro invocation

These attributes are currently discarded.
This may change in the future (see #63221), but for now,
placing inert attributes on a macro invocation does nothing,
so we should warn users about it.

Technically, it's possible for there to be attribute macro
on the same macro invocation (or at a higher scope), which
inspects the inert attribute. For example:

```rust
#[look_for_inline_attr]
#[inline]
my_macro!()

#[look_for_nested_inline]
mod foo { #[inline] my_macro!() }
```

However, this would be a very strange thing to do.
Anyone running into this can manually suppress the warning.
2021-07-24 13:19:17 +00:00
bors
f9b95f92c8 Auto merge of #86461 - crlf0710:rich_vtable, r=nikomatsakis
Refactor vtable format for upcoming trait_upcasting feature.

This modifies vtable format:
1. reordering occurrence order of methods coming from different traits
2. include `VPtr`s for supertraits where this vtable cannot be directly reused during trait upcasting.
Also, during codegen, the vtables corresponding to these newly included `VPtr` will be requested and generated.

For the cases where this vtable can directly used, now the super trait vtable has exactly the same content to some prefix of this one.

r? `@bjorn3`
cc `@RalfJung`
cc `@rust-lang/wg-traits`
2021-07-24 10:21:23 +00:00
bors
1c66d11a34 Auto merge of #84589 - In-line:zircon-thread-name, r=JohnTitor
Implement setting thread name for Fuchsia
2021-07-24 07:40:34 +00:00
bors
7d8e7b14a7 Auto merge of #87415 - Mark-Simulacrum:bump-version, r=Mark-Simulacrum
Bump to 1.56

r? `@pietroalbini`
2021-07-24 04:59:29 +00:00
bors
d03456db5c Auto merge of #87338 - SparrowLii:MaybeTrait, r=wesleywiser
Simplify the collecting of `? Trait` bounds in where clause

This PR fixes the FIXME about using less rightward drift and only one error reporting when collecting of `?Trait` bounds in where clause.
Checking whether the path length of `bound_ty` is 1 can be replaced by whether `unresolved_segments` in the partial_res is 0.
Checking whether the `param.kind` is `Type{...}` can also be omitted. One Fx hash calculation will be done for Const or Lifetime param, but the impact on efficiency should be small IMO
2021-07-24 02:30:35 +00:00
bors
3b4a0dfc13 Auto merge of #86429 - JohnTitor:get-by-key-enum-part-2, r=oli-obk
Improve `get_by_key_enumerated` more

Follow-up of #86392, this applies the suggestions by `@m-ou-se.`

r? `@m-ou-se`
2021-07-23 23:17:38 +00:00
Mark Rousskov
ca1599ce89 Bump to 1.56 2021-07-23 17:04:59 -04:00
bors
67b03007cf Auto merge of #87413 - JohnTitor:rollup-dht22jk, r=JohnTitor
Rollup of 14 pull requests

Successful merges:

 - #86410 (VecMap::get_value_matching should return just one element)
 - #86790 (Document iteration order of `retain` functions)
 - #87171 (Remove Option from BufWriter)
 - #87175 (Stabilize `into_parts()` and `into_error()`)
 - #87185 (Fix panics on Windows when the build was cancelled)
 - #87191 (Package LLVM libs for the target rather than the build host)
 - #87255 (better support for running libcore tests with Miri)
 - #87266 (Add testcase for 87076)
 - #87283 (Add `--codegen-backends=foo,bar` configure flag)
 - #87322 (fix: clarify suggestion that `&T` must refer to `T: Sync` for `&T: Send`)
 - #87358 (Fix `--dry-run` when download-ci-llvm is set)
 - #87380 (Don't default to `submodules = true` unless the rust repo has a .git directory)
 - #87398 (Add test for fonts used for module items)
 - #87412 (Add missing article)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-23 20:26:33 +00:00
Yuki Okushi
a6515816a6
Rollup merge of #87412 - r00ster91:patch-13, r=Mark-Simulacrum
Add missing article

Redo of #87305. I messed up in that PR and wasn't sure how to fix it.
2021-07-24 04:31:15 +09:00
Yuki Okushi
57ea2d8bb1
Rollup merge of #87398 - GuillaumeGomez:test-font-module-items, r=notriddle
Add test for fonts used for module items

Fixes #85632.

r? `@notriddle`
2021-07-24 04:31:14 +09:00
Yuki Okushi
f709999161
Rollup merge of #87380 - jyn514:smarter-submodule-defaults, r=Mark-Simulacrum
Don't default to `submodules = true` unless the rust repo has a .git directory

Should hopefully fix https://github.com/rust-lang/rust/pull/82653#issuecomment-885093033 - `@semarie` can you confirm?

r? `@Mark-Simulacrum`
2021-07-24 04:31:13 +09:00
Yuki Okushi
1b9cd8bbb8
Rollup merge of #87358 - jyn514:dry-run, r=Mark-Simulacrum
Fix `--dry-run` when download-ci-llvm is set

Previously it would error out:

```
$ x check --dry-run
thread 'main' panicked at 'std::fs::read_to_string(ci_llvm.join("link-type.txt")) failed with No such file or directory (os error 2) ("CI llvm missing: /home/joshua/rustc3/build/tmp-dry-run/x86_64-unknown-linux-gnu/ci-llvm")', src/bootstrap/config.rs:795:33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Build completed unsuccessfully in 0:00:10
```
2021-07-24 04:31:12 +09:00
Yuki Okushi
3fc79fde63
Rollup merge of #87322 - chazkiker2:fix/suggestion-ref-sync-send, r=estebank
fix: clarify suggestion that `&T` must refer to `T: Sync` for `&T: Send`

### Description

- [x] fix #86507
- [x] add UI test for relevant code from issue
- [x] change `rustc_trait_selection/src/traits/error_reporting/suggestions.rs` to include a more clear suggestion when `&T` fails to satisfy `Send` bounds due to the fact that `T` fails to implement `Sync`
- [x] update UI test in Clippy: `src/tools/tests/ui/future_not_send.stderr`
2021-07-24 04:31:11 +09:00
Yuki Okushi
82a14e57e7
Rollup merge of #87283 - pietroalbini:configure-codegen-backends, r=Mark-Simulacrum
Add `--codegen-backends=foo,bar` configure flag

Unfortunately this requires a proper `./configure` flag, as the codegen backends config entry is a list, not a string (breaking `--set`).
2021-07-24 04:31:10 +09:00
Yuki Okushi
8b89c3240b
Rollup merge of #87266 - hellow554:issue87076, r=Mark-Simulacrum
Add testcase for 87076

Closes #87076

I also moved the issue tests into the issues subfolder, nothing changed there.
2021-07-24 04:31:09 +09:00
Yuki Okushi
1a2b90bc91
Rollup merge of #87255 - RalfJung:miri-test-libcore, r=Mark-Simulacrum
better support for running libcore tests with Miri

See https://github.com/rust-lang/miri-test-libstd/issues/4 for a description of the problem that this fixes.
Thanks to `@hyd-dev` for suggesting this patch!
2021-07-24 04:31:07 +09:00
Yuki Okushi
aca83f1ab8
Rollup merge of #87191 - adamgemmell:dev/llvm-lib-package, r=Mark-Simulacrum
Package LLVM libs for the target rather than the build host

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

`dist.rs` uses, in the `rust-dev` stage, `llvm-config --libfiles` to get a list of the LLVM library files built but of course only for the build host. If the target differs we want to package lib files from the target's build tree instead. This is done by splitting/rejoining the paths on their build directories.

At the moment `tree` on the LLVM build directories seems to give almost identical output, but of course this might not be the case in the future. If a file is missing in the target's build tree then this stage will error in the `builder.install()` call. If the target build tree has an extra file then it silently won't be copied and we'll get a linker error when building using this artifact (via `download-ci-llvm = "if-available"`), though we would have received a linker error anyway without this change.

There was also a typo in the example config around this option.
2021-07-24 04:31:06 +09:00
Yuki Okushi
ba869da889
Rollup merge of #87185 - waterlens:issue-86499-fix, r=Mark-Simulacrum
Fix panics on Windows when the build was cancelled

Fixes #86499

cc `@jyn514`
2021-07-24 04:31:05 +09:00
Yuki Okushi
f335bca8a5
Rollup merge of #87175 - inquisitivecrystal:inner-error, r=kennytm
Stabilize `into_parts()` and `into_error()`

This stabilizes `IntoInnerError`'s `into_parts()` and `into_error()` methods, currently gated behind the `io_into_inner_error_parts` feature. The FCP has [already completed.](https://github.com/rust-lang/rust/issues/79704#issuecomment-880652967)

Closes #79704.
2021-07-24 04:31:04 +09:00
Yuki Okushi
2038fa5849
Rollup merge of #87171 - Alexendoo:bufwriter-option, r=Mark-Simulacrum
Remove Option from BufWriter

Fixes #72925
2021-07-24 04:31:03 +09:00
Yuki Okushi
249a11f936
Rollup merge of #86790 - janikrabe:retain-iter-order-doc, r=m-ou-se
Document iteration order of `retain` functions

For `HashSet` and `HashMap`, this simply copies the comment from
`BinaryHeap::retain`.

For `BTreeSet` and `BTreeMap`, this adds an additional guarantee that
wasn't previously documented. I think that because these data structures
are inherently ordered and other functions guarantee ordered iteration,
it makes sense to provide this guarantee for `retain` as well.
2021-07-24 04:30:56 +09:00
Yuki Okushi
d4532903b0
Rollup merge of #86410 - spastorino:get_value_matching, r=oli-obk
VecMap::get_value_matching should return just one element

r? `@nikomatsakis`

Related to #86465 and #87287
2021-07-24 04:30:56 +09:00
chaz-kiker
a1518f0915 update clippy ui test 'future_not_send.stderr' to match
the new diagnostic messages
2021-07-23 12:55:13 -05:00
bors
4a1f419e64 Auto merge of #87345 - Xanewok:update-rls, r=Mark-Simulacrum
Unbreak and update RLS

Closes #86905
Closes #86606
Closes #86607

This also prunes old mio 0.6 thanks to Tokio 1.0 bump, so this should now build on aarch64 Windows.

r? `@Mark-Simulacrum`
2021-07-23 17:40:13 +00:00
r00ster
97721a1c37
Add missing article 2021-07-23 19:02:52 +02:00
bors
0443424954 Auto merge of #87400 - JohnTitor:rollup-zbwyuxi, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #87034 (DOC: fix hypothetical Rust code in `step_by()` docstring)
 - #87298 (memorialize Anna Harren in the bastion of the turbofish)
 - #87332 (Don't hide fields of enum struct variants)
 - #87362 (Make `x.py d` an alias for `x.py doc`)
 - #87372 (Move calls to test_main into one function)
 - #87373 (Extend HIR WF checking to fields)
 - #87376 (Change rustdoc logo to use the full container size)
 - #87383 (Add regression tests for the impl_trait_in_bindings ICEs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-23 12:33:58 +00:00
Mark Rousskov
a44abe58ea Add missing winapi feature to workspace hack 2021-07-23 08:15:40 -04:00
Santiago Pastorino
c79df8563b
Add ConstraintLocator docs 2021-07-23 08:55:31 -03:00
Santiago Pastorino
d71410757d
Add VecMap::get_value_matching and assert if > 1 element
Otherwise is a bug that we want to uncover.
2021-07-23 08:44:23 -03:00
Yuki Okushi
7c0c329635
Rollup merge of #87383 - Alexendoo:impl_trait_in_bindings-tests, r=oli-obk
Add regression tests for the impl_trait_in_bindings ICEs

Closes #54600, closes #54840, closes #58504, closes #58956, closes #70971, closes #79099, closes #84919, closes #86201, closes #86642, closes #87295

r? ``@oli-obk``
2021-07-23 19:27:51 +09:00
Yuki Okushi
fe5799c399
Rollup merge of #87376 - Thomasdezeeuw:rustdoc-large-logo, r=GuillaumeGomez
Change rustdoc logo to use the full container size

We have a logo in svg that scales nicely to large sizes, but by default
is only 5px large, i.e. very small. With the change the logo expands to
the full size. By only setting the height to 100% we ensure that the
width-height ratio isn't changed.
2021-07-23 19:27:49 +09:00
Yuki Okushi
1e33d13d39
Rollup merge of #87373 - Aaron1011:hir-wf-field, r=estebank
Extend HIR WF checking to fields

r? ``@estebank``
2021-07-23 19:27:48 +09:00
Yuki Okushi
7c2436ad34
Rollup merge of #87372 - GuillaumeGomez:move-test_main-calls, r=jyn514
Move calls to test_main into one function

Fixes #86254.

cc ``@jyn514``
r? ``@camelid``
2021-07-23 19:27:47 +09:00
Yuki Okushi
a247257955
Rollup merge of #87362 - inquisitivecrystal:bootstrap-doc, r=jyn514
Make `x.py d` an alias for `x.py doc`

In rust-lang/cargo#9680, `d` was added to Cargo as an alias for `doc`. This PR adds the same alias to `x.py`. The same considerations of convenience that applied to Cargo also apply to `x.py`, and in any case, the two should be kept symmetrical.
2021-07-23 19:27:46 +09:00
Yuki Okushi
377bb73989
Rollup merge of #87332 - camelid:dont-hide-fields, r=GuillaumeGomez
Don't hide fields of enum struct variants

* The toggle adds visual clutter
* It's easy to miss that there are fields
* Tuple variant fields are always shown, so it is inconsistent to hide
  struct variant fields
* It's annoying to have to click the toggle every time
2021-07-23 19:27:45 +09:00
Yuki Okushi
0faf5e0451
Rollup merge of #87298 - boringcactus:patch-2, r=steveklabnik
memorialize Anna Harren in the bastion of the turbofish

this seems fitting, at least to me.
2021-07-23 19:27:44 +09:00
Yuki Okushi
ba6957c9fb
Rollup merge of #87034 - mgeier:doc-step_by, r=JohnTitor
DOC: fix hypothetical Rust code in `step_by()` docstring

I don't know how important that is, but if I'm not mistaken, the hypothetical code in the docstring of `step_by()` (see https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.step_by) isn't correct.

I guess writing `next()` instead of `self.next()` isn't a biggie, but this would also imply that `advance_n_and_return_first()` is a method, which AFAICT it isn't.

I've also done some re-formatting in a separate commit and a parameter renaming in yet another commit.

Feel free to take or leave any combination of those commits.
2021-07-23 19:27:43 +09:00
Guillaume Gomez
327eef999e Add test for fonts used for module items 2021-07-23 11:41:21 +02:00
Yuki Okushi
6761826b1b
Sort features alphabetically 2021-07-23 18:08:26 +09:00
Yuki Okushi
8d00be9980
Use map_while instead of take_while + map 2021-07-23 18:04:28 +09:00
Yuki Okushi
cb3b3cf6ab
Improve get_by_key_enumerated more 2021-07-23 18:04:21 +09:00
bors
b2b7c859c1 Auto merge of #87287 - oli-obk:fixup_fixup_fixup_opaque_types, r=spastorino
Make mir borrowck's use of opaque types independent of the typeck query's result

fixes #87218
fixes #86465

we used to use the typeck results only to generate an obligation for the mir borrowck type to be equal to the typeck result.

When i removed the `fixup_opaque_types` function in #87200, I exposed a bug that showed that mir borrowck can't doesn't get enough information from typeck in order to build the correct lifetime mapping from opaque type usage to the actual concrete type. We therefor now fully compute the information within mir borrowck (we already did that, but we only used it to verify the typeck result) and stop using the typeck information.

We will likely be able to remove most opaque type information from the borrowck results in the future and just have all current callers use the mir borrowck result instead.

r? `@spastorino`
2021-07-23 03:40:26 +00:00
chaz-kiker
831ac19639 Squash all commits.
add test for issue 86507

add stderr for issue 86507

update issue-86507 UI test

add comment for the expected error in UI test file

add proper 'refers to <ref_type>' in suggestion

update diagnostic phrasing; update test to match new phrasing; re-organize logic for checking T: Sync

evaluate additional obligation to figure out if T is Sync

run './x.py test tidy --bless'

incorporate changes from review; reorganize logic for readability
2021-07-22 15:42:42 -05:00
Alex Macleod
8837bf1acd Remove Option from BufWriter
Fixes #72925
2021-07-22 20:59:06 +01:00
Noah Lev
97623bf051 Don't hide fields of enum struct variants
* The toggle adds visual clutter
* It's easy to miss that there are fields
* Tuple variant fields are always shown, so it is inconsistent to hide
  struct variant fields
* It's annoying to have to click the toggle every time
2021-07-22 12:52:33 -07:00
Alex Macleod
470d378646 Add regression tests for the impl_trait_in_bindings ICEs 2021-07-22 19:43:29 +01:00
bors
027187094e Auto merge of #86212 - pnkfelix:mainline-targetted-revert-81473-warn-write-only-fields, r=simulacrum
Revert PR 81473 to resolve (on mainline) issues 81626 and 81658.

This is a nightly-targetted variant of PR #83171

The intent is to just address issue #81658 on all release channels, rather that keep repeatedly reverting PR #83171 on beta.

However, our intent is *also* to reland PR #83171 after we have addressed issue #81658 , most likely by coupling the re-landing of PR #83171 with an enhancement like PR #83004
2021-07-22 18:41:27 +00:00
Joshua Nelson
6194cc8f48 Don't default to submodules = true unless the rust repo has a .git directory 2021-07-22 14:20:46 -04:00
Thomas de Zeeuw
49b1be2c32 Change rustdoc logo to use the full container size
We have a logo in svg that scales nicely to large sizes, but by default
is only 5px large, i.e. very small. With the change the logo expands to
the full size. By only setting the height to 100% we ensure that the
width-height ratio isn't changed.
2021-07-22 18:05:06 +02:00