nit: Make get_infer_ret_ty name more consistent with is_suggestable_infer_ty

This commit is contained in:
Michael Goulet 2025-01-02 18:19:46 +00:00
parent 4363f9b6f6
commit c5d4996404
5 changed files with 5 additions and 5 deletions

View File

@ -3387,7 +3387,7 @@ impl<'hir> FnRetTy<'hir> {
} }
} }
pub fn get_infer_ret_ty(&self) -> Option<&'hir Ty<'hir>> { pub fn is_suggestable_infer_ty(&self) -> Option<&'hir Ty<'hir>> {
if let Self::Return(ty) = self { if let Self::Return(ty) = self {
if ty.is_suggestable_infer_ty() { if ty.is_suggestable_infer_ty() {
return Some(*ty); return Some(*ty);

View File

@ -1371,7 +1371,7 @@ fn lower_fn_sig_recovering_infer_ret_ty<'tcx>(
generics: &'tcx hir::Generics<'tcx>, generics: &'tcx hir::Generics<'tcx>,
def_id: LocalDefId, def_id: LocalDefId,
) -> ty::PolyFnSig<'tcx> { ) -> ty::PolyFnSig<'tcx> {
if let Some(infer_ret_ty) = sig.decl.output.get_infer_ret_ty() { if let Some(infer_ret_ty) = sig.decl.output.is_suggestable_infer_ty() {
return recover_infer_ret_ty(icx, infer_ret_ty, generics, def_id); return recover_infer_ret_ty(icx, infer_ret_ty, generics, def_id);
} }

View File

@ -187,7 +187,7 @@ impl TaitConstraintLocator<'_> {
"foreign items cannot constrain opaque types", "foreign items cannot constrain opaque types",
); );
if let Some(hir_sig) = hir_node.fn_sig() if let Some(hir_sig) = hir_node.fn_sig()
&& hir_sig.decl.output.get_infer_ret_ty().is_some() && hir_sig.decl.output.is_suggestable_infer_ty().is_some()
{ {
let guar = self.tcx.dcx().span_delayed_bug( let guar = self.tcx.dcx().span_delayed_bug(
hir_sig.decl.output.span(), hir_sig.decl.output.span(),

View File

@ -150,7 +150,7 @@ fn typeck_with_fallback<'tcx>(
let mut fcx = FnCtxt::new(&root_ctxt, param_env, def_id); let mut fcx = FnCtxt::new(&root_ctxt, param_env, def_id);
if let Some(hir::FnSig { header, decl, .. }) = node.fn_sig() { if let Some(hir::FnSig { header, decl, .. }) = node.fn_sig() {
let fn_sig = if decl.output.get_infer_ret_ty().is_some() { let fn_sig = if decl.output.is_suggestable_infer_ty().is_some() {
fcx.lowerer().lower_fn_ty(id, header.safety, header.abi, decl, None, None) fcx.lowerer().lower_fn_ty(id, header.safety, header.abi, decl, None, None)
} else { } else {
tcx.fn_sig(def_id).instantiate_identity() tcx.fn_sig(def_id).instantiate_identity()

View File

@ -31,7 +31,7 @@ pub fn walk_types<'tcx, V: SpannedTypeVisitor<'tcx>>(
// If the type of the item uses `_`, we're gonna error out anyway, but // If the type of the item uses `_`, we're gonna error out anyway, but
// typeck (which type_of invokes below), will call back into opaque_types_defined_by // typeck (which type_of invokes below), will call back into opaque_types_defined_by
// causing a cycle. So we just bail out in this case. // causing a cycle. So we just bail out in this case.
if hir_sig.output.get_infer_ret_ty().is_some() { if hir_sig.output.is_suggestable_infer_ty().is_some() {
return V::Result::output(); return V::Result::output();
} }
let ty_sig = tcx.fn_sig(item).instantiate_identity(); let ty_sig = tcx.fn_sig(item).instantiate_identity();