@@ -282,6 +282,7 @@ fn compare_method_predicate_entailment<'tcx>(
282
282
let emitted = report_trait_method_mismatch (
283
283
infcx,
284
284
cause,
285
+ param_env,
285
286
terr,
286
287
( trait_m, trait_sig) ,
287
288
( impl_m, impl_sig) ,
@@ -575,10 +576,10 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
575
576
hir. get_if_local ( impl_m. def_id )
576
577
. and_then ( |node| node. fn_decl ( ) )
577
578
. map ( |decl| ( decl. output . span ( ) , Cow :: from ( "return type in trait" ) , false ) ) ,
578
- Some ( infer:: ValuePairs :: Terms ( ExpectedFound {
579
+ Some ( param_env . and ( infer:: ValuePairs :: Terms ( ExpectedFound {
579
580
expected : trait_return_ty. into ( ) ,
580
581
found : impl_return_ty. into ( ) ,
581
- } ) ) ,
582
+ } ) ) ) ,
582
583
terr,
583
584
false ,
584
585
) ;
@@ -602,6 +603,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
602
603
let emitted = report_trait_method_mismatch (
603
604
infcx,
604
605
cause,
606
+ param_env,
605
607
terr,
606
608
( trait_m, trait_sig) ,
607
609
( impl_m, impl_sig) ,
@@ -915,6 +917,7 @@ impl<'tcx> ty::FallibleTypeFolder<TyCtxt<'tcx>> for RemapHiddenTyRegions<'tcx> {
915
917
fn report_trait_method_mismatch < ' tcx > (
916
918
infcx : & InferCtxt < ' tcx > ,
917
919
mut cause : ObligationCause < ' tcx > ,
920
+ param_env : ty:: ParamEnv < ' tcx > ,
918
921
terr : TypeError < ' tcx > ,
919
922
( trait_m, trait_sig) : ( ty:: AssocItem , ty:: FnSig < ' tcx > ) ,
920
923
( impl_m, impl_sig) : ( ty:: AssocItem , ty:: FnSig < ' tcx > ) ,
@@ -1000,10 +1003,10 @@ fn report_trait_method_mismatch<'tcx>(
1000
1003
& mut diag,
1001
1004
& cause,
1002
1005
trait_err_span. map ( |sp| ( sp, Cow :: from ( "type in trait" ) , false ) ) ,
1003
- Some ( infer:: ValuePairs :: PolySigs ( ExpectedFound {
1006
+ Some ( param_env . and ( infer:: ValuePairs :: PolySigs ( ExpectedFound {
1004
1007
expected : ty:: Binder :: dummy ( trait_sig) ,
1005
1008
found : ty:: Binder :: dummy ( impl_sig) ,
1006
- } ) ) ,
1009
+ } ) ) ) ,
1007
1010
terr,
1008
1011
false ,
1009
1012
) ;
@@ -1797,10 +1800,10 @@ fn compare_const_predicate_entailment<'tcx>(
1797
1800
& mut diag,
1798
1801
& cause,
1799
1802
trait_c_span. map ( |span| ( span, Cow :: from ( "type in trait" ) , false ) ) ,
1800
- Some ( infer:: ValuePairs :: Terms ( ExpectedFound {
1803
+ Some ( param_env . and ( infer:: ValuePairs :: Terms ( ExpectedFound {
1801
1804
expected : trait_ty. into ( ) ,
1802
1805
found : impl_ty. into ( ) ,
1803
- } ) ) ,
1806
+ } ) ) ) ,
1804
1807
terr,
1805
1808
false ,
1806
1809
) ;
0 commit comments