Skip to content

Conversation

compiler-errors
Copy link
Member

Fixes #92776

@rust-highfive
Copy link
Contributor

r? @matthewjasper

(rust-highfive has picked a reviewer for you, use r? to override)

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jan 14, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 14, 2022
@lcnr
Copy link
Contributor

lcnr commented Jan 14, 2022

that's really nice ✨ gj

@compiler-errors

This comment was marked as resolved.

@compiler-errors
Copy link
Member Author

nvm, let's try

r? rust-lang/compiler

Copy link
Member

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

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

One nit, then r=me

@jackh726
Copy link
Member

@bors delegate+

@bors
Copy link
Collaborator

bors commented Feb 25, 2022

✌️ @compiler-errors can now approve this pull request

@jackh726 jackh726 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 25, 2022
@compiler-errors compiler-errors force-pushed the const-generic-expr-recovery branch from f3be3b4 to 6b52ac2 Compare February 26, 2022 01:17
@compiler-errors
Copy link
Member Author

@bors r=jackh726

@bors
Copy link
Collaborator

bors commented Feb 26, 2022

📌 Commit 6b52ac2 has been approved by jackh726

@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 Feb 26, 2022
@bors
Copy link
Collaborator

bors commented Feb 26, 2022

⌛ Testing commit 6b52ac2 with merge 7c3331c...

@bors
Copy link
Collaborator

bors commented Feb 26, 2022

☀️ Test successful - checks-actions
Approved by: jackh726
Pushing 7c3331c to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 26, 2022
@bors bors merged commit 7c3331c into rust-lang:master Feb 26, 2022
@rustbot rustbot added this to the 1.61.0 milestone Feb 26, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7c3331c): comparison url.

Summary: This benchmark run did not return any relevant results.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

@compiler-errors compiler-errors deleted the const-generic-expr-recovery branch April 7, 2022 04:35
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 28, 2023
Recover from more const arguments that are not wrapped in curly braces

Recover from some array, borrow, tuple & arithmetic expressions in const argument positions that lack curly braces and provide a suggestion to fix the issue continuing where rust-lang#92884 left off. Examples of such expressions: `[]`, `[0]`, `[1, 2]`, `[0; 0xff]`, `&9`, `("", 0)` and `(1 + 2) * 3` (we previously did not recover from them).

I am not entirely happy with my current solution because the code that recovers from `[0]` (coinciding with a malformed slice type) and `[0; 0]` (coinciding with a malformed array type) is quite fragile as the aforementioned snippets are actually successfully parsed as types by `parse_ty` since it itself already recovers from them (returning `[⟨error⟩]` and `[⟨error⟩; 0]` respectively) meaning I have to manually look for `TyKind::Err`s and construct a separate diagnostic for the suggestion to attach to (thereby emitting two diagnostics in total).

Fixes rust-lang#81698.
`@rustbot` label A-diagnostics
r? diagnostics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

Inconsistent availability of constant fields as const generic values
8 participants