Guard AliasTy
creation against passing the wrong number of substs
This commit is contained in:
parent
7bdda8f801
commit
fef872a875
9 changed files with 35 additions and 38 deletions
|
@ -1867,10 +1867,7 @@ fn confirm_generator_candidate<'cx, 'tcx>(
|
|||
};
|
||||
|
||||
ty::ProjectionPredicate {
|
||||
projection_ty: ty::AliasTy {
|
||||
substs: trait_ref.substs,
|
||||
def_id: obligation.predicate.def_id,
|
||||
},
|
||||
projection_ty: tcx.mk_alias_ty(obligation.predicate.def_id, trait_ref.substs),
|
||||
term: ty.into(),
|
||||
}
|
||||
});
|
||||
|
@ -1909,10 +1906,7 @@ fn confirm_future_candidate<'cx, 'tcx>(
|
|||
debug_assert_eq!(tcx.associated_item(obligation.predicate.def_id).name, sym::Output);
|
||||
|
||||
ty::ProjectionPredicate {
|
||||
projection_ty: ty::AliasTy {
|
||||
substs: trait_ref.substs,
|
||||
def_id: obligation.predicate.def_id,
|
||||
},
|
||||
projection_ty: tcx.mk_alias_ty(obligation.predicate.def_id, trait_ref.substs),
|
||||
term: return_ty.into(),
|
||||
}
|
||||
});
|
||||
|
@ -1965,10 +1959,8 @@ fn confirm_builtin_candidate<'cx, 'tcx>(
|
|||
bug!("unexpected builtin trait with associated type: {:?}", obligation.predicate);
|
||||
};
|
||||
|
||||
let predicate = ty::ProjectionPredicate {
|
||||
projection_ty: ty::AliasTy { substs, def_id: item_def_id },
|
||||
term,
|
||||
};
|
||||
let predicate =
|
||||
ty::ProjectionPredicate { projection_ty: tcx.mk_alias_ty(item_def_id, substs), term };
|
||||
|
||||
confirm_param_env_candidate(selcx, obligation, ty::Binder::dummy(predicate), false)
|
||||
.with_addl_obligations(obligations)
|
||||
|
@ -2037,7 +2029,7 @@ fn confirm_callable_candidate<'cx, 'tcx>(
|
|||
flag,
|
||||
)
|
||||
.map_bound(|(trait_ref, ret_type)| ty::ProjectionPredicate {
|
||||
projection_ty: ty::AliasTy { substs: trait_ref.substs, def_id: fn_once_output_def_id },
|
||||
projection_ty: tcx.mk_alias_ty(fn_once_output_def_id, trait_ref.substs),
|
||||
term: ret_type.into(),
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue