Allow printing TraitRef and TraitPredicate with Infcx information
          #125262
        
          
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
This PR is a bit of a mess apologies. I've tried to split up into two commits.
The first commit makes the
InfcxinWithInfcxbe stored inside of anOptionand makesNoInfcxinto an uninhabited type so that we do not have a type that is not anything like anInfcximplement theInferCtxtLiketrait and then get constructed and passed to places that expect an infcx. Generally the "leafs" of debug printing do not share codepaths for printing with or without an infcx and so need to be able to determine which to use.While updating the leaves to match on the
OptionI changed the debug printing of inference variables to be?0_..tfor when we cant probe the variable?0instead of "silently" downgrading to normalDebugprinting. I'm not sure how valuable this is but it was easy to do and given how many places accidentally are not going through theDebugWithInfcxtrait it seems valuable to be able to tell in logs if an inference variable is being printed through the wrong trait or just doesnt have a universe available.As an example of not going through the right trait, it seems like the
Ty: DebugWithInfcximpl just.... did not actually pass through toTyKind: DebugWithInfcxand so would not ever print out the universes ^^' fixed that in this commit too.The second commit actually introduces the
DebugWithInfcximplementations forTraitRefandTraitPredicate. PreviouslyTraitPredicatewas formatted as:TraitPredicate(<T as Trait<U>>, polarity::Positive)and now it is(T: Trait<U>). This should hopefully make reading debug logs involving lots of trait bounds easier (and it'll get a lot better with customBinderDebugimpls)TraitRef's formatting has not really changed. Previously it was<T as Trait<U>>and now it is(T as Trait<U>).r? @compiler-errors