Make the structural_match error diagnostic for const generics clearer#70845
Merged
bors merged 2 commits intorust-lang:masterfrom Apr 24, 2020
Merged
Make the structural_match error diagnostic for const generics clearer#70845bors merged 2 commits intorust-lang:masterfrom
structural_match error diagnostic for const generics clearer#70845bors merged 2 commits intorust-lang:masterfrom
Conversation
Member
|
Ping from triage: @estebank could you review this? |
estebank
approved these changes
Apr 20, 2020
Contributor
estebank
left a comment
There was a problem hiding this comment.
Sorry, this fell through the cracks of my notifications.
It looks good. Left a nitpick, but r=me if you don't wish to fix it.
Comment on lines
10
to
13
Contributor
There was a problem hiding this comment.
It'd be nice if we could detect that T is a type param and instead of suggesting the annotation we suggested binding it with PartialEq + Eq.
Contributor
Author
There was a problem hiding this comment.
Ah, actually we ought to emit a specific error for this case: we don't currently accept using generic parameters as the types of const generics yet.
1e51940 to
f8b796b
Compare
Contributor
Author
|
@estebank: I've added a specific message for the case you highlighted. |
Contributor
|
@bors r+ rollup |
Collaborator
|
📌 Commit f8b796b has been approved by |
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this pull request
Apr 23, 2020
…gnostic, r=estebank Make the `structural_match` error diagnostic for const generics clearer The previous diagnostic caused confusion (rust-lang#70790), so this changes the message to be closer to the message for using non-`structural_match` constants in patterns, explicitly mentioning `#[derive(PartialEq, Eq)]`. Fixes rust-lang#70790. r? @estebank
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 24, 2020
Rollup of 6 pull requests Successful merges: - rust-lang#70845 (Make the `structural_match` error diagnostic for const generics clearer) - rust-lang#71063 (Document unsafety in core::{option, hash}) - rust-lang#71068 (Stabilize UNICODE_VERSION (feature unicode_version)) - rust-lang#71426 (fix error code in E0751.md) - rust-lang#71459 (Add leading 0x to offset in Debug fmt of Pointer) - rust-lang#71492 (Document unsafety in core::{panicking, alloc::layout, hint, iter::adapters::zip}) Failed merges: r? @ghost
16 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The previous diagnostic caused confusion (#70790), so this changes the message to be closer to the message for using non-
structural_matchconstants in patterns, explicitly mentioning#[derive(PartialEq, Eq)].Fixes #70790.
r? @estebank