Skip to content

Commit 130a9e6

Browse files
lcnrjdonszelmann
authored andcommitted
don't use env with infer vars
1 parent 7d8ebe3 commit 130a9e6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

compiler/rustc_trait_selection/src/traits/coherence.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -503,15 +503,12 @@ fn impl_intersection_has_negative_obligation(
503503
assert_eq!(root_universe, ty::UniverseIndex::ROOT);
504504

505505
let impl1_header = fresh_impl_header(infcx, impl1_def_id, is_of_trait);
506-
let param_env =
507-
ty::EarlyBinder::bind(tcx.param_env(impl1_def_id)).instantiate(tcx, impl1_header.impl_args);
508-
509506
let impl2_header = fresh_impl_header(infcx, impl2_def_id, is_of_trait);
510507

511508
// Equate the headers to find their intersection (the general type, with infer vars,
512509
// that may apply both impls).
513510
let Some(equate_obligations) =
514-
equate_impl_headers(infcx, param_env, &impl1_header, &impl2_header)
511+
equate_impl_headers(infcx, ty::ParamEnv::empty(), &impl1_header, &impl2_header)
515512
else {
516513
return false;
517514
};
@@ -529,7 +526,10 @@ fn impl_intersection_has_negative_obligation(
529526
root_universe,
530527
(impl1_header.impl_args, impl2_header.impl_args),
531528
);
532-
let param_env = infcx.resolve_vars_if_possible(param_env);
529+
530+
let impl1_header_args = infcx.resolve_vars_if_possible(impl1_header.impl_args);
531+
let param_env =
532+
ty::EarlyBinder::bind(tcx.param_env(impl1_def_id)).instantiate(tcx, impl1_header_args);
533533

534534
util::elaborate(tcx, tcx.predicates_of(impl2_def_id).instantiate(tcx, impl2_header.impl_args))
535535
.elaborate_sized()

0 commit comments

Comments
 (0)