]> git.lizzy.rs Git - rust.git/blob - src/test/ui/feature-gates/feature-gate-arbitrary-self-types.rs
parser will not give wrong help message for 'public'
[rust.git] / src / test / ui / feature-gates / feature-gate-arbitrary-self-types.rs
1 use std::{
2     ops::Deref,
3 };
4
5 struct Ptr<T: ?Sized>(Box<T>);
6
7 impl<T: ?Sized> Deref for Ptr<T> {
8     type Target = T;
9
10     fn deref(&self) -> &T {
11         &*self.0
12     }
13 }
14
15 trait Foo {
16     fn foo(self: Ptr<Self>); //~ ERROR `Ptr<Self>` cannot be used as the type of `self` without
17 }
18
19 struct Bar;
20
21 impl Foo for Bar {
22     fn foo(self: Ptr<Self>) {} //~ ERROR `Ptr<Bar>` cannot be used as the type of `self` without
23 }
24
25 impl Bar {
26     fn bar(self: Box<Ptr<Self>>) {} //~ ERROR `Box<Ptr<Bar>>` cannot be used as the
27 }
28
29 fn main() {}