summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/trivial_impl_sized.rs
blob: 501a3405090e6cd50cee2b94ee77c1f8a3fa965b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//! 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() {}