Expand description
This module implements expansion of delegation items with early resolved paths. It includes a delegation to a free functions:
reuse module::name { target_expr_template }And delegation to a trait methods:
reuse <Type as Trait>::name { target_expr_template }After expansion for both cases we get:
fn name(
arg0: InferDelegation(sig_id, Input(0)),
arg1: InferDelegation(sig_id, Input(1)),
...,
argN: InferDelegation(sig_id, Input(N)),
) -> InferDelegation(sig_id, Output) {
callee_path(target_expr_template(arg0), arg1, ..., argN)
}Where callee_path is a path in delegation item e.g. <Type as Trait>::name.
sig_id is a id of item from which the signature is inherited. It may be a delegation
item id (item_id) in case of impl trait or path resolution id (path_id) otherwise.
Since we do not have a proper way to obtain function type information by path resolution
in AST, we mark each function parameter type as InferDelegation and inherit it during
HIR ty lowering.
Similarly generics, predicates and header are set to the “default” values.
In case of discrepancy with callee function the UnsupportedDelegation error will
also be emitted during HIR ty lowering.
Re-exports§
use std::iter;🔒use ast::visit::Visitor;🔒use generics::GenericsGenerationResult;🔒use hir::HirId;🔒use hir::def::Res;🔒use rustc_abi::ExternAbi;🔒use rustc_ast as ast;🔒use rustc_attr_ir::lang_items::LangItem;🔒use rustc_hir::def::DefKind;🔒use rustc_hir as hir;🔒use rustc_hir::FnDeclFlags;🔒use rustc_hir::QPath;🔒use rustc_middle::ty::Asyncness;🔒use rustc_span::def_id::DefId;🔒use rustc_span::symbol::kw;🔒use rustc_span::Ident;🔒use rustc_span::Span;🔒use rustc_span::Symbol;🔒use crate::delegation::generics::GenericsGenerationResults;🔒use crate::delegation::generics::GenericsPosition;🔒use crate::delegation::resolution::resolver::DelegationResolver;🔒use crate::delegation::resolution::DelegationResolution;🔒use crate::delegation::resolution::ParamInfo;🔒use crate::AllowReturnTypeNotation;🔒use crate::ImplTraitContext;🔒use crate::ImplTraitPosition;🔒use crate::LoweringContext;🔒use crate::ParamMode;🔒use rustc_ast::*;🔒
Modules§
- attributes 🔒
- generics 🔒
- resolution 🔒