Remove existing AFIDT implementation
This commit is contained in:
parent
75530e9f72
commit
93b31d9b21
18 changed files with 177 additions and 301 deletions
|
@ -8,7 +8,6 @@ use rustc_hir::lang_items::LangItem;
|
|||
use rustc_index::{Idx, IndexVec};
|
||||
use rustc_middle::mir::*;
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::adjustment::PointerCoercion;
|
||||
use rustc_middle::ty::{
|
||||
self, CoroutineArgs, CoroutineArgsExt, EarlyBinder, GenericArgs, Ty, TyCtxt,
|
||||
};
|
||||
|
@ -718,12 +717,6 @@ fn build_call_shim<'tcx>(
|
|||
|
||||
let def_id = instance.def_id();
|
||||
|
||||
let rpitit_shim = if let ty::InstanceKind::ReifyShim(..) = instance {
|
||||
tcx.return_position_impl_trait_in_trait_shim_data(def_id)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let sig = tcx.fn_sig(def_id);
|
||||
let sig = sig.map_bound(|sig| tcx.instantiate_bound_regions_with_erased(sig));
|
||||
|
||||
|
@ -779,30 +772,7 @@ fn build_call_shim<'tcx>(
|
|||
let mut local_decls = local_decls_for_sig(&sig, span);
|
||||
let source_info = SourceInfo::outermost(span);
|
||||
|
||||
let mut destination = Place::return_place();
|
||||
if let Some((rpitit_def_id, fn_args)) = rpitit_shim {
|
||||
let rpitit_args =
|
||||
fn_args.instantiate_identity().extend_to(tcx, rpitit_def_id, |param, _| {
|
||||
match param.kind {
|
||||
ty::GenericParamDefKind::Lifetime => tcx.lifetimes.re_erased.into(),
|
||||
ty::GenericParamDefKind::Type { .. }
|
||||
| ty::GenericParamDefKind::Const { .. } => {
|
||||
unreachable!("rpitit should have no addition ty/ct")
|
||||
}
|
||||
}
|
||||
});
|
||||
let dyn_star_ty = Ty::new_dynamic(
|
||||
tcx,
|
||||
tcx.item_bounds_to_existential_predicates(rpitit_def_id, rpitit_args),
|
||||
tcx.lifetimes.re_erased,
|
||||
ty::DynStar,
|
||||
);
|
||||
destination = local_decls.push(local_decls[RETURN_PLACE].clone()).into();
|
||||
local_decls[RETURN_PLACE].ty = dyn_star_ty;
|
||||
let mut inputs_and_output = sig.inputs_and_output.to_vec();
|
||||
*inputs_and_output.last_mut().unwrap() = dyn_star_ty;
|
||||
sig.inputs_and_output = tcx.mk_type_list(&inputs_and_output);
|
||||
}
|
||||
let destination = Place::return_place();
|
||||
|
||||
let rcvr_place = || {
|
||||
assert!(rcvr_adjustment.is_some());
|
||||
|
@ -921,23 +891,7 @@ fn build_call_shim<'tcx>(
|
|||
);
|
||||
}
|
||||
// BB #1/#2 - return
|
||||
// NOTE: If this is an RPITIT in dyn, we also want to coerce
|
||||
// the return type of the function into a `dyn*`.
|
||||
let stmts = if rpitit_shim.is_some() {
|
||||
vec![Statement {
|
||||
source_info,
|
||||
kind: StatementKind::Assign(Box::new((
|
||||
Place::return_place(),
|
||||
Rvalue::Cast(
|
||||
CastKind::PointerCoercion(PointerCoercion::DynStar, CoercionSource::Implicit),
|
||||
Operand::Move(destination),
|
||||
sig.output(),
|
||||
),
|
||||
))),
|
||||
}]
|
||||
} else {
|
||||
vec![]
|
||||
};
|
||||
let stmts = vec![];
|
||||
block(&mut blocks, stmts, TerminatorKind::Return, false);
|
||||
if let Some(Adjustment::RefMut) = rcvr_adjustment {
|
||||
// BB #3 - drop if closure panics
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue