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

Negative coverage: is_local_parameter / local rigid type / premise if decls.is_local_adt_id(a)

Premise at line 323. Observed failure causes: if_false.

local rigid type
LineCoverageSource
3235(if decls.is_local_adt_id(a))
──────── ("local rigid type")
32513(is_local_parameter(decls, env, _assumptions, RigidTy { name: RigidName::AdtId(a), parameters: _ }) => Constraints::none(env))

5 tests failed proving this premise:


Source location: tests/coherence_orphan.rs:13 (all coverage from this test)

#[test]
fn neg_CoreTrait_for_CoreStruct_in_Foo() {
    FormalityTest::new(crates![crate core {
                trait CoreTrait {}
                struct CoreStruct {}
            },
            crate foo {
                #![feature(negative_impls)]
                impl !CoreTrait for CoreStruct {}
            }]).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> { } struct CoreStruct { } }, crate foo { #![feature(negative_impls)] impl ! CoreTrait for CoreStruct {} }], 222)
                    name = (adt CoreStruct)

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

                the rule "local rigid type" at (is_local.rs) failed because
                  condition evaluated to false: `decls.is_local_adt_id(a)`
                    decls = program([crate core { trait CoreTrait <ty> { } struct CoreStruct { } }, crate foo { #![feature(negative_impls)] impl ! CoreTrait for CoreStruct {} }], 222)
                    a = CoreStruct

                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> { } struct CoreStruct { } }, crate foo { #![feature(negative_impls)] impl ! CoreTrait for CoreStruct {} }], 222)
                    &goal.trait_id = CoreTrait"#]])
}
Failed proof tree

Source location: tests/coherence_orphan.rs:48 (all coverage from this test)

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

                trait Mirror {
                    type Assoc : [];
                }

                impl<T> Mirror for T {
                    type Assoc = T;
                }
            },
            crate foo {
                impl CoreTrait for <CoreStruct as Mirror>::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> { } struct CoreStruct { } trait Mirror <ty> { type Assoc : [] ; } impl <ty> Mirror for ^ty0_0 { type Assoc = ^ty1_0 ; } }, crate foo { impl CoreTrait for <CoreStruct as Mirror>::Assoc { } }], 222)
                    name = (adt CoreStruct)

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

                the rule "local rigid type" at (is_local.rs) failed because
                  condition evaluated to false: `decls.is_local_adt_id(a)`
                    decls = program([crate core { trait CoreTrait <ty> { } struct CoreStruct { } trait Mirror <ty> { type Assoc : [] ; } impl <ty> Mirror for ^ty0_0 { type Assoc = ^ty1_0 ; } }, crate foo { impl CoreTrait for <CoreStruct as Mirror>::Assoc { } }], 222)
                    a = CoreStruct

                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> { } struct CoreStruct { } trait Mirror <ty> { type Assoc : [] ; } impl <ty> Mirror for ^ty0_0 { type Assoc = ^ty1_0 ; } }, crate foo { impl CoreTrait for <CoreStruct as Mirror>::Assoc { } }], 222)
                    &goal.trait_id = CoreTrait"#]])
}
Failed proof tree

Source location: tests/coherence_orphan.rs:329 (all coverage from this test)

