Delegation: second attempt to improve perf

This commit is contained in:
Bryanskiy 2024-07-31 18:58:04 +03:00
parent 595316b400
commit 9b097b2d44
5 changed files with 33 additions and 27 deletions

View file

@ -2952,6 +2952,17 @@ pub struct FnDecl<'hir> {
pub lifetime_elision_allowed: bool,
}
impl<'hir> FnDecl<'hir> {
pub fn opt_delegation_sig_id(&self) -> Option<DefId> {
if let FnRetTy::Return(ty) = self.output
&& let TyKind::InferDelegation(sig_id, _) = ty.kind
{
return Some(sig_id);
}
None
}
}
/// Represents what type of implicit self a function has, if any.
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable_Generic)]
pub enum ImplicitSelfKind {