]> git.lizzy.rs Git - rust.git/log
rust.git
22 months agoRollup merge of #99386 - AngelicosPhosphoros:add_retain_test_maybeuninit, r=JohnTitor
Dylan DPC [Mon, 22 Aug 2022 06:15:41 +0000 (11:45 +0530)]
Rollup merge of #99386 - AngelicosPhosphoros:add_retain_test_maybeuninit, r=JohnTitor

Add tests that check `Vec::retain` predicate execution order.

This behaviour is documented for `Vec::retain` which means that there is code that rely on that but there weren't tests about that.

22 months agoRollup merge of #93162 - camsteffen:std-prim-docs, r=Mark-Simulacrum
Dylan DPC [Mon, 22 Aug 2022 06:15:40 +0000 (11:45 +0530)]
Rollup merge of #93162 - camsteffen:std-prim-docs, r=Mark-Simulacrum

Std module docs improvements

My primary goal is to create a cleaner separation between primitive types and primitive type helper modules (fixes #92777). I also changed a few header lines in other top-level std modules (seen at https://doc.rust-lang.org/std/) for consistency.

Some conventions used/established:

 * "The \`Box\<T>` type for heap allocation." - if a module mainly provides a single type, name it and summarize its purpose in the module header
 * "Utilities for the _ primitive type." - this wording is used for the header of helper modules
 * Documentation for primitive types themselves are removed from helper modules
 * provided-by-core functionality of primitive types is documented in the primitive type instead of the helper module (such as the "Iteration" section in the slice docs)

I wonder if some content in `std::ptr` should be in `pointer` but I did not address this.

22 months agoAuto merge of #100671 - Xiretza:tidy-fluent-files, r=davidtwco
bors [Mon, 22 Aug 2022 03:02:50 +0000 (03:02 +0000)]
Auto merge of #100671 - Xiretza:tidy-fluent-files, r=davidtwco

tidy: check fluent files for style

Inspired by https://github.com/rust-lang/rust/pull/100651#discussion_r947600576

There were a lot of line length violations, so I've excepted that lint - I'm not sure if fluent files can be formatted to avoid long lines at all.

22 months agoAuto merge of #100668 - nnethercote:use-AttrVec-more, r=spastorino
bors [Mon, 22 Aug 2022 00:34:02 +0000 (00:34 +0000)]
Auto merge of #100668 - nnethercote:use-AttrVec-more, r=spastorino

Use `AttrVec` more

In some places we use `Vec<Attribute>` and some places we use
`ThinVec<Attribute>` (a.k.a. `AttrVec`). This results in various points
where we have to convert between `Vec` and `ThinVec`.

This commit changes the places that use `Vec<Attribute>` to use
`AttrVec`. A lot of this is mechanical and boring, but there are
some interesting parts:
- It adds a few new methods to `ThinVec`.
- It implements `MapInPlace` for `ThinVec`, and introduces a macro to
  avoid the repetition of this trait for `Vec`, `SmallVec`, and
  `ThinVec`.

Overall, it makes the code a little nicer, and has little effect on
performance. But it is a precursor to removing
`rustc_data_structures::ThinVec` and replacing it with
`thin_vec::ThinVec`, which is implemented more efficiently.

r? `@spastorino`

22 months agoAuto merge of #100654 - compiler-errors:rework-point-at-arg, r=estebank
bors [Sun, 21 Aug 2022 21:52:56 +0000 (21:52 +0000)]
Auto merge of #100654 - compiler-errors:rework-point-at-arg, r=estebank

Rework "point at arg" suggestions to be more accurate

Fixes #100560

Introduce a new set of `ObligationCauseCode`s which have additional bookeeping for what expression caused the obligation, and which predicate caused the obligation. This allows us to look at the _unsubstituted_ signature to find out which parameter or generic type argument caused an obligaton to fail.

This means that (in most cases) we significantly improve the likelihood of pointing out the right argument that causes a fulfillment error. Also, since this logic isn't happening in just the `select_where_possible_and_mutate_fulfillment()` calls in the argument checking code, but instead during all trait selection in `FnCtxt`, we are also able to point out the correct argument even if inference means that we don't know whether an obligation has failed until well after a call expression has been checked.

r? `@ghost`

22 months agoUse `AttrVec` in more places.
Nicholas Nethercote [Wed, 17 Aug 2022 02:34:33 +0000 (12:34 +1000)]
Use `AttrVec` in more places.

In some places we use `Vec<Attribute>` and some places we use
`ThinVec<Attribute>` (a.k.a. `AttrVec`). This results in various points
where we have to convert between `Vec` and `ThinVec`.

This commit changes the places that use `Vec<Attribute>` to use
`AttrVec`. A lot of this is mechanical and boring, but there are
some interesting parts:
- It adds a few new methods to `ThinVec`.
- It implements `MapInPlace` for `ThinVec`, and introduces a macro to
  avoid the repetition of this trait for `Vec`, `SmallVec`, and
  `ThinVec`.

Overall, it makes the code a little nicer, and has little effect on
performance. But it is a precursor to removing
`rustc_data_structures::thin_vec::ThinVec` and replacing it with
`thin_vec::ThinVec`, which is implemented more efficiently.

22 months agoAuto merge of #100847 - matthiaskrgr:rollup-0ga531s, r=matthiaskrgr
bors [Sun, 21 Aug 2022 19:05:18 +0000 (19:05 +0000)]
Auto merge of #100847 - matthiaskrgr:rollup-0ga531s, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #100556 (Clamp Function for f32 and f64)
 - #100663 (Make slice::reverse const)
 - #100697 ( Minor syntax and formatting update to doc comment on `find_vtable_types_for_unsizing`)
 - #100760 (update test for LLVM change)
 - #100761 (some general mir typeck cleanup)
 - #100775 (rustdoc: Merge source code pages HTML elements together v2)
 - #100813 (Add `/build-rust-analyzer/` to .gitignore)
 - #100821 (Make some docs nicer wrt pointer offsets)
 - #100822 (Replace most uses of `pointer::offset` with `add` and `sub`)
 - #100839 (Make doc for stdin field of process consistent)
 - #100842 (Add diagnostics lints to `rustc_transmute` module (zero diags))

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

22 months agoAuto merge of #100645 - notriddle:notriddle/rustdoc-diet-plan, r=GuillaumeGomez
bors [Sun, 21 Aug 2022 16:40:26 +0000 (16:40 +0000)]
Auto merge of #100645 - notriddle:notriddle/rustdoc-diet-plan, r=GuillaumeGomez

rustdoc: strategic boxing to reduce the size of ItemKind and Type

The `Type` change redesigns `QPath` to box the entire data structure instead of boxing `self_type` and the `trait_`.

This reduces the size of several `ItemKind` variants, leaving `Impl` as the biggest variant. The `ItemKind` change boxes that variant's payload.

22 months agoRollup merge of #100842 - JhonnyBillM:enable-diag-lint-in-transmute, r=TaKO8Ki
Matthias Krüger [Sun, 21 Aug 2022 14:54:09 +0000 (16:54 +0200)]
Rollup merge of #100842 - JhonnyBillM:enable-diag-lint-in-transmute, r=TaKO8Ki

Add diagnostics lints to `rustc_transmute` module (zero diags)

Module is complete because it has zero diagnostics.

22 months agoRollup merge of #100839 - nelsonjchen:consistent_child_stdin_field_desc, r=thomcc
Matthias Krüger [Sun, 21 Aug 2022 14:54:08 +0000 (16:54 +0200)]
Rollup merge of #100839 - nelsonjchen:consistent_child_stdin_field_desc, r=thomcc

Make doc for stdin field of process consistent

The other fields use this format and example.

22 months agoRollup merge of #100822 - WaffleLapkin:no_offset_question_mark, r=scottmcm
Matthias Krüger [Sun, 21 Aug 2022 14:54:07 +0000 (16:54 +0200)]
Rollup merge of #100822 - WaffleLapkin:no_offset_question_mark, r=scottmcm

Replace most uses of `pointer::offset` with `add` and `sub`

As PR title says, it replaces `pointer::offset` in compiler and standard library with `pointer::add` and `pointer::sub`. This generally makes code cleaner, easier to grasp and removes (or, well, hides) integer casts.

This is generally trivially correct, `.offset(-constant)` is just `.sub(constant)`, `.offset(usized as isize)` is just `.add(usized)`, etc. However in some cases we need to be careful with signs of things.

r? ````@scottmcm````

_split off from #100746_

22 months agoRollup merge of #100821 - WaffleLapkin:ptr_add_docs, r=scottmcm
Matthias Krüger [Sun, 21 Aug 2022 14:54:06 +0000 (16:54 +0200)]
Rollup merge of #100821 - WaffleLapkin:ptr_add_docs, r=scottmcm

Make some docs nicer wrt pointer offsets

This PR replaces `pointer::offset` with `pointer::add` and similarly `.cast().wrapping_add().cast()` with `.wrapping_byte_add()` **in docs**.

r? ``````@scottmcm``````

_split off from #100746_

22 months agoRollup merge of #100813 - Nilstrieb:too-much-disk-space-gitignore, r=Mark-Simulacrum
Matthias Krüger [Sun, 21 Aug 2022 14:54:05 +0000 (16:54 +0200)]
Rollup merge of #100813 - Nilstrieb:too-much-disk-space-gitignore, r=Mark-Simulacrum

Add `/build-rust-analyzer/` to .gitignore

To avoid rust-analyzer and rustc having to wait for each other, the [dev guide](https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rust-analyzer-for-rustc) mentions using another build directory for RA.

We should also put this into the .gitignore, just like the normal `build`.

22 months agoRollup merge of #100775 - GuillaumeGomez:reduce-span-v2, r=notriddle
Matthias Krüger [Sun, 21 Aug 2022 14:54:04 +0000 (16:54 +0200)]
Rollup merge of #100775 - GuillaumeGomez:reduce-span-v2, r=notriddle

rustdoc: Merge source code pages HTML elements together v2

This is the follow-up of https://github.com/rust-lang/rust/pull/100429.

I strongly recommend to review it one commit at a time because otherwise it's a lot at once.

For these ones, on each page, I run this JS: `document.getElementsByTagName('*').length`. The goal is to count the number of DOM elements. I took some pages that seemed big, but don't hesitate to check some others. I also added the "starting point" because it's quite nice to see how much the page was reduced thanks to these two PRs.

| file name | before #100429 | before this PR | with this PR | diff |
|-|-|-|-|-|
| std/lib.rs.html (source link on std crate page) | 3455 | 2332 | 1772 | 24% |
| alloc/vec/mod.rs.html (source on Vec type page) | 11012 | 5982 | 5833 | 2.5% |
| alloc/string.rs.html (source on String type page) | 10800 | 6010 | 5822 | 3.2% |
| std/sync/mutex.rs.html (source on Mutex type page) | 2953 | 2041 | 2038 | 0.1% |

So unsurprisingly, the more attributes you have, the bigger the difference.

You can test it [here](https://rustdoc.crud.net/imperio/reduce-span-v2/src/std/lib.rs.html).

cc ``````@jsha``````
r? ``````@notriddle``````

22 months agoRollup merge of #100761 - lcnr:mir-typeck-cleanup, r=compiler-errors
Matthias Krüger [Sun, 21 Aug 2022 14:54:04 +0000 (16:54 +0200)]
Rollup merge of #100761 - lcnr:mir-typeck-cleanup, r=compiler-errors

some general mir typeck cleanup

this pr contains the parts of #95763 which already work correctly.

the remaining commits of that PR have some issues which are more complex to fix.

r? types

22 months agoRollup merge of #100760 - krasimirgg:llvm-16-pic-level, r=nikic
Matthias Krüger [Sun, 21 Aug 2022 14:54:03 +0000 (16:54 +0200)]
Rollup merge of #100760 - krasimirgg:llvm-16-pic-level, r=nikic

update test for LLVM change

LLVM commit https://github.com/llvm/llvm-project/commit/c2a38887932e3a46aa3bee35f3f5568ac68282f4 updates the PIC level version selection. Updated an affected rust test to work under both the old and new behaviors.

Detected by our experimental rust + llvm @ HEAD bot:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12829#0182b368-a405-47a2-b3da-9c79cb907bfe/701-709

22 months agoRollup merge of #100697 - eholk:doc-comment-update, r=compiler-errors
Matthias Krüger [Sun, 21 Aug 2022 14:54:02 +0000 (16:54 +0200)]
Rollup merge of #100697 - eholk:doc-comment-update, r=compiler-errors

 Minor syntax and formatting update to doc comment on `find_vtable_types_for_unsizing`

I noticed the code examples on this function weren't formatted as code, and also the that the syntax for trait objects was out of date (or just incorrect). This should bring it up to date.

22 months agoRollup merge of #100663 - clarfonthey:const-reverse, r=scottmcm
Matthias Krüger [Sun, 21 Aug 2022 14:54:01 +0000 (16:54 +0200)]
Rollup merge of #100663 - clarfonthey:const-reverse, r=scottmcm

Make slice::reverse const

I remember this not being doable for some reason before, but decided to try it again and everything worked out in the tests.

22 months agoRollup merge of #100556 - Alex-Velez:patch-1, r=scottmcm
Matthias Krüger [Sun, 21 Aug 2022 14:54:01 +0000 (16:54 +0200)]
Rollup merge of #100556 - Alex-Velez:patch-1, r=scottmcm

Clamp Function for f32 and f64

I thought the clamp function could use a little improvement for readability purposes. The function now returns early in order to skip the extra bound checks.

If there was a reason for binding `self` to `x` or if this code is incorrect, please correct me :)

22 months agoAuto merge of #100841 - RalfJung:miri, r=RalfJung
bors [Sun, 21 Aug 2022 13:54:06 +0000 (13:54 +0000)]
Auto merge of #100841 - RalfJung:miri, r=RalfJung

update Miri

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

22 months agoADD - diagnostic lints to rustc_transmute
Jhonny Bill Mena [Sun, 21 Aug 2022 13:17:09 +0000 (09:17 -0400)]
ADD - diagnostic lints to rustc_transmute

Module is complete because it has zero diagnostics.

22 months agoupdate Miri
Ralf Jung [Sun, 21 Aug 2022 12:57:07 +0000 (08:57 -0400)]
update Miri

22 months agoAuto merge of #100765 - Xiretza:session-diagnostic-unification, r=compiler-errors
bors [Sun, 21 Aug 2022 10:04:42 +0000 (10:04 +0000)]
Auto merge of #100765 - Xiretza:session-diagnostic-unification, r=compiler-errors

Kind-less SessionDiagnostic derive

From https://github.com/rust-lang/rust/pull/100730#discussion_r949712629:

> Hm, maybe we should expose some `sess.struct_$SOMETHING` (like `struct_diagnostic`?) that is generic over `EmissionGuarantee`, then make the `SessionDiagnostic` derive generic, i.e.
>
> ```rust
> impl<'tcx> SessionDiagnostic for UnusedGenericParams {
>   fn into_diagnostic<T: EmissionGuarantee>( .. ) -> DiagnosticBuilder<'tcx, T> {
>     let mut diag = sess.struct_diagnostic(rustc_errors:..);
>     ..
>   }
> }
> ```

Discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.23100717.20translation.20-.20kind-less.20derive).

