Commit Graph

238323 Commits

Author SHA1 Message Date
bors
d42d73b144 Auto merge of #117769 - matthiaskrgr:rollup-4efjlg3, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #114191 (Update exploit mitigations documentation)
 - #117039 (Clarify UB in `get_unchecked(_mut)`)
 - #117730 (Closure-consuming helper functions for `fmt::Debug` helpers)
 - #117741 (Fix typo in internal.rs)
 - #117743 (Suggest removing `;` for `;` within let-chains)
 - #117751 (rustdoc-json: Fix test so it actually checks things)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-10 02:18:27 +00:00
Matthias Krüger
186a3c8c61
Rollup merge of #117751 - aDotInTheVoid:unkind, r=GuillaumeGomez
rustdoc-json: Fix test so it actually checks things

After #111427, no item has a `kind` field, so these assertions could never fail. Instead, assert that those two items arn't present.

r? `@GuillaumeGomez`
2023-11-10 01:50:26 +01:00
Matthias Krüger
7607597d3a
Rollup merge of #117743 - sjwang05:issue-117720, r=estebank
Suggest removing `;` for `;` within let-chains

Fixes #117720
2023-11-10 01:50:25 +01:00
Matthias Krüger
7fd7719ca1
Rollup merge of #117741 - eltociear:patch-23, r=compiler-errors
Fix typo in internal.rs

covert -> convert
2023-11-10 01:50:25 +01:00
Matthias Krüger
0f1da7e682
Rollup merge of #117730 - jmillikin:fmt-debug-helper-fns, r=cuviper
Closure-consuming helper functions for `fmt::Debug` helpers

ACP: https://github.com/rust-lang/libs-team/issues/288

Tracking issue: https://github.com/rust-lang/rust/issues/117729
2023-11-10 01:50:24 +01:00
Matthias Krüger
7096ec3e00
Rollup merge of #117039 - scottmcm:clarify-get-unchecked, r=cuviper
Clarify UB in `get_unchecked(_mut)`

Inspired by #116915, it was unclear to me what exactly "out-of-bounds index" means in `get_unchecked`.

