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

"{N} Implementations" hint is repeated #16157

Closed
landaire opened this issue Dec 18, 2023 · 5 comments · Fixed by #16163
Closed

"{N} Implementations" hint is repeated #16157

landaire opened this issue Dec 18, 2023 · 5 comments · Fixed by #16163
Assignees
Labels
C-bug Category: bug

Comments

@landaire
Copy link

When examining a struct generated with ouroboros, the hint specifying the number of implementations is repeated as shown in this screenshot:

CleanShot 2023-12-18 at 14 42 52@2x

To reproduce, clone ouroboros:

$ git clone https://github.com/joshua-maros/ouroboros

Then view one of the examples in examples/src/lib.rs.

I think this probably surfaces as a side effect of the crate's code generation, but clicking any of the repeated "implementations" hints shows exactly the same data.

rust-analyzer version:

rust-analyzer version: 0.4.1772-standalone (21b06c1be 2023-12-15)

rustc version:

rustc 1.76.0-nightly (5facb422f 2023-11-28)
@landaire landaire added the C-bug Category: bug label Dec 18, 2023
@rben01
Copy link

rben01 commented Dec 19, 2023

In the attached screenshot, is it repeated 8 times (once per implementation)?

@landaire
Copy link
Author

landaire commented Dec 19, 2023

It seems to be repeated infinitely based on editor width. In my own project where I first noticed it, there are 9 implementations but I counted at least 9. There are also at least 9 in the screenshot I attached. This video shows it a bit better

CleanShot.2023-12-18.at.19.38.03.mp4

@Young-Flash
Copy link
Member

seems not infinitely repeated for all case

image

@Veykril
Copy link
Member

Veykril commented Dec 19, 2023

Cause is most likely that the struct name's span is being reused for a bunch of other ADT defs / trait definitions. A bit weird that such an impl here affects all of them though nevermind I know why that is. We should probably only check for the same identifier mapping here.
image

@landaire
Copy link
Author

@Veykril thanks for taking a look and for the the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants