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

Item names displayed by RLS can be from indirect dependencies #42393

Closed
sophiajt opened this issue Jun 2, 2017 · 6 comments
Closed

Item names displayed by RLS can be from indirect dependencies #42393

sophiajt opened this issue Jun 2, 2017 · 6 comments
Labels
A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@sophiajt
Copy link
Contributor

sophiajt commented Jun 2, 2017

Playing around with Piston this morning, I noticed that there are sometimes cases where the compiler reports a type, but if you actually try to type this type it will error.

image

You can see the type on hover here as piston_window::Texture<gfx_device_gl::Resources>. Great! Let's type that in...

image

Wait what? You just told me that was the type. Don't tease me.

I'm guessing this type just isn't visible to me? I'm honestly not 100% sure what is happening.

(apologies if this is a dupe)

@arielb1
Copy link
Contributor

arielb1 commented Jun 3, 2017

Sure enough. gfx_device_gl is an external crate, that your code is not using (otherwise it would work), but is used indirectly from places like https://github.com/gfx-rs/gfx/blob/7014ffd9fc5f549eaa67393de1f2421ea195d39b/src/lib.rs.

Because it's a crate, it's not really private - you could add extern crate gfx_device_gl; to your code and the respective dependency to Cargo, and then it would work.

This is sort-of related to #19792.

@arielb1
Copy link
Contributor

arielb1 commented Jun 3, 2017

I'm not sure what is the best thing to output in this situation, but it's possible we could do better.

@arielb1 arielb1 changed the title Untypable types from the compiler Item names displayed by the compiler can be from indirect dependencies Jun 3, 2017
@arielb1
Copy link
Contributor

arielb1 commented Jun 3, 2017

Actually, I think we already solved this and you just need to use absolute paths there (piston_window::Texture<::gfx_device_gl::Resources>).

@sophiajt
Copy link
Contributor Author

sophiajt commented Jun 3, 2017

@arielb1 - that fix gives a different error.

image

It's possible this new error is correct, but would require yet more steps, since the type is coming from a crate I haven't added as dependency directly on my project.

After poking around, I found there is a type provided that can match called G2dTexture that comes from the same piston crate. No idea if we can suggest things like this, but it would have saved an hour if we could.

@arielb1
Copy link
Contributor

arielb1 commented Jun 3, 2017

After poking around, I found there is a type provided that can match called G2dTexture that comes from the same piston crate. No idea if we can suggest things like this, but it would have saved an hour if we could.

Automatic type alias completion. That's not something we are likely to introduce, I think.

@Mark-Simulacrum Mark-Simulacrum added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. labels Jun 23, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 27, 2017
@jyn514 jyn514 changed the title Item names displayed by the compiler can be from indirect dependencies Item names displayed by RLS can be from indirect dependencies Feb 19, 2023
@jyn514
Copy link
Member

jyn514 commented Feb 19, 2023

Save-analysis has been removed from the compiler.

@jyn514 jyn514 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants