-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Allow customising ty::TraitRef's printing behavior #66613
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @estebank (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
r? @eddyb, as they have better context on what's to be accomplished here. I am slightly surprised there's no user visible changes. |
Would you mind restarting the build? Or can I do it? |
To restart the build you can close and reopen the pr |
☔ The latest upstream changes (presumably #66686) made this pull request unmergeable. Please resolve the merge conflicts. |
f5ecb51
to
be3bcb3
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Something went wrong when rebasing, I think it's connected to the fact that I unbeknownst to me updated clippy, I would appreciate any help. |
be3bcb3
to
ac5e5cf
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@@ -401,15 +401,15 @@ impl NiceRegionError<'me, 'tcx> { | |||
format!( | |||
"{}`{}` would have to be implemented for the type `{}`", | |||
if leading_ellipsis { "..." } else { "" }, | |||
expected_trait_ref, | |||
expected_trait_ref.map(ty::TraitRef::print_only_trait_path), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't |tr| tr.print_only_trait_path()
shorter?
@@ -1292,7 +1292,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { | |||
} | |||
|
|||
pub fn trait_ref_to_string(&self, t: &ty::TraitRef<'tcx>) -> String { | |||
self.resolve_vars_if_possible(t).to_string() | |||
self.resolve_vars_if_possible(t).print_only_trait_path().to_string() | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it a bit odd that this method exists, I wonder where it's used. (not relevant to this PR though)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me modulo using closures instead of passing ty::TraitRef::print_only_trait_path
(but that's not critical)
6f2493d
to
4611554
Compare
☔ The latest upstream changes (presumably #66567) made this pull request unmergeable. Please resolve the merge conflicts. |
4611554
to
b085973
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@Areredify Btw, if you use |
Why is this even happening? Do I need to do a |
fix clippy allow customising ty::TraitRef's printing behavior fix clippy stylistic fix
b085973
to
f07bd06
Compare
@Areredify I'm not sure, the only way I can think of to find out is to never use Note that running |
@bors r+ |
📌 Commit f07bd06 has been approved by |
Allow customising ty::TraitRef's printing behavior This pr allows to explicitly choose which representation of `TraitRef` (`<T as Trait<U>>` or `Trait<U>`) you want to print. `Debug` and `Display` representations of `TraitRef` now match. Closes rust-lang#59188.
Allow customising ty::TraitRef's printing behavior This pr allows to explicitly choose which representation of `TraitRef` (`<T as Trait<U>>` or `Trait<U>`) you want to print. `Debug` and `Display` representations of `TraitRef` now match. Closes #59188.
Allow customising ty::TraitRef's printing behavior This pr allows to explicitly choose which representation of `TraitRef` (`<T as Trait<U>>` or `Trait<U>`) you want to print. `Debug` and `Display` representations of `TraitRef` now match. Closes rust-lang#59188.
@bors retry rolled up |
Rollup of 11 pull requests Successful merges: - #66379 (Rephrase docs in for ptr) - #66589 (Draw vertical lines correctly in compiler error messages) - #66613 (Allow customising ty::TraitRef's printing behavior) - #66766 (Panic machinery comments and tweaks) - #66791 (Handle GlobalCtxt directly from librustc_interface query system) - #66793 (Record temporary static references in generator witnesses) - #66808 (Cleanup error code) - #66826 (Clarifies how to tag users for assigning PRs) - #66837 (Clarify `{f32,f64}::EPSILON` docs) - #66844 (Miri: do not consider memory allocated by caller_location leaked) - #66872 (Minor documentation fix) Failed merges: r? @ghost
This pr allows to explicitly choose which representation of
TraitRef
(<T as Trait<U>>
orTrait<U>
) you want to print.Debug
andDisplay
representations ofTraitRef
now match.Closes #59188.