Skip to content

dead_code doesn't show unused struct as unused #39558

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

Closed
KalitaAlexey opened this issue Feb 5, 2017 · 7 comments
Closed

dead_code doesn't show unused struct as unused #39558

KalitaAlexey opened this issue Feb 5, 2017 · 7 comments

Comments

@KalitaAlexey
Copy link
Contributor

Hi everybody.

I am sorry I tried to minify the example, but I can't find a pattern.
There is a PR: rust-lang/rls#168
There is an commit: "Replaced uses of unwrap with expect.".
In the commit in the src/actions/build.mod file there are two structs: CompilerMessageCode, CompilerMessage which are unused.
The compiler doesn't show any warning.

@durka
Copy link
Contributor

durka commented Feb 6, 2017

They were marked pub.

@KalitaAlexey
Copy link
Contributor Author

@durka,
They were in a function.
Can I use pub outside of the function?

@durka
Copy link
Contributor

durka commented Feb 6, 2017

To be honest, I would have expected some other error saying that pub doesn't make any sense inside a function :) As far as I know, the lint ignored them for that reason though.

@KalitaAlexey
Copy link
Contributor Author

@durka,
It compiled and worked.

@petrochenkov
Copy link
Contributor

@durka

To be honest, I would have expected some other error saying that pub doesn't make any sense inside a function

It was an error a year ago (see #31776)

@durka
Copy link
Contributor

durka commented Feb 6, 2017

This case would ideally be caught by the possibly-upcoming "this item is not as public as it looks" lint.

@steveklabnik
Copy link
Member

steveklabnik commented Feb 7, 2017

So it appears this is not a bug. Closing! (Let me know if I've gotten this wrong)

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

No branches or pull requests

4 participants