clippy_utils::ty

Function make_projection

Source
pub fn make_projection<'tcx>(
    tcx: TyCtxt<'tcx>,
    container_id: DefId,
    assoc_ty: Symbol,
    args: impl IntoIterator<Item = impl Into<GenericArg<'tcx>>>,
) -> Option<AliasTy<'tcx>>
Expand description

Makes the projection type for the named associated type in the given impl or trait impl.

This function is for associated types which are “known” to exist, and as such, will only return None when debug assertions are disabled in order to prevent ICE’s. With debug assertions enabled this will check that the named associated type exists, the correct number of arguments are given, and that the correct kinds of arguments are given (lifetime, constant or type). This will not check if type normalization would succeed.