Skip to main content

check_orphan_rules

Function check_orphan_rules 

Source
pub fn check_orphan_rules<'db>(
    db: &'db (dyn HirDatabase + 'static),
    impl_: ImplId,
) -> bool
Expand description

Checks whether the impl satisfies the orphan rules.

Given impl<P1..=Pn> Trait<T1..=Tn> for T0, an impl is valid only if at least one of the following is true:

  • Trait is a local trait
  • All of
    • At least one of the types T0..=Tn must be a local type. Let Ti be the first such type.
    • No uncovered type parameters P1..=Pn may appear in T0..Ti (excluding Ti)