# Function rustc_trait_selection::traits::project::opt_normalize_projection_type

source ·

    pub(super) fn opt_normalize_projection_type<'a, 'b, 'tcx>(
        selcx: &'a mut SelectionContext<'b, 'tcx>,
        param_env: ParamEnv<'tcx>,
        projection_ty: AliasTy<'tcx>,
        cause: ObligationCause<'tcx>,
        depth: usize,
        obligations: &mut Vec<PredicateObligation<'tcx>>
    ) -> Result<Option<Term<'tcx>>, InProgress>

Expand description

The guts of `normalize`: normalize a specific projection like `<T as Trait>::Item`. The result is always a type (and possibly additional obligations). Returns `None` in the case of ambiguity, which indicates that there are unbound type variables.

This function used to return `Option<NormalizedTy<'tcx>>`, which contains a `Ty<'tcx>` and an obligations vector. But that obligation vector was very often immediately appended to another obligations vector. So now this function takes an obligations vector and appends to it directly, which is slightly uglier but avoids the need for an extra short-lived allocation.