mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 11:44:28 +00:00
27 lines
527 B
Rust
27 lines
527 B
Rust
// check-fail
|
|
|
|
trait Trait { type Assoc; }
|
|
impl<'a> Trait for &'a () { type Assoc = &'a (); }
|
|
|
|
struct MyTuple<T>(T);
|
|
impl MyTuple<<&'static () as Trait>::Assoc> {
|
|
fn test(x: &(), y: &()) {
|
|
Self(x);
|
|
//~^ ERROR
|
|
let _: Self = MyTuple(y);
|
|
//~^ ERROR
|
|
}
|
|
}
|
|
|
|
struct MyStruct<T> { val: T, }
|
|
impl MyStruct<<&'static () as Trait>::Assoc> {
|
|
fn test(x: &(), y: &()) {
|
|
Self { val: x };
|
|
//~^ ERROR
|
|
let _: Self = MyStruct { val: y };
|
|
//~^ ERROR
|
|
}
|
|
}
|
|
|
|
fn main() {}
|