Commit Graph

197709 Commits

Author SHA1 Message Date
Matthias Krüger
a45f69f27d
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_
2022-08-21 16:54:07 +02:00
Matthias Krüger
fd403f5d17
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_
2022-08-21 16:54:06 +02:00
Matthias Krüger
bc66f4085a
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`.
2022-08-21 16:54:05 +02:00
Matthias Krüger
5518b6b686
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``````
2022-08-21 16:54:04 +02:00
Matthias Krüger
9cf3bacfb2
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
2022-08-21 16:54:04 +02:00
Matthias Krüger
938ebf9a83
Rollup merge of #100760 - krasimirgg:llvm-16-pic-level, r=nikic
update test for LLVM change

LLVM commit c2a3888793 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
2022-08-21 16:54:03 +02:00
Matthias Krüger
a2820257fc
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.
2022-08-21 16:54:02 +02:00
Matthias Krüger
1cdcf508bb
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.
2022-08-21 16:54:01 +02:00
Matthias Krüger
a5c16a5381
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 :)
2022-08-21 16:54:01 +02:00
bors
4b695f7c4e 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).
2022-08-21 10:04:42 +00:00
bors
39a9b88f4e Auto merge of #100627 - krasimirgg:lto-llvm-16, r=cuviper
llvm-wrapper: adapt for LLVM API change

No functional changes intended.

LLVM commit 633f5663c3 removed `createWriteThinLTOBitcodePass`.
This adapts PassWrapper similarly to the example mentioned upstream: 853b57fe80.

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
2022-08-21 07:19:49 +00:00
Xiretza
7f3a6fd7f6 Replace #[lint/warning/error] with #[diag] 2022-08-21 09:17:43 +02:00
Xiretza
bd0d3f745d Disallow #[primary_span] on LintDiagnostics 2022-08-21 09:17:43 +02:00
Xiretza
a960f8304c 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.
2022-08-21 09:17:43 +02:00
Xiretza
91ad4e38f5 Add Handler::struct_diagnostic()
This unifies the struct_{warn,error,fatal}() methods in one generic
method.
2022-08-21 09:17:43 +02:00
bors
aa8e761def 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`
2022-08-21 04:21:06 +00:00
Maybe Waffle
b2625e24b9 fix nitpicks from review 2022-08-21 06:36:11 +04:00
bors
f2858b5cd3 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`
2022-08-21 01:34:05 +00:00
bors
fb80d2bfe4 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.
2022-08-20 22:49:36 +00:00
Maybe Waffle
3ba393465f Make some docs nicer wrt pointer offsets 2022-08-21 02:22:20 +04:00
Maybe Waffle
e4720e1cf2 Replace most uses of pointer::offset with add and sub 2022-08-21 02:21:41 +04:00
scottmcm
03146471b5
Allow other directives before the ret 2022-08-20 21:08:56 +00:00
bors
878aef79dc 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
2022-08-20 20:08:26 +00:00
Nilstrieb
0c3ed968a2 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`.
2022-08-20 21:07:13 +02:00
Matthias Krüger
d793cd266c
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`.
2022-08-20 19:45:17 +02:00
Matthias Krüger
44894a7c51
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
2022-08-20 19:45:16 +02:00
Matthias Krüger
7f0289623c
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
2022-08-20 19:45:15 +02:00
Matthias Krüger
aaa5574a18
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``
2022-08-20 19:45:14 +02:00
Matthias Krüger
e81b994868
Rollup merge of #100636 - cutsoy:revert-77716, r=davidtwco
Revert "Revert "Allow dynamic linking for iOS/tvOS targets.""

This reverts commit 16e10bf81e (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. 🤞
2022-08-20 19:45:13 +02:00
Matthias Krüger
33a40297d3
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````
2022-08-20 19:45:12 +02:00
Matthias Krüger
e93edf3335
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)`
2022-08-20 19:45:11 +02:00
Matthias Krüger
8828af4d88
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)
2022-08-20 19:45:10 +02:00
Matthias Krüger
d9789b6903
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.
2022-08-20 19:45:09 +02:00
bors
48853a361a 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
2022-08-20 17:38:29 +00:00
Matthias Krüger
0be081976c
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`
2022-08-20 19:32:14 +02:00
Matthias Krüger
77db317eed
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`
2022-08-20 19:32:13 +02:00
Matthias Krüger
45568bdaf7
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 🎉
2022-08-20 19:32:12 +02:00
Matthias Krüger
51769af6ea
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.
2022-08-20 19:32:11 +02:00
Matthias Krüger
c4fa35bb41
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`
2022-08-20 19:32:10 +02:00
Matthias Krüger
23a603aa4c
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.
2022-08-20 19:32:09 +02:00
Matthias Krüger
bd4a63cda2
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.
2022-08-20 19:32:08 +02:00
Matthias Krüger
d49906519b
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
2022-08-20 19:32:07 +02:00
Matthias Krüger
2be85b0d03
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`
2022-08-20 19:32:06 +02:00
dylni
e8ee0b7b2b Expose Utf8Lossy as Utf8Chunks 2022-08-20 12:49:20 -04:00
Mark Rousskov
d7b91c3120 Add global safe.directory for CI 2022-08-20 09:47:59 -04:00
Mark Rousskov
6c7f301145 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.
2022-08-20 09:47:59 -04:00
Guillaume Gomez
7ab8e0cbe4 Extend decoration test to detect regressions 2022-08-20 14:24:05 +02:00
Guillaume Gomez
4c89c2886d Clean up highlight <span> merge code 2022-08-20 14:01:04 +02:00
Takayuki Maeda
ebeb77e79e add TaKO8Ki to translation-related mention groups 2022-08-20 20:47:41 +09:00
Guillaume Gomez
f5b5d867d5 Update rustdoc tests 2022-08-20 13:33:41 +02:00