2023-04-21 22:11:25 -05:00
|
|
|
// compile-flags: -Ztrait-solver=next
|
|
|
|
|
|
|
|
// Makes sure that alias bounds are not unsound!
|
|
|
|
|
|
|
|
#![feature(trivial_bounds)]
|
|
|
|
|
|
|
|
trait Foo {
|
|
|
|
type Item: Copy
|
|
|
|
where
|
|
|
|
<Self as Foo>::Item: Copy;
|
|
|
|
|
|
|
|
fn copy_me(x: &Self::Item) -> Self::Item {
|
|
|
|
*x
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Foo for () {
|
|
|
|
type Item = String where String: Copy;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x = String::from("hello, world");
|
|
|
|
drop(<() as Foo>::copy_me(&x));
|
2023-06-27 16:13:50 -05:00
|
|
|
//~^ ERROR the type `&<() as Foo>::Item` is not well-formed
|
2023-06-23 11:26:22 -05:00
|
|
|
//~| ERROR `<() as Foo>::Item` is not well-formed
|
2023-04-21 22:11:25 -05:00
|
|
|
println!("{x}");
|
|
|
|
}
|