Improve CSS for "hide item contents, not items"#1
Merged
Manishearth merged 1 commit intoManishearth:item-hidefrom Mar 28, 2021
Merged
Improve CSS for "hide item contents, not items"#1Manishearth merged 1 commit intoManishearth:item-hidefrom
Manishearth merged 1 commit intoManishearth:item-hidefrom
Conversation
This was referenced Mar 27, 2021
4e24980 to
7cd0306
Compare
Introduce a first use of the `<details>` and `<summary>` tags as replacements for the JS-built toggles. I think this has the potential to replace all the JS toggles and generally clean up the JS, CSS, and HTML. Split rendering of attributes into two cases: in the case where they are rendered as descendents of a `<pre>` tag, where they use indent spaces and newlines for formatting, matching their surrounding markup. In the case where they are rendered as descendants of a `<code>` tag, they are rendered as `<div>`. This let me clean up some fragile CSS that was adjusting the margin-left of attributes depending on context. Remove toggles for attributes. With the ALLOWED_ATTRIBUTES filter, it's rare for an item to have more than one attribute, so hiding attributes behind a toggle doesn't save any screen space in the common case. Fix a couple of invocations of `matches!` that didn't compile on my machine. Fix a boolean for the JS `createToggle` call that was causing "Expand description" to show up spuriously on already-expanded descriptions. Add JS for auto-hide settings and hide all / show all. Remove a z-index property and some font color tweaks made unnecessary by the <details> toggles. Add CSS for the <details> toggles.
7cd0306 to
79bd6be
Compare
Manishearth
reviewed
Mar 28, 2021
Owner
Manishearth
left a comment
There was a problem hiding this comment.
Haven't had a close look but mostly looks good so far, feel free to make these changes if I don't end up doing so first
| // a div to produce a newline after it. | ||
| fn render_attributes_in_code(w: &mut Buffer, it: &clean::Item) { | ||
| for a in attributes(it) { | ||
| write!(w, "<div>{}</div>", a); |
Owner
There was a problem hiding this comment.
we should probably give this a class
| /* This part is to fix the "Expand attributes" part in the type declaration. */ | ||
| .type-decl > pre > .toggle-wrapper.toggle-attributes.top-attr { | ||
| margin-left: 0 !important; | ||
| /* The hideme class is used on summary tags that contain a span with |
Owner
There was a problem hiding this comment.
People use <details> in doc contents as well, we absolutely should be using details.someclass here
Manishearth
pushed a commit
that referenced
this pull request
Aug 26, 2021
Otherwise, we can get into a situation where you have a subtype obligation `#1 <: rust-lang#2` pending, #1 is constrained by `check_casts`, but rust-lang#2` is unaffected. Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
Manishearth
pushed a commit
that referenced
this pull request
May 24, 2023
…t, r=tmiasko Encode def span for foreign return-position `impl Trait` in trait Fixes rust-lang#111031, yet another def-span encoding issue :/ Includes a smaller repro than the issue, but I can confirm it ICEs: ``` query stack during panic: #0 [def_span] looking up span for `rpitit::Foo::bar::{opaque#0}` #1 [object_safety_violations] determining object safety of trait `rpitit::Foo` rust-lang#2 [check_is_object_safe] checking if trait `rpitit::Foo` is object safe rust-lang#3 [typeck] type-checking `main` rust-lang#4 [used_trait_imports] finding used_trait_imports `main` rust-lang#5 [analysis] running analysis passes on this crate ``` Luckily since this only affects nightly, this desn't need to be backported.
Manishearth
pushed a commit
that referenced
this pull request
May 24, 2023
Add Terminator conversion from MIR to SMIR, part #1 This adds internal MIR TerminatorKind to SMIR Terminator conversion. r? ```@oli-obk```
Manishearth
pushed a commit
that referenced
this pull request
May 24, 2023
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#110577 (Use fulfillment to check `Drop` impl compatibility) - rust-lang#110610 (Add Terminator conversion from MIR to SMIR, part #1) - rust-lang#110985 (Fix spans in LLVM-generated inline asm errors) - rust-lang#110989 (Make the BUG_REPORT_URL configurable by tools ) - rust-lang#111167 (debuginfo: split method declaration and definition) - rust-lang#111230 (add hint for =< as <=) - rust-lang#111279 (More robust debug assertions for `Instance::resolve` on built-in traits with non-standard trait items) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Manishearth
pushed a commit
that referenced
this pull request
May 24, 2023
Stop turning transmutes into discriminant reads in mir-opt Partially reverts rust-lang#109612, as after rust-lang#109993 these aren't actually equivalent any more, and I'm no longer confident this was ever an improvement in the first place. Having this "simplification" meant that similar-looking code actually did somewhat different things. For example, ```rust pub unsafe fn demo1(x: std::cmp::Ordering) -> u8 { std::mem::transmute(x) } pub unsafe fn demo2(x: std::cmp::Ordering) -> i8 { std::mem::transmute(x) } ``` in nightly today is generating <https://rust.godbolt.org/z/dPK58zW18> ```llvm define noundef i8 `@_ZN7example5demo117h341ef313673d2ee6E(i8` noundef %x) unnamed_addr #0 { %0 = icmp uge i8 %x, -1 %1 = icmp ule i8 %x, 1 %2 = or i1 %0, %1 call void `@llvm.assume(i1` %2) ret i8 %x } define noundef i8 `@_ZN7example5demo217h5ad29f361a3f5700E(i8` noundef %0) unnamed_addr #0 { %x = alloca i8, align 1 store i8 %0, ptr %x, align 1 %1 = load i8, ptr %x, align 1, !range !2, !noundef !3 ret i8 %1 } ``` Which feels too different when the original code is essentially identical. --- Aside: that example is different *after* optimizations too: ```llvm define noundef i8 `@_ZN7example5demo117h341ef313673d2ee6E(i8` noundef returned %x) unnamed_addr #0 { %0 = add i8 %x, 1 %1 = icmp ult i8 %0, 3 tail call void `@llvm.assume(i1` %1) ret i8 %x } define noundef i8 `@_ZN7example5demo217h5ad29f361a3f5700E(i8` noundef returned %0) unnamed_addr #1 { ret i8 %0 } ``` so turning the `Transmute` into a `Discriminant` was arguably just making things worse, so leaving it alone instead -- and thus having less code in rustc -- seems clearly better.
Manishearth
pushed a commit
that referenced
this pull request
May 24, 2023
Fixes rust-lang#111510 and complements rust-lang#106547 by adding support for encoding type parameters and also by transforming trait objects' traits into their identities before emitting type checks.
Manishearth
pushed a commit
that referenced
this pull request
May 24, 2023
CFI: Fix encode_ty: unexpected Param(B/#1) Fixes rust-lang#111510 and complements rust-lang#106547 by adding support for encoding type parameters and also by transforming trait objects' traits into their identities before emitting type checks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce a first use of the
<details>and<summary>tags asreplacements for the JS-built toggles. I think this has the potential to
replace all the JS toggles and generally clean up the JS, CSS, and HTML.
Split rendering of attributes into two cases: in the case where they are
rendered as descendents of a
<pre>tag, where they use indent spaces andnewlines for formatting, matching their surrounding markup. In the case
where they are rendered as descendants of a
<code>tag, they arerendered as
<div>. This let me clean up some fragile CSS that wasadjusting the margin-left of attributes depending on context.
Remove toggles for attributes. With the ALLOWED_ATTRIBUTES filter, it's
rare for an item to have more than one attribute, so hiding attributes
behind a toggle doesn't save any screen space in the common case.
Fix a couple of invocations of
matches!that didn't compile on mymachine.
Restore a conditional for the JS
createTogglecall that was causing"Expand description" to show up spuriously on already-expanded
descriptions.
Add JS for auto-hide settings and hide all / show all.
Remove a z-index property and some font color tweaks made unnecessary
by the
<details>toggles.Add CSS for the
<details>toggles.Examples at:
https://hoffman-andrews.com/rust/item-hide/std/iter/trait.Iterator.html
https://hoffman-andrews.com/rust/item-hide/std/convert/trait.Into.html
https://hoffman-andrews.com/rust/item-hide/std/io/trait.Read.html
https://hoffman-andrews.com/rust/item-hide/std/option/enum.Option.html
Addition to rust-lang#83337