rust/tests/ui/traits/trivial_impl_sized.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
515 B
Rust
Raw Normal View History

//! This test checks that we currently need to implement
//! members, even if their where bounds don't hold for the impl type.
trait Foo {
fn foo()
where
Self: Sized;
}
impl Foo for () {
fn foo() {}
}
// Must not be allowed
impl Foo for i32 {}
//~^ ERROR: not all trait items implemented, missing: `foo`
// Should be allowed
impl Foo for dyn std::fmt::Debug {}
//~^ ERROR: not all trait items implemented, missing: `foo`
impl Foo for dyn std::fmt::Display {
fn foo() {}
}
fn main() {}