#[test]
fn ref_foreign_wrapper_of_local_is_not_local() {
    FormalityTest::new(crates![crate core {
        trait CoreTrait {}
        struct ForeignWrapper<T> { value: T }
    },
    crate foo {
        struct FooStruct {}
        impl<'a> CoreTrait for &'a ForeignWrapper<FooStruct> {}
    }])
    .rustc_err(expect_test::expect![[r#"
        error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
         --> lib.rs
          |
        5 | impl<'a00> CoreTrait for &'a00 ForeignWrapper<FooStruct> {}
          | ^^^^^^^^^^^^^^^^^^^^^^^^^-------------------------------
          |                          |
          |                          `mycore::ForeignWrapper` is not defined in the current crate
          |
          = note: impl doesn't have any local type before any uncovered type parameters
          = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
          = note: define and implement a trait or new type instead

        For more information about this error, try `rustc --explain E0117`.
        error: could not compile `foo` (lib) due to 1 previous error
    "#]])
    .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> { } struct ForeignWrapper <ty> { value : ^ty0_0 } }, crate foo { struct FooStruct { } impl <lt> CoreTrait for &^lt0_0 ForeignWrapper<FooStruct> { } }], 222)
            name = (adt ForeignWrapper)

        crates/formality-rust/src/prove/prove_normalize.rs:22:1: no applicable rules for prove_normalize { p: ForeignWrapper<FooStruct>, assumptions: {}, env: Env { variables: [!lt_0], bias: Soundness, pending: [], allow_pending_outlives: false } }

        the rule "local rigid type" at (is_local.rs) failed because
          condition evaluated to false: `decls.is_local_adt_id(a)`
            decls = program([crate core { trait CoreTrait <ty> { } struct ForeignWrapper <ty> { value : ^ty0_0 } }, crate foo { struct FooStruct { } impl <lt> CoreTrait for &^lt0_0 ForeignWrapper<FooStruct> { } }], 222)
            a = ForeignWrapper

        crates/formality-rust/src/prove/prove_normalize.rs:22:1: no applicable rules for prove_normalize { p: &!lt_0 ForeignWrapper<FooStruct>, assumptions: {}, env: Env { variables: [!lt_0], 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> { } struct ForeignWrapper <ty> { value : ^ty0_0 } }, crate foo { struct FooStruct { } impl <lt> CoreTrait for &^lt0_0 ForeignWrapper<FooStruct> { } }], 222)
            &goal.trait_id = CoreTrait"#]])
}
Failed proof tree

Source location: tests/coherence_orphan.rs:375 (all coverage from this test)

#[test]
fn ref_CoreStruct_is_not_local() {
    FormalityTest::new(crates![crate core {
        trait CoreTrait {}
        struct CoreStruct {}
    },
    crate foo {
        impl CoreTrait for &'static CoreStruct {}
    }])
    .rustc_err(expect_test::expect![[r#"
        error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
         --> lib.rs
          |
        3 | impl CoreTrait for &'static CoreStruct {}
          | ^^^^^^^^^^^^^^^^^^^-------------------
          |                    |
          |                    `mycore::CoreStruct` is not defined in the current crate
          |
          = note: impl doesn't have any local type before any uncovered type parameters
          = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
          = note: define and implement a trait or new type instead

        For more information about this error, try `rustc --explain E0117`.
        error: could not compile `foo` (lib) due to 1 previous error
    "#]])
    .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> { } struct CoreStruct { } }, crate foo { impl CoreTrait for &' static CoreStruct { } }], 222)
            name = (adt CoreStruct)

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

        the rule "local rigid type" at (is_local.rs) failed because
          condition evaluated to false: `decls.is_local_adt_id(a)`
            decls = program([crate core { trait CoreTrait <ty> { } struct CoreStruct { } }, crate foo { impl CoreTrait for &' static CoreStruct { } }], 222)
            a = CoreStruct

        crates/formality-rust/src/prove/prove_normalize.rs:22:1: no applicable rules for prove_normalize { p: &' static CoreStruct, 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> { } struct CoreStruct { } }, crate foo { impl CoreTrait for &' static CoreStruct { } }], 222)
            &goal.trait_id = CoreTrait"#]])
}
Failed proof tree

Source location: tests/coherence_orphan.rs:434 (all coverage from this test)

#[test]
fn CoreTrait_for_CoreStruct_in_Foo() {
    FormalityTest::new(crates![crate core {
                trait CoreTrait {}
                struct CoreStruct {}
            },
            crate foo {
                impl CoreTrait for CoreStruct {}
            }]).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> { } struct CoreStruct { } }, crate foo { impl CoreTrait for CoreStruct { } }], 222)
                    name = (adt CoreStruct)

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

                the rule "local rigid type" at (is_local.rs) failed because
                  condition evaluated to false: `decls.is_local_adt_id(a)`
                    decls = program([crate core { trait CoreTrait <ty> { } struct CoreStruct { } }, crate foo { impl CoreTrait for CoreStruct { } }], 222)
                    a = CoreStruct

                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> { } struct CoreStruct { } }, crate foo { impl CoreTrait for CoreStruct { } }], 222)
                    &goal.trait_id = CoreTrait"#]])
}
Failed proof tree

How to read this page