Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Judgment is_not_downstream

judgment_fn! {
    /// `is_not_downstream(..., P)` means that `P` cannot be instantiated with a type from
    /// a downstream crate (i.e., a crate that has us as a dependency).
    ///
    /// NB. Since RFC 2451, the judgment applies to the outermost type only. In other words,
    /// the judgment holds for (e.g.) `Vec<T>`, which could be instantiated
    /// with something like `Vec<DownstreamType>`, but that is not considered downstream
    /// as the outermost type (`Vec`) is upstream.
    fn is_not_downstream(
        _decls: Program,
        env: Env,
        assumptions: Predicates,
        parameter: Parameter,
    ) => Constraints {
        /* rules omitted */
    }
}

Source: crates/formality-rust/src/prove/is_local.rs:236

The number on each rule’s conclusion is positive coverage; the number on each premise is negative coverage. Click a number to browse the tests.

lifetime
LineCoverageSource
──────── ("lifetime")
2562(is_not_downstream(_decls, env, _assumptions, _l: Lt) => Constraints::none(env))
rigid
LineCoverageSource
2623(if !is_fundamental(decls, name))
──────── ("rigid")
2644(is_not_downstream(decls, env, _assumptions, RigidTy { name, parameters: _ }) => Constraints::none(env))
fundamental type
LineCoverageSource
269✗(if is_fundamental(decls, name))
2703(for_all(decls, env, assumptions, parameters, &is_not_downstream) => c)
──────── ("fundamental type")
2722(is_not_downstream(decls, env, assumptions, RigidTy { name, parameters }) => c)
via normalize
LineCoverageSource
2764(prove_normalize(decls, env, assumptions, parameter) => Constrained(p, c1))
277N/A(let assumptions = c1.substitution().apply(assumptions))
278✗(is_not_downstream(decls, c1.env(), assumptions, p) => c2)
──────── ("via normalize")
2801(is_not_downstream(decls, env, assumptions, parameter) => c1.seq(c2))
type variable
LineCoverageSource
──────── ("type variable")
287✗(is_not_downstream(_decls, env, _assumptions, Ty::Variable(Variable::ExistentialVar(_)))
=> Constraints::none(env).ambiguous())

How to read this page