change is_subtype to relate_types
This commit is contained in:
parent
cd7f471931
commit
6f0c5ee2d4
15 changed files with 128 additions and 86 deletions
|
@ -218,7 +218,13 @@ impl<'tcx> Inliner<'tcx> {
|
|||
// Normally, this shouldn't be required, but trait normalization failure can create a
|
||||
// validation ICE.
|
||||
let output_type = callee_body.return_ty();
|
||||
if !util::is_subtype(self.tcx, self.param_env, output_type, destination_ty) {
|
||||
if !util::relate_types(
|
||||
self.tcx,
|
||||
self.param_env,
|
||||
ty::Variance::Covariant,
|
||||
output_type,
|
||||
destination_ty,
|
||||
) {
|
||||
trace!(?output_type, ?destination_ty);
|
||||
return Err("failed to normalize return type");
|
||||
}
|
||||
|
@ -248,7 +254,13 @@ impl<'tcx> Inliner<'tcx> {
|
|||
self_arg_ty.into_iter().chain(arg_tuple_tys).zip(callee_body.args_iter())
|
||||
{
|
||||
let input_type = callee_body.local_decls[input].ty;
|
||||
if !util::is_subtype(self.tcx, self.param_env, input_type, arg_ty) {
|
||||
if !util::relate_types(
|
||||
self.tcx,
|
||||
self.param_env,
|
||||
ty::Variance::Covariant,
|
||||
input_type,
|
||||
arg_ty,
|
||||
) {
|
||||
trace!(?arg_ty, ?input_type);
|
||||
return Err("failed to normalize tuple argument type");
|
||||
}
|
||||
|
@ -257,7 +269,13 @@ impl<'tcx> Inliner<'tcx> {
|
|||
for (arg, input) in args.iter().zip(callee_body.args_iter()) {
|
||||
let input_type = callee_body.local_decls[input].ty;
|
||||
let arg_ty = arg.ty(&caller_body.local_decls, self.tcx);
|
||||
if !util::is_subtype(self.tcx, self.param_env, input_type, arg_ty) {
|
||||
if !util::relate_types(
|
||||
self.tcx,
|
||||
self.param_env,
|
||||
ty::Variance::Covariant,
|
||||
input_type,
|
||||
arg_ty,
|
||||
) {
|
||||
trace!(?arg_ty, ?input_type);
|
||||
return Err("failed to normalize argument type");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue