@@ -4,9 +4,6 @@ use either::{Left, Right};
4
4
use rustc_abi:: { Align , HasDataLayout , Size , TargetDataLayout } ;
5
5
use rustc_errors:: DiagCtxtHandle ;
6
6
use rustc_hir:: def_id:: DefId ;
7
- use rustc_infer:: infer:: TyCtxtInferExt ;
8
- use rustc_infer:: infer:: at:: ToTrace ;
9
- use rustc_infer:: traits:: ObligationCause ;
10
7
use rustc_middle:: mir:: interpret:: { ErrorHandled , InvalidMetaKind , ReportedErrorInfo } ;
11
8
use rustc_middle:: query:: TyCtxtAt ;
12
9
use rustc_middle:: ty:: layout:: {
@@ -17,8 +14,7 @@ use rustc_middle::{mir, span_bug};
17
14
use rustc_session:: Limit ;
18
15
use rustc_span:: Span ;
19
16
use rustc_target:: callconv:: FnAbi ;
20
- use rustc_trait_selection:: traits:: ObligationCtxt ;
21
- use tracing:: { debug, instrument, trace} ;
17
+ use tracing:: { debug, trace} ;
22
18
23
19
use super :: {
24
20
Frame , FrameInfo , GlobalId , InterpErrorInfo , InterpErrorKind , InterpResult , MPlaceTy , Machine ,
@@ -323,40 +319,6 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
323
319
}
324
320
}
325
321
326
- /// Check if the two things are equal in the current param_env, using an infcx to get proper
327
- /// equality checks.
328
- #[ instrument( level = "trace" , skip( self ) , ret) ]
329
- pub ( super ) fn eq_in_param_env < T > ( & self , a : T , b : T ) -> bool
330
- where
331
- T : PartialEq + TypeFoldable < TyCtxt < ' tcx > > + ToTrace < ' tcx > ,
332
- {
333
- // Fast path: compare directly.
334
- if a == b {
335
- return true ;
336
- }
337
- // Slow path: spin up an inference context to check if these traits are sufficiently equal.
338
- let ( infcx, param_env) = self . tcx . infer_ctxt ( ) . build_with_typing_env ( self . typing_env ) ;
339
- let ocx = ObligationCtxt :: new ( & infcx) ;
340
- let cause = ObligationCause :: dummy_with_span ( self . cur_span ( ) ) ;
341
- // equate the two trait refs after normalization
342
- let a = ocx. normalize ( & cause, param_env, a) ;
343
- let b = ocx. normalize ( & cause, param_env, b) ;
344
-
345
- if let Err ( terr) = ocx. eq ( & cause, param_env, a, b) {
346
- trace ! ( ?terr) ;
347
- return false ;
348
- }
349
-
350
- let errors = ocx. select_all_or_error ( ) ;
351
- if !errors. is_empty ( ) {
352
- trace ! ( ?errors) ;
353
- return false ;
354
- }
355
-
356
- // All good.
357
- true
358
- }
359
-
360
322
/// Walks up the callstack from the intrinsic's callsite, searching for the first callsite in a
361
323
/// frame which is not `#[track_caller]`. This matches the `caller_location` intrinsic,
362
324
/// and is primarily intended for the panic machinery.
0 commit comments