Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #120877

Merged
merged 21 commits into from
Feb 10, 2024
Merged

Rollup of 8 pull requests #120877

merged 21 commits into from
Feb 10, 2024

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

RalfJung and others added 21 commits January 28, 2024 10:00
Add documentation about a current footgun of `str::starts_with`
The documentation for atomic integers says that they have the "same
in-memory representation" as their underlying integers. This might be
misconstrued as implying that they have the same layout. Therefore,
clarify that atomic integers' alignment is equal to their size.
The meaning of this assertion changed in rust-lang#120828 when the meaning of
`has_errors` changed to exclude stashed errors. Evidently the new
meaning is too restrictive.

Fixes rust-lang#120856.
Implementing traits marked with `#[rustc_specialization_trait]` normally
requires (min-)specialization to be enabled for the enclosing crate.

With this change, that permission can also be granted by an
`allow_internal_unstable` attribute on the macro that generates the impl.
These crates all needed specialization for `newtype_index!`, which will no
longer be necessary when the current nightly eventually becomes the next
bootstrap compiler.
…wco,oli-obk

static mut: allow mutable reference to arbitrary types, not just slices and arrays

For historical reasons, we allow this:
```rust
static mut ARRAY: &'static mut [isize] = &mut [1];
```
However, we do not allow this:
```rust
static mut INT: &'static mut isize = &mut 1;
```

I think that's terribly inconsistent. I don't care much for `static mut`, but we have to keep it around for backwards compatibility and so we have to keep supporting it properly in the compiler. In recent refactors of how we deal with mutability of data in `static` and `const`, I almost made a fatal mistake since I tested `static mut INT: &'static mut isize = &mut 1` and concluded that we don't allow such `'static` mutable references even inside `static mut`. After all, nobody would expect this to be allowed only for arrays and slices, right?!?? So for the sake of our own sanity, and of whoever else reverse engineers these rules in the future to understand what the Rust compiler accepts or does not accept, I propose that we accept this for all types, not just arrays and slices.
Remove support for `associated_type_bound` nested in `dyn` types

These necessarily desugar to `impl Trait`, which is inconsistent with the `associated_type_bound` feature after rust-lang#120584.

This PR keeps the `is_in_dyn_type` hack, which kind of makes me sad. Ideally, we'd be validating that no object types have associated type bounds somewhere else. Unfortunately, we can't do this later during astconv (i think?), nor can we do it earlier during ast validation (i think?) because of the feature gating of ATB being a *warning* rather than an *error*. Let me know if you have thoughts about this.

r? lcnr
Add documentation on `str::starts_with`

Add documentation about a current footgun of `str::starts_with`
…gn, r=RalfJung

Clarify that atomic and regular integers can differ in alignment

The documentation for atomic integers says that they have the "same in-memory representation" as their underlying integers. This might be misconstrued as implying that they have the same layout. Therefore, clarify that atomic integers' alignment is equal to their size.
Loosen an assertion to account for stashed errors.

The meaning of this assertion changed in rust-lang#120828 when the meaning of `has_errors` changed to exclude stashed errors. Evidently the new meaning is too restrictive.

Fixes rust-lang#120856.

r? ```@oli-obk```
…rcote

Turn the "no saved object file in work product" ICE into a translatable fatal error

I don't know if it's fair to say this fixes rust-lang#120854 but it surely makes the error reporting better and should encourage people with good instincts like ```@CinchBlue.```
…rrors

Remove unnecessary `#![feature(min_specialization)]`

As of rust-lang#119963 and rust-lang#120676, we can now rely on `newtype_index!` having `#[allow_internal_unstable(min_specialization)]`, so there are a few compiler crates that no longer need to include min-spec in their own crate features.

---

Some of the expansions of `newtype_index!` still appear to require min-spec in the crate features. I think this is because `#[orderable]` causes the expansion to include an implementation of `TrustedStep`, which is flagged with `#[rustc_specialization_trait]`, and for whatever reason that isn't permitted by allow-internal-unstable. So this PR only touches the crates where that isn't the case.
Allow restricted trait impls under `#[allow_internal_unstable(min_specialization)]`

This is a follow-up to rust-lang#119963 and a companion to rust-lang#120866, though it can land independently from the latter.

---

We have several compiler crates that only enable `#[feature(min_specialization)]` because it is required by their expansions of `newtype_index!`, in order to implement traits marked with `#[rustc_specialization_trait]`.

This PR allows those traits to be implemented internally by macros with `#[allow_internal_unstable(min_specialization)]`, without needing specialization to be enabled in the enclosing crate.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Feb 10, 2024
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=8

@bors
Copy link
Contributor

bors commented Feb 10, 2024

📌 Commit 5591336 has been approved by matthiaskrgr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 10, 2024
@bors
Copy link
Contributor

bors commented Feb 10, 2024

⌛ Testing commit 5591336 with merge 5f40394...

@bors
Copy link
Contributor

bors commented Feb 10, 2024

☀️ Test successful - checks-actions
Approved by: matthiaskrgr
Pushing 5f40394 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 10, 2024
@bors bors merged commit 5f40394 into rust-lang:master Feb 10, 2024
12 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Feb 10, 2024
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#117614 static mut: allow mutable reference to arbitrary types, not… 630909a909b11a7f4e83fd9443c2571f6ad58348 (link)
#120719 Remove support for associated_type_bound nested in dyn 2bcab55ebbe8027c5deeabdcb31e64cde856e6ba (link)
#120764 Add documentation on str::starts_with 077c03491c3334dd09e30b5f17ce5ed26d4d05b1 (link)
#120823 Clarify that atomic and regular integers can differ in alig… de3bd156b25e38c25f6f7394ad75b948d06e8558 (link)
#120859 Loosen an assertion to account for stashed errors. 53180d126b89a321380a0dc69736455946caffe6 (link)
#120865 Turn the "no saved object file in work product" ICE into a … 2759190e1f3ed7a42be0d47295589fe89505e64f (link)
#120866 Remove unnecessary #![feature(min_specialization)] 766bd436c7dcc4961761cd45296d9d931135588c (link)
#120870 Allow restricted trait impls under `#[allow_internal_unstab… 84c3ce2b4e78d277d715ce3ce02937a599645273 (link)

previous master: 232919c33a

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (5f40394): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.1% [-2.1%, -2.1%] 1
All ❌✅ (primary) - - 0

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.8% [2.8%, 2.8%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 1
All ❌✅ (primary) - - 0

Bootstrap: 666.159s -> 666.587s (0.06%)
Artifact size: 308.05 MiB -> 308.05 MiB (-0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.