Negative coverage: check_crate_item / trait impl / premise check_trait_impl(program, v, crate_id) => ()
Premise at line 195. Observed failure causes: failed_judgment.
trait impl| Line | Coverage | Source |
|---|---|---|
| 195 | 23 | (check_trait_impl(program, v, crate_id) => ()) |
| 196 | 5 | (check_drop_impl_always_applicable(program, v, crate_id) => ()) |
| ──────── ("trait impl") | ||
| 198 | 327 | (check_crate_item(program, CrateItem::TraitImpl(v), crate_id) => ()) |
23 tests failed proving this premise:
Source location: tests/basic_tests.rs:397 (all coverage from this test)
Failed proof tree
check_all_crates failedmod.rs:42args
rule "check all prefixes"mod.rs:54check_crate failedmod.rs:61args
rule "check crate"mod.rs:75check_crate_item failedmod.rs:180args
rule "trait impl"mod.rs:195check_trait_impl failedimpls.rs:14args
rule "check_trait_impl"impls.rs:35 (failed: inapplicable)
Source location: tests/basic_tests.rs:411 (all coverage from this test)
Failed proof tree
check_all_crates failedmod.rs:42args
rule "check all prefixes"mod.rs:54check_crate failedmod.rs:61args
rule "check crate"mod.rs:75check_crate_item failedmod.rs:180args
rule "trait impl"mod.rs:195check_trait_impl failedimpls.rs:14args
rule "check_trait_impl"impls.rs:35 (failed: inapplicable)
Source location: tests/basic_tests.rs:425 (all coverage from this test)
Failed proof tree
check_all_crates failedmod.rs:42args
rule "check all prefixes"mod.rs:54check_crate failedmod.rs:61args
rule "check crate"mod.rs:75check_crate_item failedmod.rs:180args
rule "trait impl"mod.rs:195check_trait_impl failedimpls.rs:14args
rule "check_trait_impl"impls.rs:39 (failed: inapplicable)
Source location: tests/basic_tests.rs:442 (all coverage from this test)
Failed proof tree
check_all_crates failedmod.rs:42args
rule "check all prefixes"mod.rs:54check_crate failedmod.rs:61args
rule "check crate"mod.rs:75check_crate_item failedmod.rs:180args
rule "trait impl"mod.rs:195check_trait_impl failedimpls.rs:14args
rule "check_trait_impl"impls.rs:39 (failed: inapplicable)
Source location: tests/coherence_overlap.rs:218 (all coverage from this test)
#[test]
fn u32_not_u32_impls() {
FormalityTest::new(crates![crate core {
trait Foo {}
impl Foo for u32 {}
impl !Foo for u32 {}
}]).err(expect_test::expect![[r#"
failed at (proven_set.rs) because
found an unconditionally true solution Constraints { env: Env { variables: [], bias: Completeness, pending: [], allow_pending_outlives: false }, known_true: true, substitution: {} }"#]])
}
Failed proof tree
check_all_crates failedmod.rs:42args
rule "check all prefixes"mod.rs:54check_crate failedmod.rs:61args
rule "check crate"mod.rs:75check_crate_item failedmod.rs:180args
rule "trait impl"mod.rs:195check_trait_impl failedimpls.rs:14args
rule "check_trait_impl"impls.rs:29negation_via_failure failednegation.rs:41ruleproven_set.rs:59 (failed: inapplicable)
Source location: tests/coherence_overlap.rs:277 (all coverage from this test)
#[test]
fn T_where_Foo_not_u32_impls() {
FormalityTest::new(crates![crate core {
trait Foo {}
impl<T> Foo for T where T: Foo {}
impl !Foo for u32 {}
}]).err(expect_test::expect![[r#"
the rule "check_trait_impl" at (impls.rs) failed because
failed to prove {! Foo(!ty_1)} given {Foo(!ty_1)}, got [Constraints { env: Env { variables: [!ty_1], bias: Soundness, pending: [], allow_pending_outlives: false }, known_true: false, substitution: {} }]"#]])
}
Failed proof tree
check_all_crates failedmod.rs:42args
rule "check all prefixes"mod.rs:54check_crate failedmod.rs:61args
rule "check crate"mod.rs:75check_crate_item failedmod.rs:180args
rule "trait impl"mod.rs:195check_trait_impl failedimpls.rs:14args
rule "check_trait_impl"impls.rs:29 (failed: inapplicable)
Source location: tests/consts.rs:36 (all coverage from this test)
#[test]
fn mismatch() {
FormalityTest::new(crates![crate Foo {
trait Foo<const C> where type_of_const C is bool {}
impl Foo<u32(42)> for u32 {}
}]).err(expect_test::expect![[r#"
crates/formality-rust/src/prove/prove_normalize.rs:22:1: no applicable rules for prove_normalize { p: u32, assumptions: {}, env: Env { variables: [], bias: Soundness, pending: [], allow_pending_outlives: false } }
crates/formality-rust/src/prove/prove_normalize.rs:22:1: no applicable rules for prove_normalize { p: bool, assumptions: {}, env: Env { variables: [], bias: Soundness, pending: [], allow_pending_outlives: false } }
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`"#]])
}
Failed proof tree
check_all_crates failedmod.rs:42args
rule "check all prefixes"mod.rs:54check_crate failedmod.rs:61args
rule "check crate"mod.rs:75check_crate_item failedmod.rs:180rule "trait impl"mod.rs:195check_trait_impl failedimpls.rs:14rule "check_trait_impl"impls.rs:28prove failedfunction.rs:250args
rulefunction.rs:250prove_predicate_list failedprove_predicate_list.rs:8args
rule "some"prove_predicate_list.rs:26prove_predicate failedprove_predicate.rs:23args
rule "positive impl"prove_predicate.rs:79prove_after failedprove_after.rs:8args
rule "prove_after"prove_after.rs:19prove failedprove_after.rs:19args
ruleprove_after.rs:19prove_predicate_list failedprove_predicate_list.rs:8args
rule "some"prove_predicate_list.rs:26prove_predicate failedprove_predicate.rs:23args
rule "const has ty"prove_predicate.rs:165prove_after failedprove_after.rs:8args
rule "prove_after"prove_after.rs:19prove failedprove_after.rs:19args
ruleprove_after.rs:19prove_predicate_list failedprove_predicate_list.rs:8args
rule "some"prove_predicate_list.rs:26prove_predicate failedprove_predicate.rs:23args
rule "eq"prove_predicate.rs:124prove_eq failedprove_eq.rs:23args
rule "normalize-l"prove_eq.rs:68prove_normalize failedprove_normalize.rs:22args
rule "symmetric"prove_eq.rs:38prove_eq failedprove_eq.rs:23args
rule "normalize-l"prove_eq.rs:68prove_normalize failedprove_normalize.rs:22args
rule "trait implied bound"prove_predicate.rs:115 (failed: empty_collection)
Source location: tests/consts.rs:76 (all coverage from this test)
#[test]
fn generic_mismatch() {
FormalityTest::new(crates![crate Foo {
trait Foo<const C> where type_of_const C is bool {}
// Here, the impl is assuming C is u32, which mismatches the trait bound.
impl<const C> Foo<C> for u32 where type_of_const C is u32 {}
}]).err(expect_test::expect![[r#"
crates/formality-rust/src/prove/prove_via.rs:9:1: no applicable rules for prove_via { goal: Foo(u32, !const_0), via: @ ConstHasType(!const_0 , u32), assumptions: {@ ConstHasType(!const_0 , u32)}, env: Env { variables: [!const_0], bias: Soundness, pending: [], allow_pending_outlives: false } }
crates/formality-rust/src/prove/prove_via.rs:9:1: no applicable rules for prove_via { goal: u32 = bool, via: @ ConstHasType(!const_0 , u32), assumptions: {@ ConstHasType(!const_0 , u32)}, env: Env { variables: [!const_0], bias: Soundness, pending: [], allow_pending_outlives: false } }
crates/formality-rust/src/prove/prove_normalize.rs:55:1: no applicable rules for prove_normalize_via { goal: u32, via: @ ConstHasType(!const_0 , u32), assumptions: {@ ConstHasType(!const_0 , u32)}, env: Env { variables: [!const_0], bias: Soundness, pending: [], allow_pending_outlives: false } }
crates/formality-rust/src/prove/prove_normalize.rs:55:1: no applicable rules for prove_normalize_via { goal: bool, via: @ ConstHasType(!const_0 , u32), assumptions: {@ ConstHasType(!const_0 , u32)}, env: Env { variables: [!const_0], bias: Soundness, pending: [], allow_pending_outlives: false } }
crates/formality-rust/src/prove/prove_const_has_type.rs:11:1: no applicable rules for prove_const_has_type { constant: !const_0, assumptions: {@ ConstHasType(!const_0 , u32)}, env: Env { variables: [!const_0], bias: Soundness, pending: [], allow_pending_outlives: false }, decls: program([crate core { trait Copy <ty> { } impl Copy for () { } impl Copy for u8 { } impl Copy for u16 { } impl Copy for u32 { } impl Copy for u64 { } impl Copy for u128 { } impl Copy for i8 { } impl Copy for i16 { } impl Copy for i32 { } impl Copy for i64 { } impl Copy for i128 { } impl Copy for bool { } impl Copy for usize { } impl Copy for isize { } impl <lt, ty> Copy for &^lt0_0 ^ty0_1 { } trait Drop <ty> { fn drop <lt> (self : &^lt0_0 mut ^ty1_0) where ^ty1_0 : ^lt0_0 ; } trait Derefable <ty> { type Target : [] ; } impl <lt, ty> Derefable for &^lt0_0 ^ty0_1 where ^ty0_1 : ^lt0_0 { type Target = ^ty1_1 ; } impl <lt, ty> Derefable for &^lt0_0 mut ^ty0_1 where ^ty0_1 : ^lt0_0 { type Target = ^ty1_1 ; } trait Sized <ty> { } }, crate Foo { trait Foo <ty, const> where type_of_const ^const0_1 is bool { } impl <const> Foo <^const0_0> for u32 where type_of_const ^const0_0 is u32 { } }], 222) }
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`"#]])
}
Failed proof tree
check_all_crates failedmod.rs:42args
rule "check all prefixes"mod.rs:54check_crate failedmod.rs:61args
rule "check crate"mod.rs:75check_crate_item failedmod.rs:180rule "trait impl"mod.rs:195check_trait_impl failedimpls.rs:14rule "check_trait_impl"impls.rs:28prove failedfunction.rs:250args
rulefunction.rs:250prove_predicate_list failedprove_predicate_list.rs:8args
rule "some"prove_predicate_list.rs:26prove_predicate failedprove_predicate.rs:23args
rule "assumption"prove_predicate.rs:49prove_via failedprove_via.rs:9args
rule "positive impl"prove_predicate.rs:79prove_after failedprove_after.rs:8args
rule "prove_after"prove_after.rs:19prove failedprove_after.rs:19args
ruleprove_after.rs:19prove_predicate_list failedprove_predicate_list.rs:8args
rule "some"prove_predicate_list.rs:26prove_predicate failedprove_predicate.rs:23args
rule "assumption"prove_predicate.rs:49prove_via failedprove_via.rs:9args
rule "predicate-congruence-axiom"prove_via.rs:32prove failedprove_via.rs:32args
ruleprove_via.rs:32prove_predicate_list failedprove_predicate_list.rs:8args
rule "some"prove_predicate_list.rs:26prove_predicate failedprove_predicate.rs:23args
rule "assumption"prove_predicate.rs:49prove_via failedprove_via.rs:9args
rule "eq"prove_predicate.rs:124prove_eq failedprove_eq.rs:23args
rule "normalize-l"prove_eq.rs:68prove_normalize failedprove_normalize.rs:22args
rule "normalize-via-assumption"prove_normalize.rs:36prove_normalize_via failedprove_normalize.rs:55args
rule "symmetric"prove_eq.rs:38prove_eq failedprove_eq.rs:23args
rule "normalize-l"prove_eq.rs:68prove_normalize failedprove_normalize.rs:22args
rule "normalize-via-assumption"prove_normalize.rs:36prove_normalize_via failedprove_normalize.rs:55args
rule "const has ty"prove_predicate.rs:164prove_const_has_type failedprove_const_has_type.rs:11args
rule "trait implied bound"prove_predicate.rs:115 (failed: empty_collection)
Source location: tests/decl_safety.rs:111 (all coverage from this test)
#[test]
fn unsafe_trait_mismatch() {
FormalityTest::new(crates![crate baguette {
unsafe trait Foo {}
impl Foo for u32 {}
}])
.rustc_err(expect_test::expect![[r#"
error[E0200]: the trait `Foo` requires an `unsafe impl` declaration
--> lib.rs
|
3 | impl Foo for u32 {}
| ^^^^^^^^^^^^^^^^
|
= note: the trait `Foo` enforces invariants that the compiler can't check. Review the trait documentation and make sure this implementation upholds those invariants before adding the `unsafe` keyword
help: add `unsafe` to this trait implementation
|
3 | unsafe impl Foo for u32 {}
| ++++++
For more information about this error, try `rustc --explain E0200`.
error: could not compile `baguette` (lib) due to 1 previous error
"#]])
.err(expect_test::expect![[r#"
the rule "safety matches" at (impls.rs) failed because
condition evaluated to false: `trait_decl.safety == trait_impl.safety`"#]])
}
Failed proof tree
check_all_crates failedmod.rs:42args
rule "check all prefixes"mod.rs:54check_crate failedmod.rs:61args
rule "check crate"mod.rs:75check_crate_item failedmod.rs:180rule "trait impl"mod.rs:195check_trait_impl failedimpls.rs:14rule "check_trait_impl"impls.rs:33check_safety_matches failedimpls.rs:98args
rule "safety matches"impls.rs:106 (failed: if_false)
Source location: tests/decl_safety.rs:138 (all coverage from this test)
#[test]
fn safe_trait_mismatch() {
FormalityTest::new(crates![crate baguette {
trait Foo {}
unsafe impl Foo for u32 {}
}])
.rustc_err(expect_test::expect![[r#"
error[E0199]: implementing the trait `Foo` is not unsafe
--> lib.rs
|
3 | unsafe impl Foo for u32 {}
| ^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove `unsafe` from this trait implementation
|
3 - unsafe impl Foo for u32 {}
3 + impl Foo for u32 {}
|
For more information about this error, try `rustc --explain E0199`.
error: could not compile `baguette` (lib) due to 1 previous error
"#]])
.err(expect_test::expect![[r#"
the rule "safety matches" at (impls.rs) failed because
condition evaluated to false: `trait_decl.safety == trait_impl.safety`"#]])
}
Failed proof tree
check_all_crates failedmod.rs:42args
rule "check all prefixes"mod.rs:54check_crate failedmod.rs:61args
rule "check crate"mod.rs:75check_crate_item failedmod.rs:180rule "trait impl"mod.rs:195check_trait_impl failedimpls.rs:14rule "check_trait_impl"impls.rs:33check_safety_matches failedimpls.rs:98args
rule "safety matches"impls.rs:106 (failed: if_false)
Source location: tests/drop.rs:83 (all coverage from this test)
Proof trees omitted for the remaining 13 tests; each one is on its test’s page in Coverage by test.
Source location: tests/drop.rs:159 (all coverage from this test)
#[test]
fn drop_impl_missing_drop_fn() {
FormalityTest::new(crates![
crate Foo {
struct MyStruct {
value: u32,
}
impl Drop for MyStruct {}
}
])
.rustc_err(expect_test::expect![[r#"
error[E0046]: not all trait items implemented, missing: `drop`
--> lib.rs
|
5 | impl Drop for MyStruct {}
| ^^^^^^^^^^^^^^^^^^^^^^ missing `drop` in implementation
|
= help: implement the missing item: `fn drop(&mut self) { todo!() }`
For more information about this error, try `rustc --explain E0046`.
error: could not compile `Foo` (lib) due to 1 previous error
"#]])
.err(expect_test::expect![[r#"
the rule "check_trait_impl" at (impls.rs) failed because
not all trait items implemented, missing: `drop`"#]])
}
Source location: tests/drop.rs:192 (all coverage from this test)
fn drop<'a>(self: &'a MyStruct) -> () {}
}
}])
rr(expect_test::expect![[r#"
r[E0053]: method `drop` has an incompatible type for trait
lib.rs
|
fn drop<'a10>(mut self: &'a10 MyStruct) -> () {}
^^^^^^^^^^^^^^ types differ in mutability
|
note: expected signature `fn(&mut MyStruct)`
found signature `fn(&MyStruct)`
: change the self-receiver type to match the trait
|
fn drop<'a10>(mut self: &'a10 MyStruct) -> () {}
fn drop<'a10>(mut &mut self) -> () {}
|
more information about this error, try `rustc --explain E0053`.
r: could not compile `Foo` (lib) due to 1 previous error
"#]])
ect_test::expect![[r#"
es/formality-rust/src/prove/prove_normalize.rs:22:1: no applicable rules for prove_normalize { p: &!lt_0 mut MyStruct, assumptions: {}, env: Env { variables: [!lt_0], bias: Soundness, pending: [], allow_pending_outlives: false } }
es/formality-rust/src/prove/prove_normalize.rs:22:1: no applicable rules for prove_normalize { p: &!lt_0 MyStruct, assumptions: {}, env: Env { variables: [!lt_0], bias: Soundness, pending: [], allow_pending_outlives: false } }"#]]);
}
ust return unit, even when its body matches another return type.
#[test]
_non_unit_return() {
yTest::new(crates![crate Foo {
ct MyStruct {}
Drop for MyStruct {
fn drop<'a>(self: &'a mut MyStruct) -> u32 {
return 0_u32;
}
Source location: tests/drop.rs:228 (all coverage from this test)
fn drop<'a>(self: &'a mut MyStruct) -> u32 {
return 0_u32;
}
Source location: tests/outlives.rs:42 (all coverage from this test)
#[test]
fn assoc_type_impl_violates_static_bound() {
FormalityTest::new(crates![crate Foo {
trait A { type Item: ['static]; }
impl<'a> A for &'a u32 { type Item = &'a u32; }
}])
.skip_execute()
.rustc_err(expect_test::expect![[r#"
error[E0477]: the type `&'a00 u32` does not fulfill the required lifetime
--> lib.rs
|
6 | type Item = &'a00 u32;
| ^^^^^^^^^
|
note: type must satisfy the static lifetime as required by this binding
--> lib.rs
|
2 | type Item: 'static;
| ^^^^^^^
For more information about this error, try `rustc --explain E0477`.
error: could not compile `Foo` (lib) due to 1 previous error
"#]])
.err(expect_test::expect!["crates/formality-rust/src/prove/prove_outlives.rs:8:1: no applicable rules for prove_outlives { a: !lt_0, b: ' static, assumptions: {}, env: Env { variables: [!lt_0], bias: Soundness, pending: [], allow_pending_outlives: false } }"]);
}
Source location: tests/sized_trait.rs:89 (all coverage from this test)
#[test]
fn generic_parameter_requires_explicit_sized_bound() {
// Generated Rust still gives T an implicit Sized bound until #500 lands.
// Formality must already require an explicit bound on this impl.
FormalityTest::new(crates![crate Foo {
trait Needs<T> where T: Sized {}
impl<T> Needs<T> for u32 {}
}])
.rustc_ok()
.err(expect_test::expect![[r#"
crates/formality-rust/src/prove/prove_sized.rs:12:1: no applicable rules for prove_sized { ty: !ty_0, assumptions: {}, env: Env { variables: [!ty_0], bias: Soundness, pending: [], allow_pending_outlives: false } }
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`"#]]);
}
Source location: tests/sized_trait.rs:115 (all coverage from this test)
#[test]
fn user_defined_sized_impl_is_rejected() {
FormalityTest::new(crates![crate Foo {
struct S {}
impl Sized for S {}
}])
.rustc_err(expect_test::expect![[r#"
error[E0322]: explicit impls for the `Sized` trait are not permitted
--> lib.rs
|
3 | impl Sized for S {}
| ^^^^^^^^^^^^^^^^ impl of `Sized` not allowed
For more information about this error, try `rustc --explain E0322`.
error: could not compile `Foo` (lib) due to 1 previous error
"#]])
.err(expect_test::expect![[r#"
the rule "Sized" at (impls.rs) failed because
explicit impls for the `Sized` trait are not permitted"#]]);
}
Source location: tests/sized_trait.rs:174 (all coverage from this test)
#[test]
fn tuple_requires_every_element_sized() {
// In rustc, `(T, bool)` isn't even well-formed if `T` is unsized.
FormalityTest::new(crates![crate Foo {
trait Needs<T> where T: Sized {}
impl<T> Needs<(T, bool)> for u32 {}
}])
.rustc_ok()
.err(expect_test::expect![[r#"
crates/formality-rust/src/prove/prove_sized.rs:12:1: no applicable rules for prove_sized { ty: !ty_0, assumptions: {}, env: Env { variables: [!ty_0], bias: Soundness, pending: [], allow_pending_outlives: false } }
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`"#]]);
}
Source location: tests/sized_trait.rs:208 (all coverage from this test)
#[test]
fn struct_with_generic_tail_requires_sized_tail() {
// `Tail<T>` is only sized if `T` is.
FormalityTest::new(crates![crate Foo {
struct Tail<T> { prefix: u32, tail: T }
trait Needs<T> where T: Sized {}
impl<T> Needs<Tail<T>> for u32 {}
}])
.rustc_ok()
.err(expect_test::expect![[r#"
crates/formality-rust/src/prove/prove_sized.rs:12:1: no applicable rules for prove_sized { ty: !ty_0, assumptions: {}, env: Env { variables: [!ty_0], bias: Soundness, pending: [], allow_pending_outlives: false } }
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`"#]]);
}
Source location: tests/sized_trait.rs:347 (all coverage from this test)
#[test]
fn struct_tail_is_checked_after_substitution() {
// `Pair<u32, X>` ends in `X`, which may be unsized.
FormalityTest::new(crates![crate Foo {
struct Pair<A, B> where A: Sized { first: A, last: B }
trait Needs<T> where T: Sized {}
impl<X> Needs<Pair<u32, X>> for u32 {}
}])
.rustc_ok()
.err(expect_test::expect![[r#"
crates/formality-rust/src/prove/prove_sized.rs:12:1: no applicable rules for prove_sized { ty: !ty_0, assumptions: {}, env: Env { variables: [!ty_0], bias: Soundness, pending: [], allow_pending_outlives: false } }
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`"#]]);
}
Source location: tests/sized_trait.rs:370 (all coverage from this test)
#[test]
fn struct_tail_is_followed_through_nested_structs() {
// `Outer<T>` ends in `Tail<T>`, which ends in `T`.
FormalityTest::new(crates![crate Foo {
struct Tail<T> { prefix: u32, tail: T }
struct Outer<T> { inner: Tail<T> }
trait Needs<T> where T: Sized {}
impl<T> Needs<Outer<T>> for u32 {}
}])
.rustc_ok()
.err(expect_test::expect![[r#"
crates/formality-rust/src/prove/prove_sized.rs:12:1: no applicable rules for prove_sized { ty: !ty_0, assumptions: {}, env: Env { variables: [!ty_0], bias: Soundness, pending: [], allow_pending_outlives: false } }
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`"#]]);
}
Source location: tests/sized_trait.rs:397 (all coverage from this test)
#[test]
fn alias_is_not_sized_if_normalized_type_may_be_unsized() {
// `<T as Assoc>::Out` normalizes to `T`, which may be unsized.
FormalityTest::new(crates![crate Foo {
struct W<T> { t: T }
trait Assoc { type Out: []; }
impl<T> Assoc for T { type Out = T; }
trait Needs<T> where T: Sized {}
impl<T> Needs<<T as Assoc>::Out> for W<T> {}
}])
.rustc_ok()
.err(expect_test::expect![[r#"
crates/formality-rust/src/prove/prove_sized.rs:12:1: no applicable rules for prove_sized { ty: !ty_0, assumptions: {}, env: Env { variables: [!ty_0], bias: Soundness, pending: [], allow_pending_outlives: false } }
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`"#]]);
}
Source location: tests/sized_trait.rs:436 (all coverage from this test)
#[test]
fn recursive_struct_is_not_sized() {
// `Sized` is inductive, so the cycle through `next` doesn't prove `List: Sized`.
// rustc rejects the struct itself (E0072), which formality doesn't check.
FormalityTest::new(crates![crate Foo {
struct List { next: List }
trait Needs<T> where T: Sized {}
impl Needs<List> for u32 {}
}])
.rustc_err(expect_test::expect![[r#"
error[E0072]: recursive type `List` has infinite size
--> lib.rs
|
1 | pub struct List {
| ^^^^^^^^^^^^^^^
2 | pub next: List,
| ---- recursive without indirection
|
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
|
2 | pub next: Box<List>,
| ++++ +
For more information about this error, try `rustc --explain E0072`.
error: could not compile `Foo` (lib) due to 1 previous error
"#]])
.err(expect_test::expect![[r#"
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`"#]]);
}