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

Reintroduce spotlight / "important traits" feature #74370

Merged
merged 8 commits into from
Jul 16, 2020

Conversation

Manishearth
Copy link
Member

(Reopened version of #74111 because Github is broken, see discussion there)

Fixes #73785

This PR reintroduces the "spotlight" ("important traits") feature.

A couple changes have been made:

As there were concerns about its visibility, it has been moved to be next to the return type, as opposed to being on the side.

It also no longer produces a modal, it shows the traits on hover, and it can be clicked on to pin the hover bubble.

image

image

It also works fine on mobile:

image

@rust-highfive
Copy link
Collaborator

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez

Some changes occurred in HTML/CSS themes.

cc @GuillaumeGomez

@rust-highfive
Copy link
Collaborator

r? @ollie27

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 15, 2020
@Manishearth
Copy link
Member Author

r? @GuillaumeGomez

@Manishearth Manishearth force-pushed the re-spotlight branch 6 times, most recently from c35e99d to 1a6fe87 Compare July 15, 2020 17:17
Copy link
Member

@ollie27 ollie27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've noticed a bit of a graphic glitch for free functions:

image


if let Some(did) = decl.output.def_id() {
let c = cache();
if let Some(impls) = c.impls.get(&did) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a good way to find applicable impls because it doesn't take into account things like generic parameters and mutability. For example:

image

and

image

I'd imagine this will need to use a mechanism similar to how auto trait and blankets impls are found.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this is reintroducing an old feature that was previously accepted in this form, can we handle this as a followup?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like, I want to ladn this so we can gather more community feedback on this feature and grow it. It's a feature that existed in this form for a while and was recently removed, my priority is getting it back in so we can improve it.

@Manishearth
Copy link
Member Author

@ollie27 Guillaume has said he's good with this once we have your approval. Would you be okay with landing this with followups filed? I would rather keep this PR scoped to mostly bringing the feature back as is, with some basic UI changes. I want to do improvements differently, with a tracking issue.

@ollie27
Copy link
Member

ollie27 commented Jul 16, 2020

I'm really not a fan of reintroducing bugs but I guess it's not the end of the world. There's even an old issue still open (#55082) for the impls that aren't applicable.

Could the issue with free functions I pointed out in #74370 (review) be fixed though? That wasn't an issue with the old implementation. If it's too difficult to fix then the important traits feature could be disabled for those functions for now.

@Manishearth
Copy link
Member Author

Yeah I can fix that, i didn't immediately understand what the bug was but I do now

@Manishearth
Copy link
Member Author

@ollie27 It was the selector in #44671 not being specific enough, Fixed

@Manishearth
Copy link
Member Author

image

@Manishearth
Copy link
Member Author

@ollie27 Guillaume is holding off on r+ing until you confirm the fix above, can you do so?

@bors
Copy link
Contributor

bors commented Jul 16, 2020

☔ The latest upstream changes (presumably #72481) made this pull request unmergeable. Please resolve the merge conflicts.

This makes the spotlight show on hover instead of click. Clicks can be
used to persist it, which is also what's used on mobile.
@ollie27
Copy link
Member

ollie27 commented Jul 16, 2020

Looks good now, glad it was an easy fix.

@Manishearth
Copy link
Member Author

@bors r=GuillaumeGomez

@bors
Copy link
Contributor

bors commented Jul 16, 2020

📌 Commit c621a54 has been approved by GuillaumeGomez

@bors
Copy link
Contributor

bors commented Jul 16, 2020

🌲 The tree is currently closed for pull requests below priority 5, this pull request will be tested once the tree is reopened

@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 Jul 16, 2020
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 16, 2020
…meGomez

Reintroduce spotlight / "important traits" feature

(Reopened version of rust-lang#74111 because Github is broken, see discussion there)

Fixes rust-lang#73785

This PR reintroduces the "spotlight" ("important traits") feature.

A couple changes have been made:

As there were concerns about its visibility, it has been moved to be next to the return type, as opposed to being on the side.

It also no longer produces a modal, it shows the traits on hover, and it can be clicked on to pin the hover bubble.

![image](https://user-images.githubusercontent.com/1617736/86674555-a82d2600-bfad-11ea-9a4a-a1a9ffd66ae5.png)

![image](https://user-images.githubusercontent.com/1617736/86674533-a1061800-bfad-11ea-9e8a-c62ad86ed0d7.png)

It also works fine on mobile:

![image](https://user-images.githubusercontent.com/1617736/86674638-bda25000-bfad-11ea-8d8d-1798b608923e.png)
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 16, 2020
…arth

Rollup of 21 pull requests

Successful merges:

 - rust-lang#73566 (Don't run `everybody_loops` for rustdoc; instead ignore resolution errors)
 - rust-lang#73771 (Don't pollute docs/suggestions with libstd deps)
 - rust-lang#73794 (Small cleanup for E0705 explanation)
 - rust-lang#73807 (rustdoc: glue tokens before highlighting)
 - rust-lang#73835 (Clean up E0710 explanation)
 - rust-lang#73926 (Ignoring test case: [codegen] repr-transparent-aggregates-1.rs for aarch64)
 - rust-lang#73981 (Remove some `ignore-stage1` annotations.)
 - rust-lang#73998 (add regression test for rust-lang#61216)
 - rust-lang#74140 (Make hir ProjectionKind more precise)
 - rust-lang#74148 (Move #[doc(alias)] check in rustc)
 - rust-lang#74159 (forbid generic params in the type of const params)
 - rust-lang#74171 (Fix 44056 test with debug on macos.)
 - rust-lang#74221 (Don't panic if the lhs of a div by zero is not statically known)
 - rust-lang#74325 (Focus on the current file in the source file sidebar)
 - rust-lang#74359 (rustdoc: Rename internal API fns to `into_string`)
 - rust-lang#74370 (Reintroduce spotlight / "important traits" feature)
 - rust-lang#74390 (Fix typo in std::mem::transmute documentation)
 - rust-lang#74391 (BtreeMap: superficially refactor root access)
 - rust-lang#74392 (const generics triage)
 - rust-lang#74397 (Fix typo in the latest release note)
 - rust-lang#74406 (Set shell for github actions CI)

Failed merges:

r? @ghost
@bors bors merged commit fc09817 into rust-lang:master Jul 16, 2020
@Manishearth
Copy link
Member Author

I'll do the follow-ups soonish

@Manishearth
Copy link
Member Author

Followup: #74417

I'll open an internals thread to workshop the UI and name once it's on nightly

@Manishearth
Copy link
Member Author

@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reintroduce spotlight feature ("important traits")
6 participants