about summary refs log tree commit diff
path: root/tests/ui/traits/next-solver/dyn-incompatibility.rs
blob: a347984daf6a6e7adb515a658ef6659cf3569ec9 (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
//@ compile-flags: -Znext-solver

trait Setup {
    type From: Copy;
}

fn copy<U: Setup + ?Sized>(from: &U::From) -> U::From {
    *from
}

pub fn copy_any<T>(t: &T) -> T {
    copy::<dyn Setup<From=T>>(t)
    //~^ ERROR the trait bound `T: Copy` is not satisfied in `dyn Setup<From = T>`
    //~| ERROR mismatched types
    //~| ERROR the trait bound `T: Copy` is not satisfied

    // FIXME(-Znext-solver): These error messages are horrible and some of them
    // are even simple fallout from previous error.
}

fn main() {
    let x = String::from("Hello, world");
    let y = copy_any(&x);
    println!("{y}");
}