1
Fork 0

Support safe transmute in new solver

This commit is contained in:
Michael Goulet 2023-04-09 00:09:53 +00:00
parent 2a198c7f62
commit d92f74e43b
5 changed files with 67 additions and 0 deletions

View file

@ -225,6 +225,11 @@ pub(super) trait GoalKind<'tcx>: TypeFoldable<TyCtxt<'tcx>> + Copy + Eq {
ecx: &mut EvalCtxt<'_, 'tcx>,
goal: Goal<'tcx, Self>,
) -> QueryResult<'tcx>;
fn consider_builtin_transmute_candidate(
ecx: &mut EvalCtxt<'_, 'tcx>,
goal: Goal<'tcx, Self>,
) -> QueryResult<'tcx>;
}
impl<'tcx> EvalCtxt<'_, 'tcx> {
@ -373,6 +378,8 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
G::consider_builtin_discriminant_kind_candidate(self, goal)
} else if lang_items.destruct_trait() == Some(trait_def_id) {
G::consider_builtin_destruct_candidate(self, goal)
} else if lang_items.transmute_trait() == Some(trait_def_id) {
G::consider_builtin_transmute_candidate(self, goal)
} else {
Err(NoSolution)
};