@@ -3,7 +3,6 @@ use std::ops::ControlFlow;
3
3
4
4
use rustc_hir:: def_id:: DefId ;
5
5
use rustc_infer:: infer:: TyCtxtInferExt ;
6
- use rustc_infer:: infer:: at:: ToTrace ;
7
6
use rustc_infer:: traits:: ObligationCause ;
8
7
use rustc_infer:: traits:: util:: PredicateSet ;
9
8
use rustc_middle:: bug;
@@ -127,16 +126,15 @@ fn prepare_vtable_segments_inner<'tcx, T>(
127
126
. explicit_super_predicates_of ( inner_most_trait_ref. def_id )
128
127
. iter_identity_copied ( )
129
128
. filter_map ( move |( pred, _) | {
130
- Some (
131
- tcx. instantiate_bound_regions_with_erased (
132
- pred. instantiate_supertrait (
133
- tcx,
134
- ty:: Binder :: dummy ( inner_most_trait_ref) ,
135
- )
136
- . as_trait_clause ( ) ?,
137
- )
138
- . trait_ref ,
129
+ pred. instantiate_supertrait ( tcx, ty:: Binder :: dummy ( inner_most_trait_ref) )
130
+ . as_trait_clause ( )
131
+ } )
132
+ . map ( move |pred| {
133
+ tcx. normalize_erasing_late_bound_regions (
134
+ ty:: TypingEnv :: fully_monomorphized ( ) ,
135
+ pred,
139
136
)
137
+ . trait_ref
140
138
} ) ;
141
139
142
140
// Find an unvisited supertrait
@@ -229,6 +227,8 @@ fn vtable_entries<'tcx>(
229
227
tcx : TyCtxt < ' tcx > ,
230
228
trait_ref : ty:: TraitRef < ' tcx > ,
231
229
) -> & ' tcx [ VtblEntry < ' tcx > ] {
230
+ debug_assert ! ( !trait_ref. has_non_region_infer( ) && !trait_ref. has_non_region_param( ) ) ;
231
+
232
232
debug ! ( "vtable_entries({:?})" , trait_ref) ;
233
233
234
234
let mut entries = vec ! [ ] ;
@@ -422,17 +422,8 @@ fn trait_refs_are_compatible<'tcx>(
422
422
let ocx = ObligationCtxt :: new ( & infcx) ;
423
423
let source_principal = ocx. normalize ( & ObligationCause :: dummy ( ) , param_env, vtable_principal) ;
424
424
let target_principal = ocx. normalize ( & ObligationCause :: dummy ( ) , param_env, target_principal) ;
425
- let Ok ( ( ) ) = ocx. eq_trace (
426
- & ObligationCause :: dummy ( ) ,
427
- param_env,
428
- ToTrace :: to_trace (
429
- & ObligationCause :: dummy ( ) ,
430
- ty:: Binder :: dummy ( target_principal) ,
431
- ty:: Binder :: dummy ( source_principal) ,
432
- ) ,
433
- target_principal,
434
- source_principal,
435
- ) else {
425
+ let Ok ( ( ) ) = ocx. eq ( & ObligationCause :: dummy ( ) , param_env, target_principal, source_principal)
426
+ else {
436
427
return false ;
437
428
} ;
438
429
ocx. select_all_or_error ( ) . is_empty ( )
0 commit comments