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: check_trait_manually_implementable / Sized / premise fail "explicit impls for the Sized trait are not permitted"

Premise at line 85. Observed failure causes: explicit_failure.

Sized
LineCoverageSource
84✗(if trait_id.is_sized())
852(fail "explicit impls for the `Sized` trait are not permitted")
──────── ("Sized")
87✗(check_trait_manually_implementable(trait_id) => ())

2 tests failed proving this premise:


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"#]]);
}
Failed proof tree

Source location: tests/sized_trait.rs:137 (all coverage from this test)

#[test]
fn user_defined_negative_sized_impl_is_rejected() {
    FormalityTest::new(crates![crate Foo {
        #![feature(negative_impls)]
        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
          |
        5 | 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"#]]);
}
Failed proof tree

How to read this page