Skip to content

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jun 21, 2025

r? @fee1-dead or @compiler-errors

something generally useful but also required for #142789

@rustbot
Copy link
Collaborator

rustbot commented Jun 21, 2025

fee1-dead is currently at their maximum review capacity.
They may take a while to respond.

@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 Jun 21, 2025
@fmease
Copy link
Member

fmease commented Jun 21, 2025

Dupe of #133995

@oli-obk oli-obk closed this Jun 21, 2025
@fmease fmease reopened this Jun 21, 2025
Copy link
Member

Choose a reason for hiding this comment

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

this is no longer testing the issue - can we change this to another one that still shows the errors? or just remove this test completely (or just have const_trait_impl removed in this test)

Copy link
Member

@fee1-dead fee1-dead Jun 22, 2025

Choose a reason for hiding this comment

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

This also means

let mut sugg = None;
if ccx.tcx.is_lang_item(trait_id, LangItem::PartialEq) {
match (args[0].kind(), args[1].kind()) {
(GenericArgKind::Type(self_ty), GenericArgKind::Type(rhs_ty))
if self_ty == rhs_ty
&& self_ty.is_ref()
&& self_ty.peel_refs().is_primitive() =>
{
let mut num_refs = 0;
let mut tmp_ty = self_ty;
while let rustc_middle::ty::Ref(_, inner_ty, _) = tmp_ty.kind() {
num_refs += 1;
tmp_ty = *inner_ty;
}
let deref = "*".repeat(num_refs);
if let Ok(call_str) = ccx.tcx.sess.source_map().span_to_snippet(span) {
if let Some(eq_idx) = call_str.find("==") {
if let Some(rhs_idx) =
call_str[(eq_idx + 2)..].find(|c: char| !c.is_whitespace())
{
let rhs_pos =
span.lo() + BytePos::from_usize(eq_idx + 2 + rhs_idx);
let rhs_span = span.with_lo(rhs_pos).with_hi(rhs_pos);
sugg = Some(errors::ConsiderDereferencing {
deref,
span: span.shrink_to_lo(),
rhs_span,
});
}
}
}
}
_ => {}
}
should be deleted (or with a FIXME to delete once we stabilize stuff)

@fee1-dead fee1-dead 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 Jun 22, 2025
@oli-obk oli-obk force-pushed the const-partial-eq branch from f693135 to 9933442 Compare June 23, 2025 08:45
@fee1-dead
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 23, 2025

📌 Commit 9933442 has been approved by fee1-dead

It is now in the queue for this repository.

@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 Jun 23, 2025
jdonszelmann added a commit to jdonszelmann/rust that referenced this pull request Jun 23, 2025
Make `PartialEq` a `const_trait`

r? `@fee1-dead` or `@compiler-errors`

something generally useful but also required for rust-lang#142789
bors added a commit that referenced this pull request Jun 23, 2025
Rollup of 5 pull requests

Successful merges:

 - #142493 (rework `#[naked]` attribute parser)
 - #142636 (bootstrap.example.toml: use less contextual format)
 - #142822 (Make `PartialEq` a `const_trait`)
 - #142892 (Fix ICE on debug builds where lints are delayed on the crate root)
 - #142904 (notify me when rdg is touched)

Failed merges:

 - #142827 (Move error code explanation removal check into tidy)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit c8df66f into rust-lang:master Jun 23, 2025
10 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 23, 2025
rust-timer added a commit that referenced this pull request Jun 23, 2025
Rollup merge of #142822 - oli-obk:const-partial-eq, r=fee1-dead

Make `PartialEq` a `const_trait`

r? ``@fee1-dead`` or ``@compiler-errors``

something generally useful but also required for #142789
@cuviper cuviper modified the milestones: 1.89.0, 1.90.0 Jun 23, 2025
@@ -247,6 +247,8 @@ use crate::ops::ControlFlow;
append_const_msg
)]
#[rustc_diagnostic_item = "PartialEq"]
#[const_trait]
#[rustc_const_unstable(feature = "const_trait_impl", issue = "67792")]
Copy link
Member

Choose a reason for hiding this comment

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

Why is this library trait guarded by a language feature and its tracking issue?
It doesn't even match the attribute on the impls, which is quite confusing (I think the impl attributes are completely ignored then?)

@RalfJung RalfJung mentioned this pull request Jul 11, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. 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