Negative coverage: check_neg_trait_impl / check_neg_trait_impl / premise fail "negative impls cannot be unsafe"
Premise at line 55. Observed failure causes: explicit_failure.
check_neg_trait_impl| Line | Coverage | Source |
|---|---|---|
| 55 | 2 | (fail "negative impls cannot be unsafe") |
| ──────── ("check_neg_trait_impl") | ||
| 57 | 3 | (check_neg_trait_impl(program, NegTraitImpl { binder: _, safety: Safety::Unsafe }) => ()) |
2 tests failed proving this premise:
Source location: tests/decl_safety.rs:59 (all coverage from this test)
#[test]
fn unsafe_trait_negative_impl_mismatch() {
FormalityTest::new(crates![crate baguette {
#![feature(negative_impls)]
unsafe trait Foo {}
unsafe impl !Foo for u32 {}
}])
.rustc_err(expect_test::expect![[r#"
error[E0198]: negative impls cannot be unsafe
--> lib.rs
|
5 | unsafe impl !Foo for u32 {}
| ------ -^^^
| | |
| | negative because of this
| unsafe because of this
For more information about this error, try `rustc --explain E0198`.
error: could not compile `baguette` (lib) due to 1 previous error
"#]])
.err(expect_test::expect![[r#"
the rule "check_neg_trait_impl" at (impls.rs) failed because
negative impls cannot be unsafe"#]])
}
Failed proof tree
check_all_crates failedmod.rs:41args
rule "check all prefixes"mod.rs:53check_crate failedmod.rs:60args
rule "check crate"mod.rs:73check_crate_item failedmod.rs:178rule "neg trait impl"mod.rs:212check_neg_trait_impl failedimpls.rs:47rule "check_neg_trait_impl"impls.rs:55 (failed: explicit_failure)
Source location: tests/decl_safety.rs:84 (all coverage from this test)
#[test]
fn safe_trait_negative_impl_mismatch() {
FormalityTest::new(crates![crate baguette {
#![feature(negative_impls)]
trait Foo {}
unsafe impl !Foo for u32 {}
}])
.rustc_err(expect_test::expect![[r#"
error[E0198]: negative impls cannot be unsafe
--> lib.rs
|
5 | unsafe impl !Foo for u32 {}
| ------ -^^^
| | |
| | negative because of this
| unsafe because of this
For more information about this error, try `rustc --explain E0198`.
error: could not compile `baguette` (lib) due to 1 previous error
"#]])
.err(expect_test::expect![[r#"
the rule "check_neg_trait_impl" at (impls.rs) failed because
negative impls cannot be unsafe"#]])
}
Failed proof tree
check_all_crates failedmod.rs:41args
rule "check all prefixes"mod.rs:53check_crate failedmod.rs:60args
rule "check crate"mod.rs:73check_crate_item failedmod.rs:178rule "neg trait impl"mod.rs:212check_neg_trait_impl failedimpls.rs:47rule "check_neg_trait_impl"impls.rs:55 (failed: explicit_failure)