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

Test alias_to_unit

Source location: tests/coherence_orphan.rs:161

#[test]
fn alias_to_unit() {
    FormalityTest::new(crates![crate core {
                trait CoreTrait {}

                trait Unit {
                    type Assoc : [];
                }

                impl<T> Unit for T {
                    type Assoc = ();
                }
            },
            crate foo {
                struct FooStruct {}
                impl CoreTrait for <FooStruct as Unit>::Assoc {}
            }]).err(expect_test::expect![[r#"
                the rule "fundamental rigid type" at (is_local.rs) failed because
                  condition evaluated to false: `is_fundamental(decls, name)`
                    decls = program([crate core { trait CoreTrait <ty> { } trait Unit <ty> { type Assoc : [] ; } impl <ty> Unit for ^ty0_0 { type Assoc = () ; } }, crate foo { struct FooStruct { } impl CoreTrait for <FooStruct as Unit>::Assoc { } }], 222)
                    name = tuple(0)

                crates/formality-rust/src/prove/prove_normalize.rs:18:1: no applicable rules for prove_normalize { p: (), assumptions: {}, env: Env { variables: [], bias: Soundness, pending: [], allow_pending_outlives: false } }

                the rule "local trait" at (is_local.rs) failed because
                  condition evaluated to false: `decls.is_local_trait_id(&goal.trait_id)`
                    decls = program([crate core { trait CoreTrait <ty> { } trait Unit <ty> { type Assoc : [] ; } impl <ty> Unit for ^ty0_0 { type Assoc = () ; } }, crate foo { struct FooStruct { } impl CoreTrait for <FooStruct as Unit>::Assoc { } }], 222)
                    &goal.trait_id = CoreTrait"#]])
}

Rules proved (0)

This test records no positive coverage.

Premises failed (11)

The last column links to the premise’s page when the judgment view counts this failure against that premise. It does not when the premise is read as infallible, or when the failure was blamed inside a multi-line premise that carries no record on its own first line.

JudgmentRulePremiseAll tests of this premise
check_coherencecheck_coherencefor_all(trait_impl in current_crate_impls) (orph… (line 20, blamed at line 21)not counted by the judgment view
orphan_checkorphan_checkprove_goal(program, env, &a.where_clauses, Predi… (line 38)5 tests
check_all_cratescheck all prefixesfor_all(i in 0..crates.len()) (let program = cra… (line 51, blamed at line 53)not counted by the judgment view
check_cratecheck cratecheck_coherence(program, c) => () (line 74)12 tests
is_local_trait_reflocal traitif decls.is_local_trait_id(&goal.trait_id) (line 207)7 tests
is_local_trait_reflocal parameteris_local_parameter(decls, env, assumptions, &goa… (line 215)7 tests
is_local_parameterlocal parameterprove_normalize(decls, env, assumptions, goal) =… (line 287)7 tests
is_local_parameterlocal parameteris_local_parameter(decls, c1.env(), assumptions,… (line 289)2 tests
is_local_parameterfundamental rigid typeif is_fundamental(decls, name) (line 296)5 tests
prove_wctrait ref is localis_local_trait_ref(decls, env, assumptions, trai… (line 140)7 tests
prove_wc_listsomeprove_wc(decls, env, assumptions, wc0) => c (line 26)42 tests

Proof trees

Failed proof tree