One could [potentially](https://rust.godbolt.org/z/hxM764orW) interpret it that `get_unchecked` is just another way to write `offset`, but I think `get_unchecked(len)` is supposed to be UB even though `.offet(len)` is well-defined (as is `.get_unchecked(..len)`), so write that more directly in the docs.

**libs-api folks**: Can you confirm whether this is what you expect this to mean?  And is the situation any different for `<*const [T]>::get_unchecked`?
2023-11-10 01:50:24 +01:00
Matthias Krüger
9dc022dd80
Rollup merge of #114191 - rcvalle:rust-exploit-mitigations, r=cuviper
Update exploit mitigations documentation

Updates the rustc book with most up to date information about exploit mitigations supported by the Rust compiler.
2023-11-10 01:50:23 +01:00
John Millikin
82a9f94de5 Closure-consuming helper functions for fmt::Debug helpers 2023-11-10 07:50:11 +09:00
bors
0f44eb32f1 Auto merge of #117727 - saethlin:inline-derived-fmt, r=nnethercote
Emit #[inline] on derive(Debug)

While working on https://github.com/rust-lang/rust/pull/116583 I noticed that the `cross_crate_inlinable` query identifies a lot of derived `Debug` impls as a MIR body that's little more than a call, which suggests they may be a good candidate for `#[inline]`. So here I've implemented that change specifically.

It seems to provide a nice improvement to build times.
2023-11-09 21:34:14 +00:00
onur-ozkan
fdb72795d1 enable unstable feature on x clean [PATH]
Since https://github.com/rust-lang/rust/pull/111076 enables
unstable cargo feature (`public-dependency`), we need to ensure
that unstable features are enabled before reading libstd Cargo.toml.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-11-09 23:04:51 +03:00
bors
eae4135939 Auto merge of #117708 - onur-ozkan:x-setup, r=clubby789
check config file before prompts on `x setup`

First 2 commit moves the check of configuration existence to the first step of `x setup`. And then followed by a prompt that allows devs to decide whether to continue with the configuration override or exit bootstrap.

Closes #110471

I can revert the last commit if needed. Maybe it's just me, but I feel it's better to have those tags capitalized. If you think otherwise, please let me know so that I can revert.
2023-11-09 19:16:59 +00:00
bors
4c8862b263 Auto merge of #117122 - ferrocene:pa-configure-git-diff, r=albertlarsan68
Allow configuring the parent GitHub repository

The git integration in build_helper hardcoded `rust-lang/rust` as the parent GitHub repository, and `master` as the branch name. This works great for `rust-lang/rust`, but causes problems in downstream forks like Ferrocene whenever those functions are invoked (like `./x fmt`).

In `src/stage0.json` there was already a configuration key for the name of the nightly branch, but it wasn't used by build_helper. This PR adds the `github_repository` key to the file, and requires both values to be passed to build_helper whenever a git function is called. This will allow downstream forks to tweak the values.
2023-11-09 16:49:28 +00:00
Ben Kimock
d32d9238cf Emit #[inline] on derive(Debug) 2023-11-09 10:40:55 -05:00
bors
b7583d38b7 Auto merge of #117712 - lcnr:expand-coroutine, r=jackh726
generator layout: ignore fake borrows

fixes #117059

We emit fake shallow borrows in case the scrutinee place uses a `Deref` and there is a match guard. This is necessary to prevent the match guard from mutating the scrutinee: fab1054e17/compiler/rustc_mir_build/src/build/matches/mod.rs (L1250-L1265)

These fake borrows end up impacting the generator witness computation in `mir_generator_witnesses`, which causes the issue in #117059. This PR now completely ignores fake borrows during this computation. This is sound as thse are always removed after analysis and the actual computation of the generator layout happens afterwards.

Only the second commit impacts behavior, and could be backported by itself.

r? types
2023-11-09 14:23:45 +00:00
Pietro Albini
488dd9bc73
fmt 2023-11-09 14:44:54 +01:00
bors
e7998aa21f Auto merge of #117734 - nnethercote:rm-Zstrip, r=davidtwco
Remove `-Z strip`.

It was stabilized as `-C strip` in November 2021. The unstable option was kept around as a temporary measure to ease the transition. Two years is more than enough!

r? `@tmandry`
2023-11-09 12:26:28 +00:00
Alona Enraght-Moony
22e1576a12 rustdoc-json: Fix test so it actuall checks things
After #111427, no item has a `kind` field, so these assertions could never
fail. Instead, assert that those two items arn't present.
2023-11-09 12:13:16 +00:00
klensy
7142c8d83c bump few ICU4X leftover deps
implements https://github.com/rust-lang/rust/pull/117632#issuecomment-1795027801 suggestion
2023-11-09 14:53:21 +03:00
bors
287ae4db75 Auto merge of #117632 - Nilstrieb:icup, r=davidtwco
Update ICU4X

This updates all ICU4X crates and regenerates rustc_baked_icu_data.

Since the new unicode license under which they are licensed does not have an SPDX identifier yet, we define some exceptions. The license has to be reviewed to make sure it is still fine to use here, but I assume that is the case.

I also added an exception for rustc_icu_data to the unexplained ignore doctest tidy lint. This is a bit hacky but the whole style.rs in tidy is a mess so I didn't want to touch it more than this small hack.

part of #112865

r? `@davidtwco` `@wesleywiser` `@Manishearth`
2023-11-09 09:00:57 +00:00
sjwang05
5693a34db2
Suggest fix for ; within let-chains 2023-11-09 00:31:42 -08:00
Ikko Eltociear Ashimine
b8648216a5
Fix typo in internal.rs
covert -> convert
2023-11-09 16:10:37 +09:00
bors
492e57c6ad Auto merge of #117736 - TaKO8Ki:rollup-fjrtmlb, r=TaKO8Ki
Rollup of 6 pull requests

Successful merges:

 - #116762 (Fixup `Atomic*::from_ptr` safety docs)
 - #117645 (Extend builtin/auto trait args with error when they have >1 argument)
 - #117694 (Move `BorrowedBuf` and `BorrowedCursor` from `std:io` to `core::io`)
 - #117705 (triagebot.toml: use inclusive language)
 - #117723 (speed up `x clean`)
 - #117724 (Restore rustc shim error message)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-09 07:02:20 +00:00
onur-ozkan
d1e26401bc chore(bootstrap): capitalize {error, warning, info, note} tags
This should enhance the readability.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-11-09 09:22:43 +03:00
onur-ozkan
42fbf3ebf5 allow users to override the existing configuration during x setup
Instead of immediately terminating bootstrap, users are now given
the option to decide whether they want to override the file or leave
it unchanged.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-11-09 09:21:38 +03:00
onur-ozkan
3d6417fc7a check config file before prompts on x setup
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-11-09 09:21:35 +03:00
Takayuki Maeda
f5195c52bb
Rollup merge of #117724 - Kobzol:shim-error-message, r=onur-ozkan
Restore rustc shim error message

Fixes: https://github.com/rust-lang/rust/pull/117595#discussion_r1382482249

The error message was originally introduced in https://github.com/rust-lang/rust/pull/111323, and subsequently broken by my change in https://github.com/rust-lang/rust/pull/116448.

r? ``@onur-ozkan``
2023-11-09 11:36:54 +09:00
Takayuki Maeda
e603f4491c
Rollup merge of #117723 - onur-ozkan:keep-bootstrap-on-x-clean, r=albertlarsan68
speed up `x clean`

Since `x clean` runs with bootstrap, we can speed up this process by avoiding the cleaning of bootstrap artifacts, as they are not necessarily needed to be cleaned.

ref #https://github.com/rust-lang/rust/issues/117653#issuecomment-1802482768
2023-11-09 11:36:53 +09:00
Takayuki Maeda
6533c62ce7
Rollup merge of #117705 - tshepang:patch-2, r=Nilstrieb
triagebot.toml: use inclusive language
2023-11-09 11:36:53 +09:00
Takayuki Maeda
b4fa5b7004
Rollup merge of #117694 - jmillikin:core-io-borrowed-buf, r=m-ou-se
Move `BorrowedBuf` and `BorrowedCursor` from `std:io` to `core::io`

Tracking issue: https://github.com/rust-lang/rust/issues/117693

ACP: https://github.com/rust-lang/libs-team/issues/290
2023-11-09 11:36:52 +09:00
Takayuki Maeda
4cc549811f
Rollup merge of #117645 - compiler-errors:auto-trait-subst, r=petrochenkov
Extend builtin/auto trait args with error when they have >1 argument

Reuse `extend_with_error` to add error args to any auto trait (or built-in trait like `Copy` that is defined incorrectly) that has additional non-`Self` args.

Fixes #117628
2023-11-09 11:36:52 +09:00
Takayuki Maeda
a1a8d6fe9c
Rollup merge of #116762 - WaffleLapkin:fixup_fromptr_docs, r=RalfJung
Fixup `Atomic*::from_ptr` safety docs

See https://github.com/rust-lang/rust/pull/115719#issuecomment-1762725010
cc ``@RalfJung``
2023-11-09 11:36:51 +09:00
bors
d8dbf7ca0e Auto merge of #117557 - Zoxc:panic-prio, r=petrochenkov
Make `FatalErrorMarker` lower priority than other panics

This makes `FatalErrorMarker` lower priority than other panics in a parallel sections. If any other panics occur, they will be unwound instead of `FatalErrorMarker`. This ensures `rustc` will exit with the correct error code on ICEs.

This fixes https://github.com/rust-lang/rust/issues/116659.
2023-11-09 00:39:02 +00:00
Nicholas Nethercote
ecc936b155 Remove -Z strip.
It was stabilized as `-C strip` in November 2021. The unstable option
was kept around as a temporary measure to ease the transition. Two years
is more than enough!
2023-11-09 11:36:02 +11:00
bors
57fb1e643a Auto merge of #117454 - shepmaster:github-actions-m1-tests, r=GuillaumeGomez,onur-ozkan
Run tests in CI for aarch64-apple-darwin

r? `@ghost`
2023-11-08 22:40:10 +00:00
John Millikin
341c85648c Move BorrowedBuf and BorrowedCursor from std:io to core::io
Assigned new feature name `core_io_borrowed_buf` to distinguish from the
`Read::read_buf` functionality in `std::io`.
2023-11-09 07:10:11 +09:00
lcnr
92267c9794 update mir-opt tests 2023-11-08 22:55:29 +01:00
lcnr
992d93f687 rename BorrowKind::Shallow to Fake
also adds some comments
2023-11-08 22:55:28 +01:00
lcnr
a42eca42df generator layout: ignore fake borrows 2023-11-08 22:55:28 +01:00
Jakub Beránek
622be2d138
Restore rustc shim error message 2023-11-08 22:38:31 +01:00
onur-ozkan
de0458af97 speed up x clean
Since `x clean` runs with bootstrap, we can speed up
this process by avoiding the cleaning of bootstrap artifacts,
as they are not necessarily needed to be cleaned.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-11-08 23:45:31 +03:00
bors
fdaaaf9f92 Auto merge of #116930 - RalfJung:raw-ptr-match, r=davidtwco
patterns: reject raw pointers that are not just integers

Matching against `0 as *const i32` is fine, matching against `&42 as *const i32` is not.

This extends the existing check against function pointers and wide pointers: we now uniformly reject all these pointer types during valtree construction, and then later lint because of that. See [here](https://github.com/rust-lang/rust/pull/116930#issuecomment-1784654073) for some more explanation and context.

Also fixes https://github.com/rust-lang/rust/issues/116929.

Cc `@oli-obk` `@lcnr`
2023-11-08 20:42:32 +00:00
Ralf Jung
30588657b7 avoid unnecessary nested conditionals 2023-11-08 20:37:08 +01:00
bors
90fdc1fc27 Auto merge of #117716 - GuillaumeGomez:rollup-83gnhll, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #117263 (handle the case when the change-id isn't found)
 - #117282 (Recover from incorrectly ordered/duplicated function keywords)
 - #117679 (tests/rustdoc-json: Avoid needless use of `no_core` and `lang_items`)
 - #117702 (target: move base and target specifications)
 - #117713 (Add test for reexported hidden item with `--document-hidden-items`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-08 18:33:23 +00:00
Guillaume Gomez
9d3c80248b
Rollup merge of #117713 - GuillaumeGomez:document-hidden-json, r=notriddle
Add test for reexported hidden item with `--document-hidden-items`

Coming from [this discussion on zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/Using.20cargo-semver-checks.20in.20rustdoc.20JSON.20tests.3A.20revisited).

cc ``@aDotInTheVoid``
r? ``@notriddle``
2023-11-08 17:14:37 +01:00
Guillaume Gomez
d8c52b378d
Rollup merge of #117702 - davidtwco:target-tier-refactors, r=petrochenkov
target: move base and target specifications

Follow-up to #116004.

In anticipation of later PRs where we'll want to add tidy checks to ensure that, for each target, we have a test or a platform support document or something like that, this PR moves target specifications into a directory on their own so that we can just list the files in this directory to get a list of all targets.

- Base specifications are moved to `rustc_target::spec::base`.
- Target specifications are moved to `rustc_target::spec::targets`.
- All the other source files containing types used in the target specs remain in `rustc_target::spec`.
  - `rustc_target/src/spec/abi.rs` is moved to `rustc_target/src/spec/abi/mod.rs` (where there was already a `tests.rs`) for uniformity.

r? ``@petrochenkov``
2023-11-08 17:14:37 +01:00
Guillaume Gomez
5d00a5d936
Rollup merge of #117679 - aDotInTheVoid:yes-core, r=GuillaumeGomez
tests/rustdoc-json: Avoid needless use of `no_core` and `lang_items`

See #117487 for motivation.

I've split it into three commits, depending on how much work it was to remove `#![no_core]`. The first is entirely mechanical, the second makes no logical changes but couldn't be done with find+replace, and the third required rewriting assertions no not depend on having `#![no_core]`. All of the interesting changes for review are in the third commit, so I recommend reviewing commit-by-commit.

After this, 3 tests still use `#![no_core]`:

- `./tests/rustdoc-json/primitives/primitive_impls.rs`. Uses impls on primitives, so needs to simulate core
- `./tests/rustdoc-json/primitives/local_primitive.rs`: Uses `rustc_doc_primitive`, so needs to simulate core
- `./tests/rustdoc-json/impls/auto.rs`: Uses auto traits, so needs to simulate core

But after this change, we only rely on the core-rustc boundary in tests that deliberately test those interactions.

r? ``@GuillaumeGomez``

Fixes #117487
2023-11-08 17:14:36 +01:00
Guillaume Gomez
c828371179
Rollup merge of #117282 - clubby789:recover-wrong-function-header, r=TaKO8Ki
Recover from incorrectly ordered/duplicated function keywords

Fixes #115714
2023-11-08 17:14:36 +01:00
Guillaume Gomez
e05e4f38b5
Rollup merge of #117263 - onur-ozkan:change-id-fix, r=saethlin
handle the case when the change-id isn't found

When we switch back and forth between the old and recent branches, if there was a breaking change in the bootstrap configuration in between, we have to update the change-id in the build configuration with each checkout, which can be exhausting. This change fixes that.

r? saethlin
2023-11-08 17:14:35 +01:00
bors
341efb1017 Auto merge of #117560 - lqd:issue-117146, r=matthewjasper
Compute polonius loan scopes over the region graph

In issue #117146 a loan flows into an SCC containing a placeholder, and whose representative is an existential region. Since we currently compute loan scopes by looking at SCCs and their representatives only, polonius would compute kill points for this loan here whereas NLLs would not of course.

There are a few ways to fix this:
- don't try to be efficient by doing the computation over SCCs, and simply look for free regions and placeholders in the successors of the issuing region.
- change how the SCC representatives are picked, biasing towards placeholders over existential regions. They *shouldn't* matter much, but some downstream code may subtly depend on the current scheme (though no tests fail if we do such a change). This is for unrelated reasons also the way #116891 changes the representative computation. So that PR would also fix issue #117146.
- try to remove placeholders from the main path, and contain them to a pre-pass + a post-pass kind of polonius leak check. If possible, it would fix this issue by turning an outlives constraints to a placeholder into a constraint to 'static. This should also fix the issue, as the representative would be the free region in the SCC. We want to prototype this change to see if it's possible to try to simplify the borrowck main path from having to deal with placeholders and higher-ranked subtyping 🤞.

I'd like to take advantage of fuzzing and a crater run sooner rather than later, so that we grow more confidence that the 2 models are indeed equivalent empirically. Therefore this PR implements option 1 to fix the issue now.

We can take care of efficiency later after validation, and once we implement option 3 (which could also impact option 2 and that associated PR, maybe the lack of placeholders could remove the need to change the representative computation) to traverse SCCs and their representative again.

(Or we maybe will have some kind of naive position-dependent outlives propagation by then and this code would have been changed)

Fixes #117146.

r? `@matthewjasper`
2023-11-08 16:13:37 +00:00
Ramon de C Valle
7c385f5a03 Update exploit mitigations documentation
Updates the rustc book with most up to date information about exploit
mitigations supported by the Rust compiler.
2023-11-08 07:27:57 -08:00