Prevent the creation of TraitRef without dedicated methods

This commit is contained in:
Oli Scherer 2022-12-13 11:18:58 +00:00
parent a5cd3bde95
commit 6af3638709
9 changed files with 44 additions and 47 deletions

View file

@ -1309,8 +1309,7 @@ fn assemble_candidate_for_impl_trait_in_trait<'cx, 'tcx>(
let trait_substs =
obligation.predicate.substs.truncate_to(tcx, tcx.generics_of(trait_def_id));
// FIXME(named-returns): Binders
let trait_predicate =
ty::Binder::dummy(ty::TraitRef { def_id: trait_def_id, substs: trait_substs });
let trait_predicate = ty::Binder::dummy(tcx.mk_trait_ref(trait_def_id, trait_substs));
let _ = selcx.infcx.commit_if_ok(|_| {
match selcx.select(&obligation.with(tcx, trait_predicate)) {