Skip to content

Better error for non const PartialEq call generated by match - #112232

Merged
bors merged 2 commits into
rust-lang:masterfrom
fee1-dead-contrib:match-eq-const-msg
Jun 20, 2023
Merged

Better error for non const PartialEq call generated by match#112232
bors merged 2 commits into
rust-lang:masterfrom
fee1-dead-contrib:match-eq-const-msg

Conversation

@fee1-dead

Copy link
Copy Markdown
Member

Resolves#90237

@rustbot

Copy link
Copy Markdown
Collaborator

r? @b-naber

(rustbot has picked a reviewer for you, use r? to override)

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 3, 2023
@rustbot

Copy link
Copy Markdown
Collaborator

This PR changes Stable MIR

cc @oli-obk, @celinval

This PR changes MIR

cc @oli-obk, @RalfJung, @JakobDegen, @davidtwco, @celinval, @vakaras

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rust-log-analyzer

This comment has been minimized.

@fee1-dead
fee1-deadforce-pushed the match-eq-const-msg branch from f565198 to fd60cbcCompareJune 3, 2023 04:45
@rustbot

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@deltragondeltragonJun 3, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this help note appear to users on stable too? It seems confusing either way, as adding it doesn't fix the error (just makes it slightly more detailed).

@fee1-deadfee1-deadJun 3, 2023

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

No it doesn't. Stable users don't get the suggestion to add unstable features.

@b-naberb-naber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Had some thoughts/nits.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you include this as a reminder to be fixed in this PR or do you want to change this later?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I want to change this later, not in this PR

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this use a different name? Isn't desugaring exclusively used to refer to lowering of source-level constructs to internal constructs? So maybe ThirCallSource or something would be more appropriate?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I'm not sure if ThirCallSource would be better as that means Option<ThirCallSource>::None means that there was no call source from THIR. Option<CallDesugaring>::None suggests that it was a normal call. For CallDesugaring::Misc they still didn't come from normal calls so it would still mean using calls internally to represent code that does not explicitly try to call functions

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why can't we do this? 😅

enum ThirCallSource {
HirCall,
OverloadedOperator,
MatchCmp,
Misc,
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you add a similar comment to the one in TerminatorKind?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you link to #90237 here?

@bors

bors commented Jun 15, 2023

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #112625) made this pull request unmergeable. Please resolve the merge conflicts.

@rust-log-analyzer

This comment has been minimized.

@bors

bors commented Jun 17, 2023

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #100036) made this pull request unmergeable. Please resolve the merge conflicts.

@b-naber

Copy link
Copy Markdown
Contributor

Thanks for changing that.

@bors r+ rollup

@bors

bors commented Jun 18, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit 89c24af has been approved by b-naber

It is now in the queue for this repository.

@borsbors 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 Jun 18, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 18, 2023
…sg, r=b-naber
Better error for non const `PartialEq` call generated by `match`
Resolvesrust-lang#90237
@compiler-errors

Copy link
Copy Markdown
Contributor

@bors r- failed in rollup: #112771 (comment)

@borsbors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 18, 2023
@b-naber

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@bors

bors commented Jun 19, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit 446db51 has been approved by b-naber

It is now in the queue for this repository.

@borsbors 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 Jun 19, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 20, 2023
…mpiler-errors
Rollup of 8 pull requests
Successful merges:
- rust-lang#112232 (Better error for non const `PartialEq` call generated by `match`)
- rust-lang#112499 (Fix python linting errors)
- rust-lang#112596 (Suggest correct signature on missing fn returning RPITIT/AFIT)
- rust-lang#112606 (Alter `Display` for `Ipv6Addr` for IPv4-compatible addresses)
- rust-lang#112781 (Don't consider TAIT normalizable to hidden ty if it would result in impossible item bounds)
- rust-lang#112787 (Add gha problem matcher)
- rust-lang#112799 (Clean up "doc(hidden)" check)
- rust-lang#112803 (Format the examples directory of cg_clif)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 31d1fbf into rust-lang:masterJun 20, 2023
@rustbotrustbot added this to the 1.72.0 milestone Jun 20, 2023
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 30, 2023
…sg, r=b-naber
Better error for non const `PartialEq` call generated by `match`
Resolvesrust-lang#90237
bjorn3 pushed a commit to bjorn3/rust that referenced this pull request Jul 22, 2023
…sg, r=b-naber
Better error for non const `PartialEq` call generated by `match`
Resolvesrust-lang#90237
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

Confusing error message when matching on &str in const fn

7 participants

@fee1-dead@rustbot@rust-log-analyzer@bors@b-naber@compiler-errors@deltragon