(Originally discussed in #58140 (comment))
Right now a TraitRef prints as <T as Trait<U>> via "debug" ({:?}) and Trait<U> via "display" ({}) - this is used all over rustc to indicate what printed form of the trait is desired.
However, it would be overall cleaner for "display" and "debug" printing to match (or even for fmt::Display to not be implemented at all, perhaps?), and provide all the information that exists (i.e. including the Self type).
We would then need a replacement for printing "just the trait path with its parameters", and I think we can have a method, .print_only_trait_path(), that returns a wrapper which has the different formatting behavior.
(Originally discussed in #58140 (comment))
Right now a
TraitRefprints as<T as Trait<U>>via "debug" ({:?}) andTrait<U>via "display" ({}) - this is used all over rustc to indicate what printed form of the trait is desired.However, it would be overall cleaner for "display" and "debug" printing to match (or even for
fmt::Displayto not be implemented at all, perhaps?), and provide all the information that exists (i.e. including theSelftype).We would then need a replacement for printing "just the trait path with its parameters", and I think we can have a method,
.print_only_trait_path(), that returns a wrapper which has the different formatting behavior.