rust/tests/ui/resolve/resolve-self-in-impl.rs

22 lines
772 B
Rust
Raw Normal View History

#![feature(associated_type_defaults)]
2017-01-08 05:06:44 -06:00
struct S<T = u8>(T);
trait Tr<T = u8> {
type A = ();
}
2017-01-08 05:06:44 -06:00
impl Tr<Self> for S {} // OK
impl<T: Tr<Self>> Tr<T> for S {} // OK
impl Tr for S where Self: Copy {} // OK
impl Tr for S where S<Self>: Copy {} // OK
impl Tr for S where Self::A: Copy {} // OK
2017-01-08 05:06:44 -06:00
2022-10-27 16:18:26 -05:00
impl Tr for Self {} //~ ERROR `Self` is not valid in the self type of an impl block
impl Tr for S<Self> {} //~ ERROR `Self` is not valid in the self type of an impl block
impl Self {} //~ ERROR `Self` is not valid in the self type of an impl block
impl S<Self> {} //~ ERROR `Self` is not valid in the self type of an impl block
impl (Self, Self) {} //~ ERROR `Self` is not valid in the self type of an impl block
2018-04-15 16:21:00 -05:00
impl Tr<Self::A> for S {} //~ ERROR cycle detected
2017-01-08 05:06:44 -06:00
fn main() {}