paralegal_flow::utils

Function test_generics_normalization

Source
fn test_generics_normalization<'tcx>(
    tcx: TyCtxt<'tcx>,
    args: &'tcx List<GenericArg<'tcx>>,
) -> Result<(), NormalizationError<'tcx>>
Expand description

Try and normalize the provided generics.

The purpose of this function is to test whether resolving these generics will return an error. We need this because [ty::Instance::resolve] fails with a hard error when this normalization fails (even though it returns Result). However legitimate situations can arise in the code where this normalization fails for which we want to report warnings but carry on with the analysis which a hard error doesn’t allow us to do.