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 7 pull requests #130768

Merged
merged 20 commits into from
Sep 24, 2024
Merged

Rollup of 7 pull requests #130768

merged 20 commits into from
Sep 24, 2024

Conversation

compiler-errors
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

notriddle and others added 20 commits September 10, 2024 17:56
This adds labels to the icons and moves them away from the search box.

These changes are made together, because they work together, but are based on
several complaints:

* The [+/-] thing are a Reddit-ism. They don't look like buttons, but look
  like syntax
  <https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/More.20visual.20difference.20for.20the.20.2B.2F-.20.20Icons>,
  <rust-lang#59851>
  (some of these are laundry lists with more suggestions, but they all
  mention [+/-] looking wrong)

* The settings, help, and summary buttons are also too hard to recognize
  <https://lwn.net/Articles/987070/>,
  <rust-lang#90310>,
  <rust-lang#14475 (comment)>,
  <https://internals.rust-lang.org/t/improve-rustdoc-design/12758>
  ("Not all functionality is self-explanatory, for example the [+] button in
  the top right corner, the theme picker or the settings button.")

The toggle-all and toggle-individual buttons both need done at once, since we
want them to look like they go together. This changes them from both being
[+/-] to both being arrows.

Settings and Help are also migrated, so that the whole group can benefit from
being described using actual words.

Additionally, the Help button is only shown on SERPs, not all the time.
This is done for two major reasons:

* Most of what's in there is search-related. The things that aren't are
  keyboard commands, and the search box tells you about that anyway.
  Pressing <kbd>?</kbd> will temporarily show the button and its popover.
* I'm trading it off by showing the help button, even on mobile.
  It's useful since you can use the search engine suggestions there.
* The three buttons were causing line wrapping on too many desktop layouts.
This tweaks it to use less space for the breadcrumbs.
Co-authored-by: Michael Goulet <michael@errs.io>
…GuillaumeGomez

rustdoc: redesign toolbar and disclosure widgets

Fixes rust-lang#77899
Fixes rust-lang#90310

## Preview

| before | after
| ------ | -----
| ![image](https://github.com/user-attachments/assets/ebeec185-3a72-481d-921e-a9a885f348d9) | ![image](https://github.com/user-attachments/assets/08735a65-99d1-4523-ab77-ddb164c0a5db)
| ![image](https://github.com/user-attachments/assets/ae8e0f24-49cb-445d-b9bd-cec9c57b94e7) | ![image](https://github.com/user-attachments/assets/ba484f94-b031-41fc-b8a8-6cd81be8fb6b)
| ![image](https://github.com/user-attachments/assets/8c2cc041-a138-4950-a12e-3d529c8a5339) | ![image](https://github.com/user-attachments/assets/e7f010bd-19e2-4711-85bf-3fd00c3e5647)
| ![image](https://github.com/user-attachments/assets/e2b63785-971c-489e-b069-eb85f6a30620) | ![image](https://github.com/user-attachments/assets/b65eea16-d6a3-4aa3-8a27-6ded74009010)
| ![image](https://github.com/user-attachments/assets/1c7b0901-a61a-4325-9d01-9d8b14b476aa) | ![image](https://github.com/user-attachments/assets/d4a485db-d9f1-4a62-94bc-a3d125ea6dc1)
| N/A | ![image](https://github.com/user-attachments/assets/7add0a2a-7fd7-483d-87ee-51ee45a2fe5d)
| ![image](https://github.com/user-attachments/assets/334f50bc-9f8d-42d9-a7df-95058f7cdfd5) | ![image](https://github.com/user-attachments/assets/451fcc22-b034-453c-ae4b-b948fd6bd779)
| ![image](https://github.com/user-attachments/assets/132f720c-802a-466d-bd55-c7a4750acdc3) | ![image](https://github.com/user-attachments/assets/177b7921-06c5-467d-87d3-9cdf88c4e50b)

https://notriddle.com/rustdoc-html-demo-12/toolbar-v2/std/index.html

## Description

This adds labels to the icons and moves them away from the search box.

These changes are made together, because they work together, but are based on several complaints:

* The [+/-] thing are a Reddit-ism. They don't look like buttons, but look like syntax <https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/More.20visual.20difference.20for.20the.20.2B.2F-.20.20Icons>, <rust-lang#59851> (some of these are laundry lists with more suggestions, but they all mention [+/-] looking wrong)

* The settings, help, and summary buttons are also too hard to recognize <https://lwn.net/Articles/987070/>, <rust-lang#90310>, <rust-lang#14475 (comment)>, <https://internals.rust-lang.org/t/improve-rustdoc-design/12758> ("Not all functionality is self-explanatory, for example the [+] button in the top right corner, the theme picker or the settings button.")

The toggle-all and toggle-individual buttons both need done at once, since we want them to look like they go together. This changes them from both being [+/-] to both being arrows.

CC <rust-lang#113074 (comment)> and ``@jsha`` regarding the use of triangles for disclosure, which is what everyone wanted, but was pending a good toggle-all button. This PR adds a toggle-all button that should work.

Settings and Help are also migrated, so that the whole group can benefit from being described using actual words.

The breadcrumbs also get redesigned, so that they use less space, by shrinking the parent module path parts. This is done at the same time as the toolbar redesign because it's, effectively, moving space from the toolbar to the breadcrumbs.
This is aimed at avoiding any line wrapping at desktop sizes.

## Prior art

This style of toolbar, with explicit labels on the buttons, used to be more popular. It's not very common in web browsers nowadays, and for truly universal icons like ⬅️ I can understand why, but words are great when icons fail.

![image](https://github.com/user-attachments/assets/9a4a0498-232d-4d60-87b9-f601f4515254)
Skip query in get_parent_item when possible.

For HirIds with a non-zero item local id, `self.parent_owner_iter(hir_id).next()` just returns the same HirId with the item local id set to 0, but also does a query to retrieve the Node which is ignored here, which seems wasteful.
Check vtable projections for validity in miri

Currently, miri does not catch when we transmute `dyn Trait<Assoc = A>` to `dyn Trait<Assoc = B>`. This PR implements such a check, and fixes rust-lang/miri#3905.

To do this, we modify `GlobalAlloc::VTable` to contain the *whole* list of `PolyExistentialPredicate`, and then modify `check_vtable_for_type` to validate the `PolyExistentialProjection`s of the vtable, along with the principal trait that was already being validated.

cc ``@RalfJung``
r? ``@lcnr`` or types

I also tweaked the diagnostics a bit.

---

**Open question:** We don't validate the auto traits. You can transmute `dyn Foo` into `dyn Foo + Send`. Should we check that? We currently have a test that *exercises* this as not being UB:

https://github.com/rust-lang/rust/blob/6c6d210089e4589afee37271862b9f88ba1d7755/src/tools/miri/tests/pass/dyn-upcast.rs#L14-L20

I'm not actually sure if we ever decided that's actually UB or not 🤔

We could perhaps still check that the underlying type of the object (i.e. the concrete type that was unsized) implements the auto traits, to catch UB like:

```rust
fn main() {
    let x: &dyn Trait = &std::ptr::null_mut::<()>();
    let _: &(dyn Trait + Send) = std::mem::transmute(x);
    //~^ this vtable is not allocated for a type that is `Send`!
}
```
…ieyouxu

Add new Tier-3 target: `loongarch64-unknown-linux-ohos`

MCP: rust-lang/compiler-team#784
…mit, r=jieyouxu

Revert "Add recursion limit to FFI safety lint"

It's not necessarily clear if warning when we hit the recursion limit is the right thing to do, first of all.

**More importantly**, this PR was implemented incorrectly in the first place; it was not decrementing the recursion limit when stepping out of a type, so it would trigger when a ctype has more than RECURSION_LIMIT fields *anywhere* in the type's set of recursively reachable fields.

Reverts rust-lang#130598
Reopens rust-lang#130310
Fixes rust-lang#130757
Update books

## rust-lang/book

5 commits in e7d217be2a75ef1753f0988d6ccaba4d7e376259..99cf75a5414fa8adbe3974bd0836661ca901708f
2024-09-23 16:18:39 UTC to 2024-09-11 18:38:03 UTC

- translations: remove broken link (rust-lang/book#4036)
- Update build instructions: include mdbook plugins (rust-lang/book#4032)
- Add `cargo init` usage suggestion to 1.3 (rust-lang/book#4025)
- Use immutable borrow of `TcpStream` when creating `BufReader` (rust-lang/book#4024)
- Upgrade to Rust 1.81 (rust-lang/book#4031)

## rust-lang/edition-guide

1 commits in b3ca7ade0f87d7e3fb538776defc5b2cc4188172..c7ebae25cb4801a31b6f05353f6d85bfa6feedd1
2024-09-22 08:47:02 UTC to 2024-09-22 08:47:02 UTC

- Update static_mut_refs now that it is a lint (rust-lang/edition-guide#322)

## rust-lang/reference

10 commits in 687faf9958c52116d003b41dfd29cc1cf44f5311..24fb2687cdbc54fa18ae4acf5d879cfceca77b2c
2024-09-22 09:07:12 UTC to 2024-09-10 19:24:17 UTC

- do not talk about the 'address of a constant' (rust-lang/reference#1624)
- Add spec identifier syntax to interior-mutability.md (rust-lang/reference#1585)
- Add spec identifier syntax to input-format.md (rust-lang/reference#1584)
- Document limitations on block doc comments (rust-lang/reference#1602)
- Places based on misaligned pointers: also mention 'static's as a possible base for place projections (rust-lang/reference#1606)
- type-layout: mention that call ABI compatibility is a separate concern (rust-lang/reference#1608)
- stabilize `const_extern_fn` (rust-lang/reference#1596)
- const_eval: update for const_mut_refs and const_refs_to_cell stabilization (rust-lang/reference#1590)
- fix: unclosed tag `sup` (rust-lang/reference#1612)
- Fix improper documentation on casting non_exhaustive enums (rust-lang/reference#1607)

## rust-lang/rustc-dev-guide

13 commits in 0ed9229f5b6f7824b333beabd7e3d5ba4b9bd971..555f3de2fa0d61c4294b74d245f1cbad6fcbf589
2024-09-23 12:51:33 UTC to 2024-09-10 07:32:10 UTC

- chore: add missing `.` (rust-lang/rustc-dev-guide#2074)
- Add remark on required free disk space (rust-lang/rustc-dev-guide#2073)
- fix broken links (rust-lang/rustc-dev-guide#2063)
- Add advice about submitting potentially hard-to-review PRs (rust-lang/rustc-dev-guide#2036)
- Edit a sentence for clarity (rust-lang/rustc-dev-guide#2071)
- Emphasize how to run a single tool test (rust-lang/rustc-dev-guide#2070)
- Remove chalk is owned by WG-traits (rust-lang/rustc-dev-guide#2068)
- Fix conditions lowering text for enums with no fields (rust-lang/rustc-dev-guide#2066)
- update proof tree chapter (rust-lang/rustc-dev-guide#2054)
- Add docs for JS tests (rust-lang/rustc-dev-guide#2048)
- Reflect `x.py test`'s `--rustc-args` option being renamed to `--compiletest-rustc-args` (rust-lang/rustc-dev-guide#2062)
- we standardized on this more reliable command (rust-lang/rustc-dev-guide#2061)
- Fix Typo and Remove Outdated Line About C Variadics (rust-lang/rustc-dev-guide#2060)
…tolnay

stabilize const_intrinsic_copy

Fixes rust-lang#80697

This stabilizes
```rust
mod ptr {
    pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
    pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize);
}

impl *const T {
    pub const unsafe fn copy_to(self, dest: *mut T, count: usize);
    pub const unsafe fn copy_to_nonoverlapping(self, dest: *mut T, count: usize);
}

impl *mut T {
    pub const unsafe fn copy_to(self, dest: *mut T, count: usize);
    pub const unsafe fn copy_to_nonoverlapping(self, dest: *mut T, count: usize);

    pub const unsafe fn copy_from(self, src: *const T, count: usize);
    pub const unsafe fn copy_from_nonoverlapping(self, src: *const T, count: usize);
}

impl <T> NonNull<T> {
    pub const unsafe fn copy_to(self, dest: NonNull<T>, count: usize);
    pub const unsafe fn copy_to_nonoverlapping(self, dest: NonNull<T>, count: usize);

    pub const unsafe fn copy_from(self, src: NonNull<T>, count: usize);
    pub const unsafe fn copy_from_nonoverlapping(self, src: NonNull<T>, count: usize);
}
```
In particular, this reverts rust-lang#117905, which reverted rust-lang#97276.

The `NonNull` methods are not listed in the tracking issue, they were added to this feature gate in rust-lang#124498. The existing [FCP](rust-lang#80697 (comment)) does not cover them. They are however entirely identical to the `*mut` methods and already stable outside `const`. ``@rust-lang/libs-api`` please let me know if FCP will be required for the `NonNull` methods.
@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Sep 24, 2024
@compiler-errors
Copy link
Member Author

@bors r+ rollup=never p=7

@bors
Copy link
Contributor

bors commented Sep 24, 2024

📌 Commit 64aa4c6 has been approved by compiler-errors

It is now in the queue for this repository.

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

bors commented Sep 24, 2024

⌛ Testing commit 64aa4c6 with merge 4cadeda...

@bors
Copy link
Contributor

bors commented Sep 24, 2024

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing 4cadeda to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 24, 2024
@bors bors merged commit 4cadeda into rust-lang:master Sep 24, 2024
7 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 24, 2024
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#129545 rustdoc: redesign toolbar and disclosure widgets 38b0a66198cd96769ac301613b7b2e31e7f5c630 (link)
#130618 Skip query in get_parent_item when possible. 11d42e2fa5ffa40ee15d16e941c7196e0d436be6 (link)
#130727 Check vtable projections for validity in miri 3d59fcb96032dfab90d15dc84a0c57b62c7a45ec (link)
#130750 Add new Tier-3 target: loongarch64-unknown-linux-ohos f36fc0da4cd509b0d36b6f4f50e693e2b1069ec2 (link)
#130758 Revert "Add recursion limit to FFI safety lint" b39a5a1d87e24bc4fd400aad105a60d01405197a (link)
#130759 Update books 268ba653a3cacd2f1badd2552ad90aa6161afa42 (link)
#130762 stabilize const_intrinsic_copy 98096474641586d6b671eb5e1954373535538425 (link)

previous master: f5cd2c5888

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 (4cadeda): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was 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.3% [-0.7%, -0.1%] 14
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -0.1%, secondary -0.0%)

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)
1.1% [0.8%, 1.2%] 3
Regressions ❌
(secondary)
3.2% [1.5%, 5.2%] 4
Improvements ✅
(primary)
-1.0% [-1.3%, -0.4%] 4
Improvements ✅
(secondary)
-2.2% [-3.1%, -0.9%] 6
All ❌✅ (primary) -0.1% [-1.3%, 1.2%] 7

Cycles

Results (primary 0.9%, secondary 0.3%)

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.9% [0.9%, 0.9%] 1
Regressions ❌
(secondary)
2.2% [2.2%, 2.2%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.7% [-1.7%, -1.7%] 1
All ❌✅ (primary) 0.9% [0.9%, 0.9%] 1

Binary size

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

Bootstrap: 767.582s -> 768.999s (0.18%)
Artifact size: 341.38 MiB -> 340.87 MiB (-0.15%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc 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-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants