Tweak E0599 to consolidate unsatisfied trait bound messages#151488
Tweak E0599 to consolidate unsatisfied trait bound messages#151488rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Conversation
| 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; | ||
| } |
There was a problem hiding this comment.
This could be
| 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.
There was a problem hiding this comment.
I should've caught in a self-review 😓
Addressed via 44042cc
| fn has_ref_dupes(&self) -> bool { | ||
| self.has_ref_dupes | ||
| } | ||
|
|
||
| fn into_trait_def_ids(self) -> FxIndexSet<DefId> { | ||
| self.trait_def_ids | ||
| } |
There was a problem hiding this comment.
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))) |
There was a problem hiding this comment.
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)...
There was a problem hiding this comment.
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.
| 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` |
There was a problem hiding this comment.
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
This comment has been minimized.
This comment has been minimized.
|
r=me after squashing and dealing with the rustdoc error. |
44042cc to
4e3c7cd
Compare
4e3c7cd to
4b22ee9
Compare
|
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. |
|
Thanks! Squashed. |
|
@bors r=estebank |
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)
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)
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)
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)
Fixes #114430
r? @estebank