delegation: Support async, const, extern "ABI" and C-variadic functions

Also allow `impl Trait` in delegated functions.
The delegation item will refer to the original opaque type from the callee, fresh opaque type won't be created.
This commit is contained in:
Vadim Petrochenkov
2024-03-14 15:42:14 +03:00
parent 99b635eafa
commit 7b7c26f09b
12 changed files with 244 additions and 151 deletions

View File

@@ -45,7 +45,7 @@ use rustc_data_structures::unord::UnordMap;
use rustc_errors::{Diag, ErrorGuaranteed, StashKey};
use rustc_hir as hir;
use rustc_hir::def::{CtorKind, CtorOf, DefKind, DocLinkResMap, LifetimeRes, Res};
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, LocalDefIdMap, LocalDefIdSet};
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, LocalDefIdMap};
use rustc_index::IndexVec;
use rustc_macros::HashStable;
use rustc_query_system::ich::StableHashingContext;
@@ -224,8 +224,15 @@ pub struct ResolverAstLowering {
pub lint_buffer: Steal<LintBuffer>,
/// Information about functions signatures for delegation items expansion
pub has_self: LocalDefIdSet,
pub fn_parameter_counts: LocalDefIdMap<usize>,
pub delegation_fn_sigs: LocalDefIdMap<DelegationFnSig>,
}
#[derive(Debug)]
pub struct DelegationFnSig {
pub header: ast::FnHeader,
pub param_count: usize,
pub has_self: bool,
pub c_variadic: bool,
}
#[derive(Clone, Copy, Debug)]