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

Implementation of RFC 2086 - Allow Irrefutable Let patterns #49469

Merged
merged 7 commits into from
Jun 26, 2018
Merged

Implementation of RFC 2086 - Allow Irrefutable Let patterns #49469

merged 7 commits into from
Jun 26, 2018

Conversation

Nokel81
Copy link
Contributor

@Nokel81 Nokel81 commented Mar 29, 2018

This is the set of changes for RFC2086. Tracking issue #44495. Rendered here

// option. This file may not be copied, modified, or distributed
// except according to those terms.

// check that #[allow_irrefutable_lets] is feature-gated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this comment to

// gate-test-irrefutable_let_pattern

so that the computer can recognize it.

@kennytm
Copy link
Member

kennytm commented Mar 29, 2018

[00:05:31] tidy error: The Unstable Book has a 'language feature' section 'allow_irrefutable_lets' which doesn't correspond to an unstable language feature

Please fix the filename of the new unstable book entry. It should be called irrefutable_let_pattern.md.


// gate-test-irrefutable_let_pattern
fn main() {
#[allow_irrefutable_lets] //~ ERROR allow_irrefutable_lets attribute is currently unstable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be #[allow(irrefutable_let_pattern)] I believe.

@TimNN

This comment has been minimized.

@Nokel81
Copy link
Contributor Author

Nokel81 commented Mar 30, 2018

I don't quite understand what that message means, how would I make it correspond?

Copy link
Member

@kennytm kennytm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to rename allow_irrefutable_lets.md


// gate-test-irrefutable_let_pattern
fn main() {
#[allow(irrefutable_let_pattern)] //~ ERROR allow_irrefutable_lets attribute is currently unstable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is too long. Split it into two lines:

#[allow()]
//~^ ERROR …

@TimNN

This comment has been minimized.

@TimNN

This comment has been minimized.

@kennytm
Copy link
Member

kennytm commented Mar 30, 2018

@TimNN looks like the bot got some false result

@TimNN

This comment has been minimized.

@Nokel81
Copy link
Contributor Author

Nokel81 commented Mar 30, 2018

Okay, now I am confused. What is the conversion for naming the unstable book file?

@shepmaster shepmaster added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 30, 2018
@kennytm kennytm dismissed their stale review March 30, 2018 21:26

(Author fixed the code; Travis is still unhappy)

@kennytm
Copy link
Member

kennytm commented Mar 30, 2018

@Nokel81 🤔 Maybe try to use hyphens instead of underscores? irrefutable-let-pattern.md

Tidy should be fixed to suggest the naming convention if this is the case 😑

@TimNN

This comment has been minimized.

@TimNN

This comment has been minimized.

@TimNN

This comment has been minimized.

@TimNN

This comment has been minimized.

@TimNN

This comment has been minimized.

@Nokel81
Copy link
Contributor Author

Nokel81 commented Mar 31, 2018

So here it says to use cx.tcx.sess.features but the compiler now says that that is private, has the api changed?

@michaelwoerister
Copy link
Member

r? @nikomatsakis

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look great! Presuming we can pacify travis, the only thing I think we need is a test. I imagine something that (a) enables the feature gate and then (b) adds #![deny(irrefutable_let_pattern)] and shows that indeed we get a lint error.


// gate-test-irrefutable_let_pattern
fn main() {
#[allow(irrefutable_let_pattern)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you have the allow here? Without the feature gate, there shouldn't be any lints generated, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct, however, from the RFC the default is a deny lint.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what I think is we should have, make sure that it fails with no gates or allow. Add the feature gate and check that it denies and then one with the feature gate and the allow

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was here to make sure that the feature gate was also required

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the default is a deny lint

Hmm, that's odd. We don't usually do deny-by-default lints...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In any case I agree testing all the combinations is good. The matter of default setting is separate and can be discussed on the tracking issue.

@bors
Copy link
Contributor

bors commented Apr 5, 2018

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

@Nokel81
Copy link
Contributor Author

Nokel81 commented Apr 6, 2018

So while looking in src/librustc/lint/builtin.rs there are other lints that are Deny. I would be fine with making the default be allow but then why would someone write the code and then explicitly deny it? Since I believe that the allow/deny is a per instance item.

@nikomatsakis
Copy link
Contributor

@Nokel81

with making the default be allow

I would have expected the default to be "warn", not allow

@Nokel81
Copy link
Contributor Author

Nokel81 commented Apr 9, 2018

Makes more sense now

@zackmdavis
Copy link
Member

(Please remember to squash the commits with an informative message before merging this.)

@pietroalbini
Copy link
Member

Failure seems unrelated, manually restarted the build.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@pietroalbini
Copy link
Member

Ok, this failure is legit. Apparently Travis times out (30m) while doctesting the new page in the unstable book.

@Nokel81
Copy link
Contributor Author

Nokel81 commented Jun 15, 2018 via email

@pietroalbini
Copy link
Member

Doctesting means trying to compile code snippets in a documentation page. It's done automatically to ensure all code snippets in the Rust documentation are valid.

The only code block in that page is this, so that's probably the cause.

@Nokel81
Copy link
Contributor Author

Nokel81 commented Jun 15, 2018 via email

@Nokel81
Copy link
Contributor Author

Nokel81 commented Jun 18, 2018

@pietroalbini I have looked into the code that is in the unstable book page but it is the exact same (except for comments) of the code in test/run-pass/allow-irrefutable_let_patterns.rs

@pietroalbini
Copy link
Member

@Nokel81 can you try not having an infinite loop in that snippet?

@nikomatsakis
Copy link
Contributor

r=me if travis is happy

@kennytm
Copy link
Member

kennytm commented Jun 25, 2018

@bors r=nikomatsakis

@bors
Copy link
Contributor

bors commented Jun 25, 2018

📌 Commit 9168034 has been approved by nikomatsakis

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 25, 2018
@bors
Copy link
Contributor

bors commented Jun 26, 2018

⌛ Testing commit 9168034 with merge c191d63009a37669b90dd060ed2000e20b22a0e6...

@bors
Copy link
Contributor

bors commented Jun 26, 2018

💔 Test failed - status-travis

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 26, 2018
@rust-highfive
Copy link
Collaborator

The job i686-gnu-nopt of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:53:21] [RUSTC-TIMING] rustc_metadata test:false 307.274
[00:53:21]    Compiling rustc_traits v0.0.0 (file:///checkout/src/librustc_traits)
[00:54:16] [RUSTC-TIMING] rustc_traits test:false 55.033
[00:54:32] [RUSTC-TIMING] rustc_typeck test:false 378.704
No output has been received in the last 30m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
The build has been terminated

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

1 similar comment
@rust-highfive
Copy link
Collaborator

The job i686-gnu-nopt of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:53:21] [RUSTC-TIMING] rustc_metadata test:false 307.274
[00:53:21]    Compiling rustc_traits v0.0.0 (file:///checkout/src/librustc_traits)
[00:54:16] [RUSTC-TIMING] rustc_traits test:false 55.033
[00:54:32] [RUSTC-TIMING] rustc_typeck test:false 378.704
No output has been received in the last 30m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
The build has been terminated

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@pietroalbini
Copy link
Member

@bors retry

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

bors commented Jun 26, 2018

⌛ Testing commit 9168034 with merge 309fd8a...

bors added a commit that referenced this pull request Jun 26, 2018
…matsakis

Implementation of RFC 2086 - Allow Irrefutable Let patterns

This is the set of changes for RFC2086. Tracking issue #44495. Rendered [here](rust-lang/rfcs#2086)
@bors
Copy link
Contributor

bors commented Jun 26, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 309fd8a to master...

@bors bors merged commit 9168034 into rust-lang:master Jun 26, 2018
@Nokel81 Nokel81 deleted the allow-irrefutable-let-patterns branch June 27, 2018 18:29
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