1
Fork 0

fixup new usages of fn_sig, bound_fn_sig after rebasing

This commit is contained in:
Kyle Matsuda 2023-01-26 20:33:27 -07:00
parent 4a7d0e9754
commit dc1216bc06
4 changed files with 8 additions and 7 deletions

View file

@ -463,7 +463,7 @@ fn foo(&tcx) -> Self::T { String::new() }
ty::AssocKind::Fn == item.kind && Some(item.name) != current_method_ident ty::AssocKind::Fn == item.kind && Some(item.name) != current_method_ident
}) })
.filter_map(|item| { .filter_map(|item| {
let method = tcx.fn_sig(item.def_id); let method = tcx.fn_sig(item.def_id).subst_identity();
match *method.output().skip_binder().kind() { match *method.output().skip_binder().kind() {
ty::Alias(ty::Projection, ty::AliasTy { def_id: item_def_id, .. }) ty::Alias(ty::Projection, ty::AliasTy { def_id: item_def_id, .. })
if item_def_id == proj_ty_item_def_id => if item_def_id == proj_ty_item_def_id =>

View file

@ -369,7 +369,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
(ty::FnPtr(sig), ty::FnDef(did, substs)) => { (ty::FnPtr(sig), ty::FnDef(did, substs)) => {
let expected_sig = &(self.normalize_fn_sig)(*sig); let expected_sig = &(self.normalize_fn_sig)(*sig);
let found_sig = let found_sig =
&(self.normalize_fn_sig)(self.tcx.bound_fn_sig(*did).subst(self.tcx, substs)); &(self.normalize_fn_sig)(self.tcx.fn_sig(*did).subst(self.tcx, substs));
let fn_name = self.tcx.def_path_str_with_substs(*did, substs); let fn_name = self.tcx.def_path_str_with_substs(*did, substs);
@ -408,9 +408,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
} }
(ty::FnDef(did1, substs1), ty::FnDef(did2, substs2)) => { (ty::FnDef(did1, substs1), ty::FnDef(did2, substs2)) => {
let expected_sig = let expected_sig =
&(self.normalize_fn_sig)(self.tcx.bound_fn_sig(*did1).subst(self.tcx, substs1)); &(self.normalize_fn_sig)(self.tcx.fn_sig(*did1).subst(self.tcx, substs1));
let found_sig = let found_sig =
&(self.normalize_fn_sig)(self.tcx.bound_fn_sig(*did2).subst(self.tcx, substs2)); &(self.normalize_fn_sig)(self.tcx.fn_sig(*did2).subst(self.tcx, substs2));
if self.same_type_modulo_infer(*expected_sig, *found_sig) { if self.same_type_modulo_infer(*expected_sig, *found_sig) {
diag.note("different fn items have unique types, even if their signatures are the same"); diag.note("different fn items have unique types, even if their signatures are the same");
@ -440,7 +440,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
} }
(ty::FnDef(did, substs), ty::FnPtr(sig)) => { (ty::FnDef(did, substs), ty::FnPtr(sig)) => {
let expected_sig = let expected_sig =
&(self.normalize_fn_sig)(self.tcx.bound_fn_sig(*did).subst(self.tcx, substs)); &(self.normalize_fn_sig)(self.tcx.fn_sig(*did).subst(self.tcx, substs));
let found_sig = &(self.normalize_fn_sig)(*sig); let found_sig = &(self.normalize_fn_sig)(*sig);
if !self.same_type_modulo_infer(*found_sig, *expected_sig) { if !self.same_type_modulo_infer(*found_sig, *expected_sig) {

View file

@ -2120,7 +2120,8 @@ impl CheckAttrVisitor<'_> {
let id = hir_id.expect_owner(); let id = hir_id.expect_owner();
let hir_sig = tcx.hir().fn_sig_by_hir_id(hir_id).unwrap(); let hir_sig = tcx.hir().fn_sig_by_hir_id(hir_id).unwrap();
let sig = tcx.liberate_late_bound_regions(id.to_def_id(), tcx.fn_sig(id)); let sig =
tcx.liberate_late_bound_regions(id.to_def_id(), tcx.fn_sig(id).subst_identity());
let sig = tcx.normalize_erasing_regions(ParamEnv::empty(), sig); let sig = tcx.normalize_erasing_regions(ParamEnv::empty(), sig);
// We don't currently require that the function signature is equal to // We don't currently require that the function signature is equal to

View file

@ -184,7 +184,7 @@ pub(crate) fn extract_tupled_inputs_and_output_from_callable<'tcx>(
) -> Result<Option<ty::Binder<'tcx, (Ty<'tcx>, Ty<'tcx>)>>, NoSolution> { ) -> Result<Option<ty::Binder<'tcx, (Ty<'tcx>, Ty<'tcx>)>>, NoSolution> {
match *self_ty.kind() { match *self_ty.kind() {
ty::FnDef(def_id, substs) => Ok(Some( ty::FnDef(def_id, substs) => Ok(Some(
tcx.bound_fn_sig(def_id) tcx.fn_sig(def_id)
.subst(tcx, substs) .subst(tcx, substs)
.map_bound(|sig| (tcx.mk_tup(sig.inputs().iter()), sig.output())), .map_bound(|sig| (tcx.mk_tup(sig.inputs().iter()), sig.output())),
)), )),