rustc_hir_analysis::impl_wf_check::min_specialization

Function check_predicates

Source
fn check_predicates<'tcx>(
    tcx: TyCtxt<'tcx>,
    impl1_def_id: LocalDefId,
    impl1_args: GenericArgsRef<'tcx>,
    impl2_node: Node,
    impl2_args: GenericArgsRef<'tcx>,
    span: Span,
) -> Result<(), ErrorGuaranteed>
Expand description

Check whether predicates on the specializing impl (impl1) are allowed.

Each predicate P must be one of:

  • Global (not reference any parameters).
  • A T: Tr predicate where Tr is an always-applicable trait.
  • Present on the base impl impl2.
    • This check is done using the trait_predicates_eq function below.
  • A well-formed predicate of a type argument of the trait being implemented, including the Self-type.