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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
772 B
Rust
Raw Normal View History

#![feature(associated_type_defaults)]
2017-01-08 11:06:44 +00:00
struct S<T = u8>(T);
trait Tr<T = u8> {
type A = ();
}
2017-01-08 11:06:44 +00: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 11:06:44 +00:00
2022-10-27 21:18:26 +00: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 21:21:00 +00:00
impl Tr<Self::A> for S {} //~ ERROR cycle detected
2017-01-08 11:06:44 +00:00
fn main() {}