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

Constify PartialEq #133995

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

compiler-errors
Copy link
Member

Diagnostics regression due to the fact that if a trait is #[const_trait] we don't dispatch to the pretty complex logic in FnCallNonConst.

Perhaps we should just dispatch to that op if the feature gate is not enabled...... thoughts?

@rustbot
Copy link
Collaborator

rustbot commented Dec 7, 2024

r? @wesleywiser

rustbot has assigned @wesleywiser.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot 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. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 7, 2024
@compiler-errors
Copy link
Member Author

r? @rust-lang/project-const-traits

@rustbot rustbot assigned fmease and unassigned wesleywiser Dec 7, 2024
@compiler-errors
Copy link
Member Author

Probably want to gate these under a real gate given #133999

@bors
Copy link
Contributor

bors commented Dec 8, 2024

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

@@ -1,12 +1,13 @@
error[E0015]: cannot match on `str` in constant functions
--> $DIR/match-non-const-eq.rs:7:9
error[E0658]: cannot call conditionally-const method `<str as PartialEq>::eq` in constant functions
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: surprised that when rendering predicates we talk about T: ~const PartialEq, but in fully qualified paths we talk <str as PartialEq>::eq instead of something like <str as ~const PartialEq>::eq. We already mention "conditionally-const" in the text, but wonder how many diagnostics will have to account for that to properly convey that context.

Copy link
Member Author

Choose a reason for hiding this comment

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

well, so, <str as ~const PartialEq>::eq is not a valid qpath. the method itself still is just <str as PartialEq>::eq, it just has an additional "const requirement" on it.

Copy link
Member Author

Choose a reason for hiding this comment

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

like, <str as ~const PartialEq>::eq and <str as PartialEq>::eq being distinct suggests that they are different methods, but they are not. this is a consequence of the current implementation of conditional constness.

Copy link
Member Author

Choose a reason for hiding this comment

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

this is somewhat related to the fact that we allow users to write T: Trait<Assoc = i32>, but not in method call position (i.e. <T as Trait<Assoc = i32>>::method is not valid). The constness of a trait is associated with a trait impl. Imagine that T: ~const Trait were written like T: Trait<constness = ~const>.

Copy link
Member

@fmease fmease left a comment

Choose a reason for hiding this comment

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

r=me with or without addressing the diagnostic regression

Copy link
Member

Choose a reason for hiding this comment

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

The tracking issue #101871 has never been updated >.< It didn't track the unconstification.

@fmease fmease 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 Dec 21, 2024
@fee1-dead
Copy link
Member

I'd like to block this on #133999.

@fee1-dead fee1-dead added the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked Status: Blocked on something else such as an RFC or other implementation work. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants