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

Fix #23808: dead_code lint: visit types in paths #27565

Merged
merged 1 commit into from
Aug 22, 2015

Conversation

TimNN
Copy link
Contributor

@TimNN TimNN commented Aug 6, 2015

Fixes #23808, passes make check-stage1 run-pass and run-fail locally.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nrc (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@TimNN
Copy link
Contributor Author

TimNN commented Aug 6, 2015

So, I had a look at the travis logs and it looks like the pretty test failed because pretty forces a crate_type="lib", thus the main function is not called and the #![deny(dead_code)] triggers.

What would be the best solution to fix this? Disable the test for pretty? How do I do that?

@TimNN
Copy link
Contributor Author

TimNN commented Aug 6, 2015

Ok, so I think I fixed the issue by making main pub, make check-stage1-pretty NO_REBUILD=1 TESTNAME=issue-23808 now also passes locally.

@nrc
Copy link
Member

nrc commented Aug 6, 2015

It would be nice if we didn't need pub main - that was a requirement for a while that was lifted and life has been much easier. Do you know why pretty makes the crate type lib?

@TimNN
Copy link
Contributor Author

TimNN commented Aug 6, 2015

I have no clue, this is the first time I have worked on the rust compiler. The only other alternative I can think of is to disable pretty for this test. Or is it possible to use #![crate_type="bin"] to overwrite a --crate-type=lib?

@TimNN
Copy link
Contributor Author

TimNN commented Aug 6, 2015

Alright, I removed the pub again, this now has to wait for #27567

@TimNN
Copy link
Contributor Author

TimNN commented Aug 11, 2015

Alright, now that #27571 is merged this should build. I just rebased & pushed again to get travis to test it again.

@TimNN
Copy link
Contributor Author

TimNN commented Aug 11, 2015

Alright, this doesn't compile at the moment due to some recent rust changes, I'll fix this now.

@TimNN
Copy link
Contributor Author

TimNN commented Aug 12, 2015

Please don't r+ yet, I need to add another test case which came up on reddit:
https://www.reddit.com/r/rust/comments/3gmtpq/why_do_i_get_a_struct_never_used_here/

@TimNN
Copy link
Contributor Author

TimNN commented Aug 12, 2015

Alright, I added the new test cases. They would probably not have been necessary, but I wanted to be on the safe side.

@TimNN
Copy link
Contributor Author

TimNN commented Aug 18, 2015

@nrc: could you review again?

@nrc
Copy link
Member

nrc commented Aug 19, 2015

@bors: r+

@TimNN looks good, thanks for seeing through the changes

@bors
Copy link
Contributor

bors commented Aug 19, 2015

📌 Commit 2d4e07e has been approved by nrc

@bors
Copy link
Contributor

bors commented Aug 19, 2015

⌛ Testing commit 2d4e07e with merge 3c35d55...

@bors
Copy link
Contributor

bors commented Aug 19, 2015

💔 Test failed - auto-mac-32-opt

@TimNN
Copy link
Contributor Author

TimNN commented Aug 19, 2015

@nrc could you retry? this passes make check locally (on linux) and I don't think there is any target dependent code in that part of the compiler.

@alexcrichton
Copy link
Member

That doesn't look like it's spurious (may be #27583), but I don't think a retry will fix it. Can you reproduce locally? Perhaps on a 32-bit build?

@TimNN
Copy link
Contributor Author

TimNN commented Aug 19, 2015

@alexcrichton I'm trying a local 32bit build now but I can't imagine how my changed could cause a test failure there, except if they just expose another bug.

If this turns out to be #27583, how would I go about fixing this? Just wait until the issue is fixed or add one of the workarounds from the issue to ExprUseVisitor::new()?

@alexcrichton
Copy link
Member

Unfortunately I'm not sure if there's a fix, but #27856 is also block on this and @nikomatsakis indicates that #27892 may fix it.

@TimNN
Copy link
Contributor Author

TimNN commented Aug 19, 2015

Thanks for the additional links! I'll see if the local build will result in anything and wait for #27892 otherwise. I never imagined that this rather small pull request would cause so much trouble, even if it did take some (rather enjoyable) hours to figuring this fix out.

@TimNN
Copy link
Contributor Author

TimNN commented Aug 19, 2015

Alright, so the local 32bit linux build failed as well, so I'll wait on #27892 and then try again

@TimNN
Copy link
Contributor Author

TimNN commented Aug 22, 2015

Since #27892 has landed now, could someone retry please?

@alexcrichton
Copy link
Member

@bors: retry

@bors
Copy link
Contributor

bors commented Aug 22, 2015

⌛ Testing commit 2d4e07e with merge 4a1fda8...

bors added a commit that referenced this pull request Aug 22, 2015
Fixes #23808, passes `make check-stage1` `run-pass` and `run-fail` locally.
@bors bors merged commit 2d4e07e into rust-lang:master Aug 22, 2015
@TimNN TimNN deleted the dead-visit-type-in-path branch August 22, 2015 19:40
sanxiyn added a commit to sanxiyn/rust that referenced this pull request Dec 15, 2016
This code was introduced in rust-lang#27565 to mark types in paths alive. It is now unnecessary since rust-lang#37676.
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

Successfully merging this pull request may close these issues.

5 participants