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

Add lint warning for inner function marked as #[test] #51450

Merged
merged 2 commits into from
Jul 3, 2018

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Jun 9, 2018

Fix #36629.

@rust-highfive
Copy link
Collaborator

r? @pnkfelix

(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 Jun 9, 2018
@estebank estebank force-pushed the inner-fn-test branch 3 times, most recently from 19ddf80 to 7d3a55a Compare June 9, 2018 01:28
@rust-highfive

This comment has been minimized.

@Centril
Copy link
Contributor

Centril commented Jun 9, 2018

I'm in favor of this change; but it is my understanding that adding a new lint requires an RFC per notes in https://github.com/rust-lang/rfcs/blob/master/lang_changes.md (which is either outdated and needs to be changed, or is accurate..).

@estebank
Copy link
Contributor Author

estebank commented Jun 9, 2018

@Centril in that case I'll create an RFC. This felt small enough as it's warning about already existing behavior, but I can see why we wouldn't want to make exceptions.

@Centril
Copy link
Contributor

Centril commented Jun 9, 2018

@estebank yeah I agree that it seems like a small, good and uncontroversial change :)

It might be a good idea to document what lints need RFCs and which don't.

@mark-i-m
Copy link
Member

I don't think it needs an RFC. This seems like a bug-fix to me. Perhaps an FCP is sufficient?

@estebank estebank changed the title Inner fn test Add lint warning for inner function marked as #[test] Jun 12, 2018
@zackmdavis
Copy link
Member

untestable_method is a very confusing name.

@zackmdavis
Copy link
Member

Whatever name is chosen (untestable_test_functions??), it should respect RFC 344 (see #50879).

@bors
Copy link
Contributor

bors commented Jun 17, 2018

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

@pnkfelix
Copy link
Member

This code seems fine. The only thing left is to resolve the name of the lint itself.

How about unnameable_test_methods? The lint diagnostic itself can be the thing that points out that such #[test] methods are in fact not run by the test harness, while the lint name itself will serve to imply why they are not supported.

@pnkfelix pnkfelix added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 18, 2018
@zackmdavis
Copy link
Member

This isn't a "method"; it's a function (as I hear the words usually used).

@pnkfelix
Copy link
Member

@zackmdavis I don't disagree. The high-order bit of my suggestion was meant to be the "unnameable" part, not the use of the word "methods."

@estebank
Copy link
Contributor Author

Changed lint name.

@zackmdavis
Copy link
Member

zackmdavis commented Jun 19, 2018

(RFC 344 seems to suggest the plural: unnameable-test-functions?)

The basic rule is: the lint name should make sense when read as "allow lint-name" or "allow lint-name items". For example, "allow deprecated items" and "allow dead_code" makes sense, while "allow unsafe_block" is ungrammatical (should be plural).

@estebank estebank added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 20, 2018
@estebank
Copy link
Contributor Author

Ping. Anything left for me to do?

@pietroalbini
Copy link
Member

Ping from triage @pnkfelix! This PR needs your review.

@bors
Copy link
Contributor

bors commented Jun 26, 2018

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

@bors
Copy link
Contributor

bors commented Jun 27, 2018

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

@estebank
Copy link
Contributor Author

Ping.

@TimNN
Copy link
Contributor

TimNN commented Jul 3, 2018

Ping from triage, @pnkfelix / @rust-lang/compiler: This PR requires your review!

@cramertj
Copy link
Member

cramertj commented Jul 3, 2018

@pnkfelix said "The only thing left is to resolve the name of the lint itself", and the name was resolved, so

@bors r=pnkfelix

@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 3, 2018
@bors
Copy link
Contributor

bors commented Jul 3, 2018

📌 Commit 51a0425 has been approved by pnkfelix

@rust-lang rust-lang deleted a comment from bors Jul 3, 2018
@rust-lang rust-lang deleted a comment from bors Jul 3, 2018
@rust-lang rust-lang deleted a comment from bors Jul 3, 2018
@rust-lang rust-lang deleted a comment from bors Jul 3, 2018
@bors
Copy link
Contributor

bors commented Jul 3, 2018

⌛ Testing commit 51a0425 with merge 739320a...

bors added a commit that referenced this pull request Jul 3, 2018
Add lint warning for inner function marked as `#[test]`

Fix #36629.
@bors
Copy link
Contributor

bors commented Jul 3, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: @pnkfelix
Pushing 739320a to master...

@bors bors merged commit 51a0425 into rust-lang:master Jul 3, 2018
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.

10 participants