@@ -9,7 +9,7 @@ use super::{
99} ;
1010use crate :: infer:: error_reporting:: { TyCategory , TypeAnnotationNeeded as ErrorCode } ;
1111use crate :: infer:: type_variable:: { TypeVariableOrigin , TypeVariableOriginKind } ;
12- use crate :: infer:: { self , InferCtxt , TyCtxtInferExt } ;
12+ use crate :: infer:: { self , InferCtxt } ;
1313use crate :: traits:: query:: evaluate_obligation:: InferCtxtExt as _;
1414use crate :: traits:: query:: normalize:: QueryNormalizeExt as _;
1515use crate :: traits:: specialize:: to_pretty_impl_header;
@@ -1930,14 +1930,6 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
19301930 return report ( normalized_impl_candidates, err) ;
19311931 }
19321932
1933- let normalize = |candidate| {
1934- let infcx = self . tcx . infer_ctxt ( ) . build ( ) ;
1935- infcx
1936- . at ( & ObligationCause :: dummy ( ) , ty:: ParamEnv :: empty ( ) )
1937- . query_normalize ( candidate)
1938- . map_or ( candidate, |normalized| normalized. value )
1939- } ;
1940-
19411933 // Sort impl candidates so that ordering is consistent for UI tests.
19421934 // because the ordering of `impl_candidates` may not be deterministic:
19431935 // https://github.com/rust-lang/rust/pull/57475#issuecomment-455519507
@@ -1947,7 +1939,11 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
19471939 let mut normalized_impl_candidates_and_similarities = impl_candidates
19481940 . into_iter ( )
19491941 . map ( |ImplCandidate { trait_ref, similarity } | {
1950- let normalized = normalize ( trait_ref) ;
1942+ // FIXME(compiler-errors): This should be using `NormalizeExt::normalize`
1943+ let normalized = self
1944+ . at ( & ObligationCause :: dummy ( ) , ty:: ParamEnv :: empty ( ) )
1945+ . query_normalize ( trait_ref)
1946+ . map_or ( trait_ref, |normalized| normalized. value ) ;
19511947 ( similarity, normalized)
19521948 } )
19531949 . collect :: < Vec < _ > > ( ) ;
0 commit comments