only use generic info when ty var belong it in orphan check #132904
                
     Closed
            
            
          
  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.
  
    
  
    
Fixes #132826
This issue is caused by incorrect usage of a type variable. I will use the following example to illustrate:
When we check the orphan rule for
impl#1, we create two type variables:ty_var(K)andty_var(M), which come fromimpl#1andimpl#0respectively. After normalizing<ForeignType<K> as MyTrait>::Item, it returnsty_var(M), which is then used to find the generics information ofimpl#1, causing a panic due to it not being found.So naturally, I think there are three ways to solve this issue:
ty_var(M)intoty_var(K)since their relationship is similar to that of a parameter and an argument. And then we can usety_var(K)as the correct key for the generic.r? @fmease