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

len_zero: skip ranges if feature range_is_empty is not enabled #5656

Merged
merged 1 commit into from
May 31, 2020

Conversation

ebroto
Copy link
Member

@ebroto ebroto commented May 27, 2020

If the feature is not enabled, calling is_empty() on a range is ambiguous. Moreover, the two possible resolutions are unstable methods, one inherent to the range and the other being part of the ExactSizeIterator trait.

Since len_zero only checks for existing is_empty() inherent methods, we only take into account the range_is_empty feature.

Related: rust-lang/rust#48111 (comment)

changelog: len_zero: avoid linting ranges without #![feature(range_is_empty)]

Fixes: #3807

@rust-highfive
Copy link

r? @matthiaskrgr

(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 May 27, 2020
@flip1995
Copy link
Member

@bors r=matthiaskrgr

@bors
Copy link
Collaborator

bors commented May 28, 2020

📌 Commit 64a05f5 has been approved by matthiaskrgr

@bors
Copy link
Collaborator

bors commented May 28, 2020

⌛ Testing commit 64a05f5 with merge ebfbe2b...

bors added a commit that referenced this pull request May 28, 2020
len_zero: skip ranges if feature `range_is_empty` is not enabled

If the feature is not enabled, calling `is_empty()` on a range is ambiguous. Moreover, the two possible resolutions are unstable methods, one inherent to the range and the other being part of the `ExactSizeIterator` trait.

Since `len_zero` only checks for existing `is_empty()` inherent methods, we only take into account the `range_is_empty` feature.

Related: rust-lang/rust#48111 (comment)

changelog: len_zero: avoid linting ranges without #![feature(range_is_empty)]

Fixes: #3807
@bors
Copy link
Collaborator

bors commented May 28, 2020

💔 Test failed - checks-action_test

@matthiaskrgr
Copy link
Member

@matthiaskrgr matthiaskrgr added S-waiting-on-bors Status: The marked PR was approved and is only waiting bors and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels May 28, 2020
@flip1995
Copy link
Member

I wait until rust-lang/rust#72671 is merged and will then do the rustup.

bors added a commit that referenced this pull request May 31, 2020
Rollup of 3 pull requests

Successful merges:

 - #5637 (new lint: vec_resize_to_zero)
 - #5656 (len_zero: skip ranges if feature `range_is_empty` is not enabled)
 - #5663 (add testcase that no longer ICEs)

Failed merges:

r? @ghost

changelog: rollup
bors added a commit that referenced this pull request May 31, 2020
Rollup of 3 pull requests

Successful merges:

 - #5637 (new lint: vec_resize_to_zero)
 - #5656 (len_zero: skip ranges if feature `range_is_empty` is not enabled)
 - #5663 (add testcase that no longer ICEs)

Failed merges:

r? @ghost

changelog: rollup
@bors bors merged commit 873c9fc into rust-lang:master May 31, 2020
@ebroto ebroto deleted the len_zero_ranges branch May 31, 2020 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: The marked PR was approved and is only waiting bors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

len_zero with Range suggests code cannot compile
5 participants