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 4 pull requests #118975

Merged
merged 19 commits into from
Dec 15, 2023
Merged

Rollup of 4 pull requests #118975

merged 19 commits into from
Dec 15, 2023

Conversation

GuillaumeGomez
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

notriddle and others added 19 commits October 11, 2023 10:26
* Run the querySelector for the toggleLabel only once, and store
  the result.
* Use querySelector to find the resizer and sidebar.
* Add comments to main.js sections.
This removes an HTTP request from the loading pipeline,
and allows it to be changed with a media query.
This makes two changes, based on experimenting with different browsers:

- It debounces resizing the body text. This improves behavior on huge
  pages like struct.Vec.html, because it doesn't have to do layout.

- It does the sidebar width updates directly on the sidebar instead of
  doing it on the `<HTML>` element. Doing it on `<HTML>` causes it
  to recalculate CSS for the entire document, also causing layout jank.
Stop allowing `rustc::potential_query_instability` on all of
`rustc_mir_build` and instead allow it on a case-by-case basis if it is
safe to do so. In this crate there was no instance of the lint
remaining.
…eexport, r=rustdoc

Don't merge cfg and doc(cfg) attributes for re-exports

Fixes rust-lang#112881.

## Explanations

When re-exporting things with different `cfg`s there are two things that can happen:

 * The re-export uses a subset of `cfg`s, this subset is sufficient so that the item will appear exactly with the subset
 * The re-export uses a non-subset of `cfg`s (e.g. like the example I posted just above where the re-export is ungated), if the non-subset `cfg`s are active (e.g. compiling that example on windows) then this will be a compile error as the item doesn't exist to re-export, if the subset `cfg`s are active it behaves like 1.

### Glob re-exports?

**This only applies to non-glob inlined re-exports.** For glob re-exports the item may or may not exist to be re-exported (potentially the `cfg`s on the path up until the glob can be removed, and only `cfg`s on the globbed item itself matter), for non-inlined re-exports see rust-lang#85043.

cc `@Nemo157`
r? `@notriddle`
…, r=GuillaumeGomez

rustdoc: allow resizing the sidebar / hiding the top bar

Fixes rust-lang#97306

Preview: http://notriddle.com/rustdoc-html-demo-4/sidebar-resize/std/index.html

![image](https://github.com/rust-lang/rust/assets/1593513/a2f40ea2-0436-4e44-99e8-d160dab2a680)

## Summary

This feature adds:

1. A checkbox to the Settings popover to hide the persistent navigation bar (the sidebar on large viewports and the top bar on small ones).
2. On large viewports, it adds a resize handle to the persistent sidebar. Resizing it into nothing is equivalent to turning off the persistent navigation bar checkbox in Settings.
3. If the navigation bar is hidden, a toolbar button to the left of the search appears. Clicking it brings the navigation bar back.

## Motivation

While "mobile mode" is definitely a good default, it's not the only reason people have wanted to hide the sidebar:

* Some people use tiling window managers, and don't like rustdoc's current breakpoints. Changing the breakpoints might help with that, but there's no perfect solution, because there's a gap between "huge screen" and "smartphone" where reasonable people can disagree about whether it makes sense for the sidebar to be on-screen. rust-lang#97306

* Some people ask for ways to reduce on-screen clutter because it makes it easier to focus. There's not a media query for that (and if there was, privacy-conscious users would turn it off). rust-lang#59829

This feature is designed to avoid these problems. Resizing the sidebar especially helps, because it provides a way to hide the sidebar without adding a new top-level button (which would add clutter), and it provides a way to make rustdoc play nicer in complex, custom screen layouts.

## Guide and Reference-level explanation

On a desktop or laptop with a mouse, resize the sidebar by dragging its right edge.

On any browser, including mobile phones, the sticky top bar or side bar can be hidden from the Settings area (the button with the cog wheel, next to the search bar). When it's hidden, a convenient button will appear on the search bar's left.

## Drawbacks

This adds more JavaScript code to the render blocking area.

## Rationale and alternatives

The most obvious way to allow people to hide the sidebar would have been to let them "manually enter mobile mode." The upside is that it's a feature we already have. The downside is that it's actually really hard to come up with a terse description. Is it:

* A Setting that forces desktop viewers to always have the mobile-style top bar? If so, how do we label it? Should it be visible on mobile, and, if so, does it just not do anything?
* A persistent hide/show sidebar button, present on desktop, just like on mobile? That's clutter that I'd like to avoid.

## Prior art

* The new file browser in GitHub uses a similar divider with a mouse-over indicator
* mdBook and macOS Finder both allow you to resize the sidebar to nothing as a gesture to hide it
* https://www.nngroup.com/articles/drag-drop/

## Future possibilities

https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Table.20of.20contents proposes a new, second sidebar (a table of contents). How should it fit in with this feature? Should it be resizeable? Hideable? Can it be accessed on mobile?
…ility, r=michaelwoerister

rustc_mir_build: Enforce `rustc::potential_query_instability` lint

Stop allowing `rustc::potential_query_instability` on all of `rustc_mir_build` and instead allow it on a case-by-case basis if it is safe to do so. In this crate there was only one instance of the lint, and it was safe to allow.

Part of rust-lang#84447 which is E-help-wanted.
…ref_casting, r=est31

Some cleanup and improvement for invalid ref casting impl

This PR makes some cleanups and improvements to the `invalid_reference_casting` implementation in preparation for linting on new patterns, while reusing most of the logic.

r? `@est31` (feel free to re-assign)
@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-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Dec 15, 2023
@GuillaumeGomez
Copy link
Member Author

@bors r+ p=4 rollup=never

@bors
Copy link
Contributor

bors commented Dec 15, 2023

📌 Commit 25216b6 has been approved by GuillaumeGomez

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 Dec 15, 2023
@bors
Copy link
Contributor

bors commented Dec 15, 2023

⌛ Testing commit 25216b6 with merge 4d1bd0d...

@bors
Copy link
Contributor

bors commented Dec 15, 2023

☀️ Test successful - checks-actions
Approved by: GuillaumeGomez
Pushing 4d1bd0d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 15, 2023
@bors bors merged commit 4d1bd0d into rust-lang:master Dec 15, 2023
12 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Dec 15, 2023
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#113091 Don't merge cfg and doc(cfg) attributes for re-exports 3369745922d0139206ce332c8e1e2ca227aaf4a9 (link)
#115660 rustdoc: allow resizing the sidebar / hiding the top bar 75b8c3850fc862ef55a386b475b25defff2d2aaa (link)
#118863 rustc_mir_build: Enforce `rustc::potential_query_instabilit… b00eeacf531198b9beab0065cce335399dd17e17 (link)
#118909 Some cleanup and improvement for invalid ref casting impl 338d35117152f3e43d53772d926fac58b57d1021 (link)

previous master: 96df494340

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

@GuillaumeGomez GuillaumeGomez deleted the rollup-0emhjx0 branch December 15, 2023 14:52
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (4d1bd0d): 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.6% [0.6%, 0.6%] 1
Regressions ❌
(secondary)
5.6% [5.6%, 5.6%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.1% [-4.1%, -4.1%] 1
All ❌✅ (primary) 0.6% [0.6%, 0.6%] 1

Cycles

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

Binary size

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

Bootstrap: 671.047s -> 674.139s (0.46%)
Artifact size: 312.39 MiB -> 312.37 MiB (-0.01%)

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-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.

7 participants