22 months agoMake doc for stdin field of process consistent
Nelson Chen [Sun, 21 Aug 2022 08:56:26 +0000 (01:56 -0700)]
Make doc for stdin field of process consistent

The other fields use this format and example.

22 months agoAuto merge of #100627 - krasimirgg:lto-llvm-16, r=cuviper
bors [Sun, 21 Aug 2022 07:19:49 +0000 (07:19 +0000)]
Auto merge of #100627 - krasimirgg:lto-llvm-16, r=cuviper

llvm-wrapper: adapt for LLVM API change

No functional changes intended.

LLVM commit https://github.com/llvm/llvm-project/commit/633f5663c37a670e28040cadd938200abd854483 removed `createWriteThinLTOBitcodePass`.
This adapts PassWrapper similarly to the example mentioned upstream: https://github.com/llvm/llvm-project/commit/853b57fe80bdb9d6b19697e6f2abc734834e9f6d.

Detected via our experimental rust + llvm @ head bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12768#0182a6be-ed6e-4dc6-a230-7a46f9d3a2c2/205-537

22 months agoReplace #[lint/warning/error] with #[diag]
Xiretza [Fri, 19 Aug 2022 13:40:48 +0000 (15:40 +0200)]
Replace #[lint/warning/error] with #[diag]

22 months agoDisallow #[primary_span] on LintDiagnostics
Xiretza [Fri, 19 Aug 2022 13:04:34 +0000 (15:04 +0200)]
Disallow #[primary_span] on LintDiagnostics

22 months agoMake derived SessionDiagnostics generic on diagnostic level
Xiretza [Fri, 19 Aug 2022 13:02:10 +0000 (15:02 +0200)]
Make derived SessionDiagnostics generic on diagnostic level

Deriving SessionDiagnostic on a type no longer forces that diagnostic to
be one of warning, error, or fatal. The level is instead decided when
the struct is passed to the respective Handler::emit_*() method.

22 months agoAdd Handler::struct_diagnostic()
Xiretza [Fri, 19 Aug 2022 12:47:45 +0000 (14:47 +0200)]
Add Handler::struct_diagnostic()

This unifies the struct_{warn,error,fatal}() methods in one generic
method.

22 months agoAuto merge of #100624 - GuillaumeGomez:update-minifier-version, r=nnethercote
bors [Sun, 21 Aug 2022 04:21:06 +0000 (04:21 +0000)]
Auto merge of #100624 - GuillaumeGomez:update-minifier-version, r=nnethercote

Update minifier version to 0.2.2

Following [this PR](https://github.com/GuillaumeGomez/minifier-rs/pull/98), the CSS minification should be much faster now (thanks to `@nnethercote).`

r? `@nnethercote`

22 months agoBless tests after #100769
Michael Goulet [Sun, 21 Aug 2022 03:52:08 +0000 (03:52 +0000)]
Bless tests after #100769

22 months agofix nitpicks from review
Maybe Waffle [Sun, 21 Aug 2022 02:36:11 +0000 (06:36 +0400)]
fix nitpicks from review

22 months agoMake check for overlapping closure span more accurate
Michael Goulet [Thu, 18 Aug 2022 13:27:08 +0000 (13:27 +0000)]
Make check for overlapping closure span more accurate

22 months agoAdjust messages, address some nits
Michael Goulet [Thu, 18 Aug 2022 12:16:35 +0000 (12:16 +0000)]
Adjust messages, address some nits

22 months agoMore docs
Michael Goulet [Wed, 17 Aug 2022 16:20:22 +0000 (16:20 +0000)]
More docs

22 months agoTargeted fixes addressing erroneous suggestions
Michael Goulet [Wed, 17 Aug 2022 06:48:09 +0000 (06:48 +0000)]
Targeted fixes addressing erroneous suggestions

22 months agoComment a bit, use find_ancestor_in_same_ctxt to suppress some weird macro notes
Michael Goulet [Wed, 17 Aug 2022 06:17:36 +0000 (06:17 +0000)]
Comment a bit, use find_ancestor_in_same_ctxt to suppress some weird macro notes

22 months agoPoint at struct field if possible
Michael Goulet [Wed, 17 Aug 2022 04:57:17 +0000 (04:57 +0000)]
Point at struct field if possible

22 months agoDeduplicate errors that come from places like normalization, sized
Michael Goulet [Wed, 17 Aug 2022 02:22:06 +0000 (02:22 +0000)]
Deduplicate errors that come from places like normalization, sized

22 months agoPrefer non-Self non-method types over Self, first
Michael Goulet [Wed, 17 Aug 2022 01:28:26 +0000 (01:28 +0000)]
Prefer non-Self non-method types over Self, first

22 months agoRework ambiguity errors
Michael Goulet [Wed, 17 Aug 2022 00:21:40 +0000 (00:21 +0000)]
Rework ambiguity errors

22 months agoNote closure kind mismatch cause
Michael Goulet [Thu, 18 Aug 2022 12:22:07 +0000 (12:22 +0000)]
Note closure kind mismatch cause

22 months agoRevert closure mismatch spans
Michael Goulet [Tue, 16 Aug 2022 23:54:54 +0000 (23:54 +0000)]
Revert closure mismatch spans

22 months agoDo not favor projection type when pointing out arg causing fulfillment error
Michael Goulet [Tue, 16 Aug 2022 23:37:56 +0000 (23:37 +0000)]
Do not favor projection type when pointing out arg causing fulfillment error

22 months agoSkip mentioning lang item
Michael Goulet [Tue, 16 Aug 2022 23:28:20 +0000 (23:28 +0000)]
Skip mentioning lang item

22 months agoAccount for relative paths
Michael Goulet [Tue, 16 Aug 2022 23:13:23 +0000 (23:13 +0000)]
Account for relative paths

22 months agoRework point-at-arg
Michael Goulet [Tue, 16 Aug 2022 06:27:22 +0000 (06:27 +0000)]
Rework point-at-arg

22 months agoAuto merge of #100536 - Alexendoo:bootstrap-tls-model, r=Mark-Simulacrum
bors [Sun, 21 Aug 2022 01:34:05 +0000 (01:34 +0000)]
Auto merge of #100536 - Alexendoo:bootstrap-tls-model, r=Mark-Simulacrum

bootstrap: don't apply `-Ztls-model=initial-exec` to proc macros

Potentially fixes #100530

r? `@bjorn3`

22 months agoAuto merge of #99967 - Mark-Simulacrum:download-llvm-ci, r=jyn514
bors [Sat, 20 Aug 2022 22:49:36 +0000 (22:49 +0000)]
Auto merge of #99967 - Mark-Simulacrum:download-llvm-ci, r=jyn514

Download, rather than sccache-cache, LLVM in CI

My hope/expectation is that we can do better than sccache in CI for cached builds -- currently it looks like on macOS those still take upwards of 10-11 minutes, which is a significant amount of time that we could potentially cut.

This enables this mode for all non-dist builders; this should avoid any problems with the artifacts we distribute, while also providing for faster test builders (since they'll make use of PGO'd LLVM on the platforms we do that on, which is hopefully a nice win). It slightly increases the chance of test builders starting to fail only after a PR is merged (if PGO changes runtime behavior), but that should hopefully never happen, so I think this is worthwhile.

Measurements on the PR for apple-1 don't show any noticeable improvement in CI times, but those can be pretty noisy -- I'm inclined to land this since it *should* pretty much always be better and we can reconsider if that ever turns out not to be the case.

22 months agoMake some docs nicer wrt pointer offsets
Maybe Waffle [Fri, 19 Aug 2022 09:33:46 +0000 (13:33 +0400)]
Make some docs nicer wrt pointer offsets

22 months agoReplace most uses of `pointer::offset` with `add` and `sub`
Maybe Waffle [Fri, 19 Aug 2022 09:33:06 +0000 (13:33 +0400)]
Replace most uses of `pointer::offset` with `add` and `sub`

22 months agoImprove primitive/std docs separation and headers
Cameron Steffen [Sat, 30 Apr 2022 17:01:31 +0000 (12:01 -0500)]
Improve primitive/std docs separation and headers

22 months agoAllow other directives before the `ret`
scottmcm [Sat, 20 Aug 2022 21:08:56 +0000 (21:08 +0000)]
Allow other directives before the `ret`

22 months agoAuto merge of #100810 - matthiaskrgr:rollup-xep778s, r=matthiaskrgr
bors [Sat, 20 Aug 2022 20:08:26 +0000 (20:08 +0000)]
Auto merge of #100810 - matthiaskrgr:rollup-xep778s, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #97963 (net listen backlog set to negative on Linux.)
 - #99935 (Reenable disabled early syntax gates as future-incompatibility lints)
 - #100129 (add miri-test-libstd support to libstd)
 - #100500 (Ban references to `Self` in trait object substs for projection predicates too.)
 - #100636 (Revert "Revert "Allow dynamic linking for iOS/tvOS targets."")
 - #100718 ([rustdoc] Fix item info display)
 - #100769 (Suggest adding a reference to a trait assoc item)
 - #100777 (elaborate how revisions work with FileCheck stuff in src/test/codegen)
 - #100796 (Refactor: remove unnecessary string searchings)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

22 months agoAdd `/build-rust-analyzer/` to .gitignore
Nilstrieb [Sat, 20 Aug 2022 19:07:13 +0000 (21:07 +0200)]
Add `/build-rust-analyzer/` to .gitignore

To avoid rust-analyzer and rustc having to wait for each other,
the dev guide mentions using another build directory for RA.

We should also put this into the .gitignore, just like the normal `build`.

22 months agoRollup merge of #100796 - TaKO8Ki:remove-unnecessary-string-searching, r=compiler...
Matthias Krüger [Sat, 20 Aug 2022 17:45:17 +0000 (19:45 +0200)]
Rollup merge of #100796 - TaKO8Ki:remove-unnecessary-string-searching, r=compiler-errors

Refactor: remove unnecessary string searchings

This patch removes unnecessary string searchings for checking if function arguments have `&` and `&mut`.

22 months agoRollup merge of #100777 - pnkfelix:expand-codegen-tests-readme, r=TaKO8Ki
Matthias Krüger [Sat, 20 Aug 2022 17:45:16 +0000 (19:45 +0200)]
Rollup merge of #100777 - pnkfelix:expand-codegen-tests-readme, r=TaKO8Ki

elaborate how revisions work with FileCheck stuff in src/test/codegen

elaborate how revisions work with FileCheck stuff in src/test/codegen

22 months agoRollup merge of #100769 - TaKO8Ki:suggest-adding-reference-to-trait-assoc-item, r...
Matthias Krüger [Sat, 20 Aug 2022 17:45:15 +0000 (19:45 +0200)]
Rollup merge of #100769 - TaKO8Ki:suggest-adding-reference-to-trait-assoc-item, r=cjgillot

Suggest adding a reference to a trait assoc item

fixes #100289

22 months agoRollup merge of #100718 - GuillaumeGomez:fix-item-info, r=jsha
Matthias Krüger [Sat, 20 Aug 2022 17:45:14 +0000 (19:45 +0200)]
Rollup merge of #100718 - GuillaumeGomez:fix-item-info, r=jsha

[rustdoc] Fix item info display

Fixes  #100369.

The solution I came up with was simply to wrap the "text part" of the `item-info` into another span so that `flex` wouldn't mess with it.

Live demo is [here](https://rustdoc.crud.net/imperio/fix-item-info/foo/struct.ItemInfo.html).

r? ``@jsha``

22 months agoRollup merge of #100636 - cutsoy:revert-77716, r=davidtwco
Matthias Krüger [Sat, 20 Aug 2022 17:45:13 +0000 (19:45 +0200)]
Rollup merge of #100636 - cutsoy:revert-77716, r=davidtwco

Revert "Revert "Allow dynamic linking for iOS/tvOS targets.""

This reverts commit 16e10bf81ee73f61cf813acef3d5dbbce4f66da2 (PR #77716).

The original original PR enabled `cdylib` builds for iOS. However this caused problems because:

> This new feature in Rust 1.46 added a lot of headache for iOS builds with cdylib targets. cdylib target is near impossible to build if you are using any crate with native dependencies (ex. openssl, libsodium, zmq). You can't just find .so files for all architectures to perform correct linking. Usual workflow is the following:
>
> 1. You build staticlib and rely that native dependencies will be linked as frameworks later
> 2. You setup right cocoapods in ObjectiveC/Swift wrapper.
>
> As cargo doesn't support platform-dependent crate types https://github.com/rust-lang/rust/pull/4881 as a result a lot of projects now broken on Rust 1.46

However, this will be soon a thing of the past since 1.64 brings us the long awaited much anticipated `--crate-type` flag.

> I see that this got merged recently: https://github.com/rust-lang/cargo/issues/10083. The --crate-type flag will get stabilized in 1.64. In 1.64, you could still get a successful iOS staticlib with cargo build --crate-type=statclib even if the crate has cdylib targets too. If I'm not mistaken, this solves the problem too so this PR could be reverted in 1.64 with relatively little headache.

So summing up, I think this PR can be reverted in 1.64. 🤞

22 months agoRollup merge of #100500 - cjgillot:verify-self-predicate, r=lcnr
Matthias Krüger [Sat, 20 Aug 2022 17:45:12 +0000 (19:45 +0200)]
Rollup merge of #100500 - cjgillot:verify-self-predicate, r=lcnr

Ban references to `Self` in trait object substs for projection predicates too.

Fixes https://github.com/rust-lang/rust/issues/100484
Fixes https://github.com/rust-lang/rust/issues/100485

r? ````@lcnr````

22 months agoRollup merge of #100129 - RalfJung:miri-test-libstd, r=thomcc
Matthias Krüger [Sat, 20 Aug 2022 17:45:11 +0000 (19:45 +0200)]
Rollup merge of #100129 - RalfJung:miri-test-libstd, r=thomcc

add miri-test-libstd support to libstd

- The first commit mirrors what we already have in liballoc.
- The second commit adds some regression tests that only really make sense to be run in Miri, since they rely on Miri's extra checks to detect anything.
- The third commit makes the MPSC tests work in reasonable time in Miri by reducing iteration counts.
- The fourth commit silences some warnings due to code being disabled with `cfg(miri)`

22 months agoRollup merge of #99935 - CAD97:unstable-syntax-lints, r=petrochenkov
Matthias Krüger [Sat, 20 Aug 2022 17:45:10 +0000 (19:45 +0200)]
Rollup merge of #99935 - CAD97:unstable-syntax-lints, r=petrochenkov

Reenable disabled early syntax gates as future-incompatibility lints

- MCP: https://github.com/rust-lang/compiler-team/issues/535

The approach taken by this PR is

- Introduce a new lint, `unstable_syntax_pre_expansion`, and reenable the early syntax gates to emit it
- Use the diagnostic stashing mechanism to stash warnings the early warnings
- When the hard error occurs post expansion, steal and cancel the early warning
- Don't display any stashed warnings if errors are present to avoid the same noise problem that hiding type ascription errors is avoiding

Commits are working commits, but in a coherent steps-to-implement manner. Can be squashed if desired.

The preexisting `soft_unstable` lint seems like it would've been a good fit, but it is deny-by-default (appropriate for `#[bench]`) and these gates should be introduced as warn-by-default.

It may be desirable to change the stash mechanism's behavior to not flush lint errors in the presence of other errors either (like is done for warnings here), but upgrading a stash-using lint from warn to error perhaps is enough of a request to see the lint that they shouldn't be hidden; additionally, fixing the last error to get new errors thrown at you always feels bad, so if we know the lint errors are present, we should show them.

Using a new flag/mechanism for a "weak diagnostic" which is suppressed by other errors may also be desirable over assuming any stashed warnings are "weak," but this is the first user of stashing warnings and seems an appropriate use of stashing (it follows the "know more later to refine the diagnostic" pattern; here we learn that it's in a compiled position) so we get to define what it means to stash a non-hard-error diagnostic.

cc `````@petrochenkov````` (seconded MCP)

22 months agoRollup merge of #97963 - devnexen:net_listener_neg, r=the8472
Matthias Krüger [Sat, 20 Aug 2022 17:45:09 +0000 (19:45 +0200)]
Rollup merge of #97963 - devnexen:net_listener_neg, r=the8472

net listen backlog set to negative on Linux.

it will be 4076 (from 5.4) or 128.

22 months agoAuto merge of #100809 - matthiaskrgr:rollup-xkpd5ii, r=matthiaskrgr
bors [Sat, 20 Aug 2022 17:38:29 +0000 (17:38 +0000)]
Auto merge of #100809 - matthiaskrgr:rollup-xkpd5ii, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #99415 (Initial implementation of REUSE)
 - #99544 (Expose `Utf8Lossy` as `Utf8Chunks`)
 - #100585 (Fix trailing space showing up in example)
 - #100596 (Remove unnecessary stderr files)
 - #100642 (Update fortanix-sgx-abi and export some useful SGX usercall traits)
 - #100691 (Make `same_type_modulo_infer` a proper `TypeRelation`)
 - #100693 (Add LLVM15-specific codegen test for `try`/`?`s that now optimize away)
 - #100710 (Windows: Load synch functions together)
 - #100807 (Add TaKO8Ki to translation-related mention groups)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

22 months agoRollup merge of #100807 - TaKO8Ki:add-tako8ki-to-translation-related-mention-groups...
Matthias Krüger [Sat, 20 Aug 2022 17:32:14 +0000 (19:32 +0200)]
Rollup merge of #100807 - TaKO8Ki:add-tako8ki-to-translation-related-mention-groups, r=Mark-Simulacrum

Add TaKO8Ki to translation-related mention groups

Can I join translation-related mention groups?

cc `@davidtwco`

22 months agoRollup merge of #100710 - ChrisDenton:load-library, r=thomcc
Matthias Krüger [Sat, 20 Aug 2022 17:32:13 +0000 (19:32 +0200)]
Rollup merge of #100710 - ChrisDenton:load-library, r=thomcc

Windows: Load synch functions together

Attempt to load all the required sync functions and fail if any one of them fails.

This fixes a FIXME by going back to optional loading of `WakeByAddressSingle`.

Also reintroduces a macro for optional loading of functions but keeps it separate from the fallback macro rather than having that do two different jobs.

r? `@thomcc`

22 months agoRollup merge of #100693 - scottmcm:new-llvm15-nops, r=Mark-Simulacrum
Matthias Krüger [Sat, 20 Aug 2022 17:32:12 +0000 (19:32 +0200)]
Rollup merge of #100693 - scottmcm:new-llvm15-nops, r=Mark-Simulacrum

Add LLVM15-specific codegen test for `try`/`?`s that now optimize away

These still generated a bunch of code back in Rust 1.63 (<https://rust.godbolt.org/z/z31P8h6rz>), but with LLVM 15 merged they no longer do 🎉

22 months agoRollup merge of #100691 - compiler-errors:issue-100690, r=estebank
Matthias Krüger [Sat, 20 Aug 2022 17:32:11 +0000 (19:32 +0200)]
Rollup merge of #100691 - compiler-errors:issue-100690, r=estebank

Make `same_type_modulo_infer` a proper `TypeRelation`

Specifically, this fixes #100690 because we no longer consider a `ReLateBound` and a `ReVar` to be equal. `ReVar` can only be equal to free regions or static.

22 months agoRollup merge of #100642 - mzohreva:mz/update-sgx-abi-cancel-queue, r=Mark-Simulacrum
Matthias Krüger [Sat, 20 Aug 2022 17:32:10 +0000 (19:32 +0200)]
Rollup merge of #100642 - mzohreva:mz/update-sgx-abi-cancel-queue, r=Mark-Simulacrum

Update fortanix-sgx-abi and export some useful SGX usercall traits

Update `fortanix-sgx-abi` to 0.5.0 to add support for cancel queue (see https://github.com/fortanix/rust-sgx/pull/405 and https://github.com/fortanix/rust-sgx/pull/404).

Export some useful traits for processing SGX usercall. This is needed for https://github.com/fortanix/rust-sgx/pull/404 to avoid duplication.

cc `@raoulstrackx` and `@jethrogb`

22 months agoRollup merge of #100596 - TaKO8Ki:remove-unnecessary-stderr-files, r=Mark-Simulacrum
Matthias Krüger [Sat, 20 Aug 2022 17:32:09 +0000 (19:32 +0200)]
Rollup merge of #100596 - TaKO8Ki:remove-unnecessary-stderr-files, r=Mark-Simulacrum

Remove unnecessary stderr files

This patch removes stderr files corresponding to revisions that have already been removed.

22 months agoRollup merge of #100585 - wooorm:patch-1, r=Mark-Simulacrum
Matthias Krüger [Sat, 20 Aug 2022 17:32:08 +0000 (19:32 +0200)]
Rollup merge of #100585 - wooorm:patch-1, r=Mark-Simulacrum

Fix trailing space showing up in example

The current text is rendered as: U+005B ..= U+0060 ``[ \ ] ^ _ ` ``, or (**note the final space!**)
This patch changes that to render as: U+005B ..= U+0060 `` [ \ ] ^ _ ` ``, or (**note no final space!**)

The reason for that, is that CommonMark has a solution for starting or ending inline code with a backtick/grave accent: padding both sides with a space, makes that padding disappear.

22 months agoRollup merge of #99544 - dylni:expose-utf8lossy, r=Mark-Simulacrum
Matthias Krüger [Sat, 20 Aug 2022 17:32:07 +0000 (19:32 +0200)]
Rollup merge of #99544 - dylni:expose-utf8lossy, r=Mark-Simulacrum

Expose `Utf8Lossy` as `Utf8Chunks`

This PR changes the feature for `Utf8Lossy` from `str_internals` to `utf8_lossy` and improves the API. This is done to eventually expose the API as stable.

Proposal: rust-lang/libs-team#54
Tracking Issue: #99543

22 months agoRollup merge of #99415 - ferrocene:pa-reuse-initial, r=Mark-Simulacrum
Matthias Krüger [Sat, 20 Aug 2022 17:32:06 +0000 (19:32 +0200)]
Rollup merge of #99415 - ferrocene:pa-reuse-initial, r=Mark-Simulacrum

Initial implementation of REUSE

This PR implements the first two steps of #99414 by:

* Adding some scaffolding for REUSE. The `.reuse/dep5` file now marks every file as the custom "TODO" license, which I'll remove in a future PR once Debian imports their metadata. The TODO license is needed so that `reuse lint` works.
* Runs `reuse lint` in CI, in the `mingw-check` builder. REUSE currently has a bug when parsing some files in the LLVM source code. This means REUSE will fail when running it in source tarballs of rustc, and that bug prevents us from passing the `--include-submodules` flag in CI. I opened https://github.com/fsfe/reuse-tool/pull/560 upstream with a fix, and as soon as it's merged/released I planned to bump the pinned version to include the fix we need.

r? `@Mark-Simulacrum`

22 months agoExpose `Utf8Lossy` as `Utf8Chunks`
dylni [Sat, 20 Aug 2022 16:49:20 +0000 (12:49 -0400)]
Expose `Utf8Lossy` as `Utf8Chunks`

22 months agoAdd global safe.directory for CI
Mark Rousskov [Wed, 10 Aug 2022 11:16:25 +0000 (07:16 -0400)]
Add global safe.directory for CI

22 months agoEnable downloading prebuilt LLVM in test builders
Mark Rousskov [Sun, 31 Jul 2022 21:45:15 +0000 (17:45 -0400)]
Enable downloading prebuilt LLVM in test builders

See comment added for details on the test builder restriction. This is primarily
intended for macOS CI, but is likely to be a slight win on other builders too.

22 months agoExtend decoration test to detect regressions
Guillaume Gomez [Sat, 20 Aug 2022 12:24:05 +0000 (14:24 +0200)]
Extend decoration test to detect regressions

22 months agoClean up highlight `<span>` merge code
Guillaume Gomez [Fri, 19 Aug 2022 19:35:09 +0000 (21:35 +0200)]
Clean up highlight `<span>` merge code

22 months agoadd TaKO8Ki to translation-related mention groups
Takayuki Maeda [Sat, 20 Aug 2022 11:47:41 +0000 (20:47 +0900)]
add TaKO8Ki to translation-related mention groups

22 months agoUpdate rustdoc tests
Guillaume Gomez [Fri, 19 Aug 2022 16:16:02 +0000 (18:16 +0200)]
Update rustdoc tests

22 months agoMerge "EnterSpan" events to reduce code blocks DOM size
Guillaume Gomez [Fri, 19 Aug 2022 15:27:22 +0000 (17:27 +0200)]
Merge "EnterSpan" events to reduce code blocks DOM size

22 months agouse more descriptive names
Takayuki Maeda [Sat, 20 Aug 2022 10:35:17 +0000 (19:35 +0900)]
use more descriptive names

22 months agoAuto merge of #100564 - nnethercote:box-ast-MacCall, r=spastorino
bors [Sat, 20 Aug 2022 10:26:54 +0000 (10:26 +0000)]
Auto merge of #100564 - nnethercote:box-ast-MacCall, r=spastorino

Box the `MacCall` in various types.

r? `@spastorino`

22 months agoAuto merge of #100793 - matthiaskrgr:rollup-dy7rfdh, r=matthiaskrgr
bors [Sat, 20 Aug 2022 07:59:48 +0000 (07:59 +0000)]
Auto merge of #100793 - matthiaskrgr:rollup-dy7rfdh, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #100186 (Mention `as_mut` alongside `as_ref` in borrowck error message)
 - #100383 (Mitigate stale data reads on SGX platform)
 - #100507 (suggest `once_cell::Lazy` for non-const statics)
 - #100617 (Suggest the right help message for as_ref)
 - #100667 (Migrate "invalid variable declaration" errors to SessionDiagnostic)
 - #100709 (Migrate typeck's `used` expected symbol diagnostic to `SessionDiagnostic`)
 - #100723 (Add the diagnostic translation lints to crates that don't emit them)
 - #100729 (Avoid zeroing a 1kb stack buffer on every call to `std::sys::windows::fill_utf16_buf`)
 - #100750 (improved diagnostic for function defined with `def`, `fun`, `func`, or `function` instead of `fn`)
 - #100763 (triagebot: Autolabel `A-rustdoc-json`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

22 months agoremove unnecessary string searchings
Takayuki Maeda [Sat, 20 Aug 2022 06:54:39 +0000 (15:54 +0900)]
remove unnecessary string searchings

remove unnecessary string searchings for checking if function arguments have `&` and `&mut`

22 months agoRollup merge of #100763 - aDotInTheVoid:triagebot-rdj, r=jyn514
Matthias Krüger [Sat, 20 Aug 2022 05:09:06 +0000 (07:09 +0200)]
Rollup merge of #100763 - aDotInTheVoid:triagebot-rdj, r=jyn514

triagebot: Autolabel `A-rustdoc-json`

22 months agoRollup merge of #100750 - akabinds:akabinds/improved-invalid-function-qual-error...
Matthias Krüger [Sat, 20 Aug 2022 05:09:05 +0000 (07:09 +0200)]
Rollup merge of #100750 - akabinds:akabinds/improved-invalid-function-qual-error, r=davidtwco

improved diagnostic for function defined with `def`, `fun`, `func`, or `function` instead of `fn`

Closes #99751

22 months agoRollup merge of #100729 - thomcc:less-initialized, r=ChrisDenton
Matthias Krüger [Sat, 20 Aug 2022 05:09:04 +0000 (07:09 +0200)]
Rollup merge of #100729 - thomcc:less-initialized, r=ChrisDenton

Avoid zeroing a 1kb stack buffer on every call to `std::sys::windows::fill_utf16_buf`

I've also tried to be slightly more careful about integer overflows, although in practice this is likely still not handled ideally.

r? `@ChrisDenton`

22 months agoRollup merge of #100723 - 5225225:the-easy-ones, r=compiler-errors
Matthias Krüger [Sat, 20 Aug 2022 05:09:03 +0000 (07:09 +0200)]
Rollup merge of #100723 - 5225225:the-easy-ones, r=compiler-errors

Add the diagnostic translation lints to crates that don't emit them

Some of these have a note saying that they should build on a stable compiler, does that mean they shouldn't get these lints? Or can we cfg them out on those?

22 months agoRollup merge of #100709 - JhonnyBillM:port-expected-used-symbol-diagnostic, r=compile...
Matthias Krüger [Sat, 20 Aug 2022 05:09:02 +0000 (07:09 +0200)]
Rollup merge of #100709 - JhonnyBillM:port-expected-used-symbol-diagnostic, r=compiler-errors

Migrate typeck's `used` expected symbol diagnostic to `SessionDiagnostic`

r? ``@davidtwco``

22 months agoRollup merge of #100667 - Xiretza:diag-structs-parser-ivd, r=davidtwco
Matthias Krüger [Sat, 20 Aug 2022 05:09:01 +0000 (07:09 +0200)]
Rollup merge of #100667 - Xiretza:diag-structs-parser-ivd, r=davidtwco

Migrate "invalid variable declaration" errors to SessionDiagnostic

After seeing the great blog post on Inside Rust, I decided to try my hand at this. Just one diagnostic for now to get used to the workflow and to check if this is the way to do it or if there are any problems.

22 months agoRollup merge of #100617 - chenyukang:fix-100605, r=compiler-errors
Matthias Krüger [Sat, 20 Aug 2022 05:09:00 +0000 (07:09 +0200)]
Rollup merge of #100617 - chenyukang:fix-100605, r=compiler-errors

Suggest the right help message for as_ref

Fixes #100605

22 months agoRollup merge of #100507 - cameron1024:suggest-lazy, r=compiler-errors
Matthias Krüger [Sat, 20 Aug 2022 05:08:59 +0000 (07:08 +0200)]
Rollup merge of #100507 - cameron1024:suggest-lazy, r=compiler-errors

suggest `once_cell::Lazy` for non-const statics

Addresses https://github.com/rust-lang/rust/issues/100410

Some questions:
 - removing the `if` seems to include too many cases (e.g. calls to non-const functions inside a `const fn`), but this code excludes the following case:
```rust
const FOO: Foo = non_const_fn();
```
Should we suggest `once_cell` in this case as well?
 - The original issue mentions suggesting `AtomicI32` instead of `Mutex<i32>`, should this PR address that as well?

22 months agoRollup merge of #100383 - fortanix:raoul/aepic_leak_mitigation, r=cuviper
Matthias Krüger [Sat, 20 Aug 2022 05:08:58 +0000 (07:08 +0200)]
Rollup merge of #100383 - fortanix:raoul/aepic_leak_mitigation, r=cuviper

Mitigate stale data reads on SGX platform

Intel disclosed the Stale Data Read vulnerability yesterday. In order to mitigate this issue completely, reading userspace from an SGX enclave must be aligned and in 8-bytes chunks. This PR implements this mitigation

References:
 - https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00657.html
 - https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/advisory-guidance/stale-data-read-from-xapic.html

cc: ``@jethrogb``

22 months agoRollup merge of #100186 - compiler-errors:or-as_mut, r=fee1-dead
Matthias Krüger [Sat, 20 Aug 2022 05:08:57 +0000 (07:08 +0200)]
Rollup merge of #100186 - compiler-errors:or-as_mut, r=fee1-dead

Mention `as_mut` alongside `as_ref` in borrowck error message

Kinda fixes #99426 but I guess that really might be better staying open to see if we could make it suggest `as_mut` in a structured way. Not sure how to change borrowck to know that info tho.

22 months agoUse const instead of static
Chris Denton [Thu, 18 Aug 2022 18:08:49 +0000 (19:08 +0100)]
Use const instead of static

22 months agoSimplify load/store
Chris Denton [Thu, 18 Aug 2022 17:34:19 +0000 (18:34 +0100)]
Simplify load/store

22 months agoSuggest the right help message for as_ref
yukang [Sat, 20 Aug 2022 01:43:37 +0000 (09:43 +0800)]
Suggest the right help message for as_ref

22 months agoTracking issue for const_reverse
ltdk [Sat, 20 Aug 2022 00:38:32 +0000 (20:38 -0400)]
Tracking issue for const_reverse