summaryrefslogtreecommitdiffstats
path: root/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/feature-gates/feature-gate-arbitrary-self-types.rs')
-rw-r--r--src/test/ui/feature-gates/feature-gate-arbitrary-self-types.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.rs b/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.rs
new file mode 100644
index 000000000..47ca7e349
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.rs
@@ -0,0 +1,29 @@
+use std::{
+ ops::Deref,
+};
+
+struct Ptr<T: ?Sized>(Box<T>);
+
+impl<T: ?Sized> Deref for Ptr<T> {
+ type Target = T;
+
+ fn deref(&self) -> &T {
+ &*self.0
+ }
+}
+
+trait Foo {
+ fn foo(self: Ptr<Self>); //~ ERROR `Ptr<Self>` cannot be used as the type of `self` without
+}
+
+struct Bar;
+
+impl Foo for Bar {
+ fn foo(self: Ptr<Self>) {} //~ ERROR `Ptr<Bar>` cannot be used as the type of `self` without
+}
+
+impl Bar {
+ fn bar(self: Box<Ptr<Self>>) {} //~ ERROR `Box<Ptr<Bar>>` cannot be used as the
+}
+
+fn main() {}