Skip to content

Tweak E0599 to consolidate unsatisfied trait bound messages#151488

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
JohnTitor:issue-114430
Jan 29, 2026
Merged

Tweak E0599 to consolidate unsatisfied trait bound messages#151488
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
JohnTitor:issue-114430

Conversation

@JohnTitor
Copy link
Member

@JohnTitor JohnTitor commented Jan 22, 2026

Fixes #114430
r? @estebank

@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. labels Jan 22, 2026
Copy link
Contributor

@estebank estebank left a comment

Choose a reason for hiding this comment

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

Only one nitpick I'd like addressed, but r=me with or without it.

View changes since this review

Comment on lines 1066 to 1072
if let ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) =
predicate.kind().skip_binder()
{
let self_ty = pred.trait_ref.self_ty();
if self_ty.peel_refs() != rcvr_ty {
continue;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be

Suggested change
if let ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) =
predicate.kind().skip_binder()
{
let self_ty = pred.trait_ref.self_ty();
if self_ty.peel_refs() != rcvr_ty {
continue;
}
if let ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) =
predicate.kind().skip_binder()
&& let self_ty = pred.trait_ref.self_ty()
&& self_ty.peel_refs() != rcvr_ty
{

Just slightly shorter.

Copy link
Member Author

Choose a reason for hiding this comment

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

I should've caught in a self-review 😓
Addressed via 44042cc

Comment on lines +91 to +97
fn has_ref_dupes(&self) -> bool {
self.has_ref_dupes
}

fn into_trait_def_ids(self) -> FxIndexSet<DefId> {
self.trait_def_ids
}
Copy link
Contributor

Choose a reason for hiding this comment

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

In general I haven't found these kind of accessor methods to be needed, but they are not wrong. :)

(Don't change)

let mut missing_trait_names = tracker
.into_trait_def_ids()
.into_iter()
.map(|def_id| format!("`{}`", self.tcx.def_path_str(def_id)))
Copy link
Contributor

Choose a reason for hiding this comment

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

This has the only issue of not being shortened type paths. Dealing with them might make the logic harder (because the shortened types might actually look the same)...

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair enough! I've given it some thoughts and one of the solutions would be 1) emitting shortened paths for most cases, 2) if conflicted (i.e. we have the same name in missing_trait_names), falling back to the full path. But this logic might be complicated as you said, and the later note "the traits ... must be implemented" should help users understand what it is. So I'd go for the current style.
But I'm happy to follow-up later if you have a different thought here.

Comment on lines 4 to 8
LL | struct Ipv4Addr;
| --------------- method `quote_into_iter` not found for this struct because it doesn't satisfy `Ipv4Addr: Iterator`, `Ipv4Addr: ToTokens`, `Ipv4Addr: proc_macro::ext::RepIteratorExt` or `Ipv4Addr: proc_macro::ext::RepToTokensExt`
| ---------------
| |
| method `quote_into_iter` not found for this struct
| `Ipv4Addr` doesn't implement `Iterator` or `ToTokens`
Copy link
Contributor

Choose a reason for hiding this comment

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

I would like it if we could still perform the label dedup and merge them to read "method quote_into_iter not found for this struct because Ipv4Addr doesn't implement Iterator or ToTokens". Would you mind spending the time trying to do that? We can land without that, but I'd rather we kept the output short when making a PR that shortens output :D

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, addressed via 44042cc

@rust-log-analyzer

This comment has been minimized.

@estebank
Copy link
Contributor

r=me after squashing and dealing with the rustdoc error.

@rustbot
Copy link
Collaborator

rustbot commented Jan 29, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@JohnTitor
Copy link
Member Author

Thanks! Squashed.
The CI failure should be spurious as it happens on other PRs but I'll r=you once CI passes, just in case,

@JohnTitor
Copy link
Member Author

@bors r=estebank

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 29, 2026

📌 Commit 4b22ee9 has been approved by estebank

It is now in the queue for this repository.

@rust-bors rust-bors bot 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 Jan 29, 2026
rust-bors bot pushed a commit that referenced this pull request Jan 29, 2026
Rollup of 5 pull requests

Successful merges:

 - #151775 (Portable SIMD subtree update)
 - #151488 (Tweak E0599 to consolidate unsatisfied trait bound messages)
 - #149823 (fix(parser): Disallow CR in frontmatter )
 - #151475 (add foregin type tests for issue 64458)
 - #151657 (Cleanup of `#[derive(Diagnostic)]` attribute parsers)
@rust-bors rust-bors bot merged commit 2b899b0 into rust-lang:main Jan 29, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Jan 29, 2026
rust-timer added a commit that referenced this pull request Jan 29, 2026
Rollup merge of #151488 - JohnTitor:issue-114430, r=estebank

Tweak E0599 to consolidate unsatisfied trait bound messages

Fixes #114430
r? @estebank
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jan 30, 2026
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#151775 (Portable SIMD subtree update)
 - rust-lang/rust#151488 (Tweak E0599 to consolidate unsatisfied trait bound messages)
 - rust-lang/rust#149823 (fix(parser): Disallow CR in frontmatter )
 - rust-lang/rust#151475 (add foregin type tests for issue 64458)
 - rust-lang/rust#151657 (Cleanup of `#[derive(Diagnostic)]` attribute parsers)
Kobzol pushed a commit to Kobzol/portable-simd that referenced this pull request Feb 3, 2026
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#151775 (Portable SIMD subtree update)
 - rust-lang/rust#151488 (Tweak E0599 to consolidate unsatisfied trait bound messages)
 - rust-lang/rust#149823 (fix(parser): Disallow CR in frontmatter )
 - rust-lang/rust#151475 (add foregin type tests for issue 64458)
 - rust-lang/rust#151657 (Cleanup of `#[derive(Diagnostic)]` attribute parsers)
Kobzol pushed a commit to Kobzol/portable-simd that referenced this pull request Feb 3, 2026
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#151775 (Portable SIMD subtree update)
 - rust-lang/rust#151488 (Tweak E0599 to consolidate unsatisfied trait bound messages)
 - rust-lang/rust#149823 (fix(parser): Disallow CR in frontmatter )
 - rust-lang/rust#151475 (add foregin type tests for issue 64458)
 - rust-lang/rust#151657 (Cleanup of `#[derive(Diagnostic)]` attribute parsers)
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tweak output of E0599 to make it less verbose

4 participants