check_assoc_const_binding_type in rustc_hir_analysis::hir_ty_lowering::bounds - Rust
Description: Detect and reject early-bound & escaping late-bound generic params in the type of assoc const bindings.

Skip to main content

## check_assoc_const_binding_type

# Function check_assoc_const_binding_type

Source

    pub(crate) fn check_assoc_const_binding_type<'tcx>(
        cx: &dyn HirTyLowerer<'tcx>,
        assoc_const: Ident,
        ty: Binder<'tcx, Ty<'tcx>>,
        hir_id: HirId,
    ) -> Ty<'tcx>

Expand description

Detect and reject early-bound & escaping late-bound generic params in the type of assoc const bindings.

FIXME(const_generics): This is a temporary and semi-artificial restriction until the arrival of generic const generics1.

It might actually be possible that we can already support early-bound generic params in such types if we just lifted some more checks in other places, too, for example inside `HirTyLowerer::lower_anon_const`. However, even if that were the case, we should probably gate this behind another feature flag.

1. https://github.com/rust-lang/project-const-generics/issues/28. ↩