summaryrefslogtreecommitdiffstats
path: root/src/test/ui/traits/coercion-generic-bad.rs
blob: 2e115c732b9d76d282e30dc0357532f7a39ec609 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
struct Struct {
    person: &'static str
}

trait Trait<T> {
    fn f(&self, x: T);
}

impl Trait<&'static str> for Struct {
    fn f(&self, x: &'static str) {
        println!("Hello, {}!", x);
    }
}

fn main() {
    let s: Box<dyn Trait<isize>> = Box::new(Struct { person: "Fred" });
    //~^ ERROR `Struct: Trait<isize>` is not satisfied
    s.f(1);
}