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

Suggest adding an array length if possible #100590

Merged
merged 2 commits into from
Aug 16, 2022

Conversation

TaKO8Ki
Copy link
Member

@TaKO8Ki TaKO8Ki commented Aug 15, 2022

fixes #100448

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 15, 2022
@rust-highfive
Copy link
Collaborator

r? @jackh726

(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 Aug 15, 2022
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

cool!

compiler/rustc_typeck/src/check/expr.rs Outdated Show resolved Hide resolved
compiler/rustc_typeck/src/check/expr.rs Outdated Show resolved Hide resolved
@compiler-errors
Copy link
Member

anyways r=me after nits are addressed or not

@bors delegate+

@bors
Copy link
Contributor

bors commented Aug 15, 2022

✌️ @TaKO8Ki can now approve this pull request

@TaKO8Ki TaKO8Ki force-pushed the suggest-adding-array-length branch from e15db88 to 12e609b Compare August 15, 2022 18:43
@TaKO8Ki
Copy link
Member Author

TaKO8Ki commented Aug 15, 2022

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Aug 15, 2022

📌 Commit 12e609b has been approved by compiler-errors

It is now in the queue for this repository.

@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 Aug 15, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 16, 2022
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#100338 (when there are 3 or more return statements in the loop)
 - rust-lang#100384 (Add support for generating unique profraw files by default when using `-C instrument-coverage`)
 - rust-lang#100460 (Update the minimum external LLVM to 13)
 - rust-lang#100567 (Add missing closing quote)
 - rust-lang#100590 (Suggest adding an array length if possible)
 - rust-lang#100600 (Rename Machine memory hooks to suggest when they run)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 76dd166 into rust-lang:master Aug 16, 2022
@rustbot rustbot added this to the 1.65.0 milestone Aug 16, 2022
@TaKO8Ki TaKO8Ki deleted the suggest-adding-array-length branch August 16, 2022 07:54
@@ -0,0 +1,48 @@
error: in expressions, `_` can only be used on the left-hand side of an assignment
Copy link
Member

Choose a reason for hiding this comment

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

Why are all errors in this file duplicated? For example this is and the one at line 28 has the same cause.

Copy link
Member

@WaffleLapkin WaffleLapkin left a comment

Choose a reason for hiding this comment

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

Annoyingly this also doesn't work with references to arrays, for example:

const REPORT_DESCR: &[u8; _] = &[1]

won't trigger the suggestion.

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Sep 9, 2022
…h-to-ref-to-array, r=oli-obk

Suggest adding array lengths to references to arrays if possible

ref: rust-lang#100590 (review)
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Sep 9, 2022
…h-to-ref-to-array, r=oli-obk

Suggest adding array lengths to references to arrays if possible

ref: rust-lang#100590 (review)
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"using _ for array lengths is unstable" error should suggest the number of elements
7 participants