@@ -59,12 +59,13 @@ pub fn type_op_ascribe_user_type_with_span<'tcx>(
59
59
60
60
let UserSubsts { user_self_ty, substs } = user_substs;
61
61
let tcx = ocx. infcx . tcx ;
62
+ let cause = ObligationCause :: dummy_with_span ( span) ;
62
63
63
64
let ty = tcx. bound_type_of ( def_id) . subst ( tcx, substs) ;
64
- let ty = ocx. normalize ( ObligationCause :: misc ( span , hir :: CRATE_HIR_ID ) , param_env, ty) ;
65
+ let ty = ocx. normalize ( cause . clone ( ) , param_env, ty) ;
65
66
debug ! ( "relate_type_and_user_type: ty of def-id is {:?}" , ty) ;
66
67
67
- ocx. eq ( & ObligationCause :: dummy_with_span ( span ) , param_env, mir_ty, ty) ?;
68
+ ocx. eq ( & cause , param_env, mir_ty, ty) ?;
68
69
69
70
// Prove the predicates coming along with `def_id`.
70
71
//
@@ -73,8 +74,6 @@ pub fn type_op_ascribe_user_type_with_span<'tcx>(
73
74
// outlives" error messages.
74
75
let instantiated_predicates = tcx. predicates_of ( def_id) . instantiate ( tcx, substs) ;
75
76
76
- let cause = ObligationCause :: dummy_with_span ( span) ;
77
-
78
77
debug ! ( ?instantiated_predicates) ;
79
78
for ( instantiated_predicate, predicate_span) in
80
79
zip ( instantiated_predicates. predicates , instantiated_predicates. spans )
@@ -93,10 +92,9 @@ pub fn type_op_ascribe_user_type_with_span<'tcx>(
93
92
94
93
if let Some ( UserSelfTy { impl_def_id, self_ty } ) = user_self_ty {
95
94
let impl_self_ty = tcx. bound_type_of ( impl_def_id) . subst ( tcx, substs) ;
96
- let impl_self_ty =
97
- ocx. normalize ( ObligationCause :: misc ( span, hir:: CRATE_HIR_ID ) , param_env, impl_self_ty) ;
95
+ let impl_self_ty = ocx. normalize ( cause. clone ( ) , param_env, impl_self_ty) ;
98
96
99
- ocx. eq ( & ObligationCause :: dummy_with_span ( span ) , param_env, self_ty, impl_self_ty) ?;
97
+ ocx. eq ( & cause , param_env, self_ty, impl_self_ty) ?;
100
98
101
99
let predicate: Predicate < ' tcx > =
102
100
ty:: Binder :: dummy ( ty:: PredicateKind :: WellFormed ( impl_self_ty. into ( ) ) ) . to_predicate ( tcx) ;
0 commit comments