@@ -9,7 +9,7 @@ use super::{
9
9
} ;
10
10
use crate :: infer:: error_reporting:: { TyCategory , TypeAnnotationNeeded as ErrorCode } ;
11
11
use crate :: infer:: type_variable:: { TypeVariableOrigin , TypeVariableOriginKind } ;
12
- use crate :: infer:: { self , InferCtxt , TyCtxtInferExt } ;
12
+ use crate :: infer:: { self , InferCtxt } ;
13
13
use crate :: traits:: query:: evaluate_obligation:: InferCtxtExt as _;
14
14
use crate :: traits:: query:: normalize:: QueryNormalizeExt as _;
15
15
use crate :: traits:: specialize:: to_pretty_impl_header;
@@ -1930,14 +1930,6 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
1930
1930
return report ( normalized_impl_candidates, err) ;
1931
1931
}
1932
1932
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
-
1941
1933
// Sort impl candidates so that ordering is consistent for UI tests.
1942
1934
// because the ordering of `impl_candidates` may not be deterministic:
1943
1935
// https://github.com/rust-lang/rust/pull/57475#issuecomment-455519507
@@ -1947,7 +1939,11 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
1947
1939
let mut normalized_impl_candidates_and_similarities = impl_candidates
1948
1940
. into_iter ( )
1949
1941
. 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 ) ;
1951
1947
( similarity, normalized)
1952
1948
} )
1953
1949
. collect :: < Vec < _ > > ( ) ;
0 commit comments