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

When trying to destructure a Vec as a slice provide a suggestion #87017

Closed
estebank opened this issue Jul 10, 2021 · 0 comments · Fixed by #87033
Closed

When trying to destructure a Vec as a slice provide a suggestion #87017

estebank opened this issue Jul 10, 2021 · 0 comments · Fixed by #87033
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` D-newcomer-roadblock Diagnostics: Confusing error or lint; hard to understand for new users. D-papercut Diagnostics: An error or lint that needs small tweaks. P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@estebank
Copy link
Contributor

We currently emit the following:

error[E0529]: expected an array or slice, found `Vec<types::GenericBound>`
   --> src/librustdoc/clean/mod.rs:593:28
    |
593 |                     if let [] | [GenericBound::TraitBound(_, hir::TraitBoundModifier::Maybe)] = &bounds {
    |                            ^^ pattern cannot match with input type `Vec<types::GenericBound>`

error[E0529]: expected an array or slice, found `Vec<types::GenericBound>`
   --> src/librustdoc/clean/mod.rs:593:33
    |
593 |                     if let [] | [GenericBound::TraitBound(_, hir::TraitBoundModifier::Maybe)] = &bounds {
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern cannot match with input type `Vec<types::GenericBound>`

Ideally we should mention the appropriate solution, to use &bounds[..] instead.

@estebank estebank added A-diagnostics Area: Messages for errors, warnings, and lints P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` D-papercut Diagnostics: An error or lint that needs small tweaks. D-newcomer-roadblock Diagnostics: Confusing error or lint; hard to understand for new users. labels Jul 10, 2021
@bors bors closed this as completed in 3354a44 Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` D-newcomer-roadblock Diagnostics: Confusing error or lint; hard to understand for new users. D-papercut Diagnostics: An error or lint that needs small tweaks. P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant