about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Hewson <michael@michaelhewson.ca>2017-12-11 18:14:47 +0100
committerMichael Hewson <michael@michaelhewson.ca>2017-12-17 10:13:09 +0100
commitcb9f552b7c1b2e7a13d4d8419e39ed186a26c80d (patch)
tree6cb44304990a13eed3ca2ad8e4f0dd146601e087
parentbff74fbfe2eccc3a1cf2f0e0823cca342e3b9cd1 (diff)
downloadrust-cb9f552b7c1b2e7a13d4d8419e39ed186a26c80d.tar.gz
rust-cb9f552b7c1b2e7a13d4d8419e39ed186a26c80d.zip
Add a feature_gate test for raw pointer self
-rw-r--r--src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.rs28
-rw-r--r--src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.stderr29
2 files changed, 57 insertions, 0 deletions
diff --git a/src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.rs b/src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.rs
new file mode 100644
index 00000000000..29e51727edc
--- /dev/null
+++ b/src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.rs
@@ -0,0 +1,28 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo;
+
+impl Foo {
+    fn foo(self: *const Self) {}
+    //~^ ERROR raw pointer `self` is unstable
+}
+
+trait Bar {
+    fn bar(self: *const Self);
+    //~^ ERROR raw pointer `self` is unstable
+}
+
+impl Bar for () {
+    fn bar(self: *const Self) {}
+    //~^ ERROR raw pointer `self` is unstable
+}
+
+fn main() {}
diff --git a/src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.stderr b/src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.stderr
new file mode 100644
index 00000000000..d629ac4c60f
--- /dev/null
+++ b/src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.stderr
@@ -0,0 +1,29 @@
+error: raw pointer `self` is unstable (see issue #44874)
+  --> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:19:18
+   |
+19 |     fn bar(self: *const Self);
+   |                  ^^^^^^^^^^^
+   |
+   = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable
+   = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`
+
+error: raw pointer `self` is unstable (see issue #44874)
+  --> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:14:18
+   |
+14 |     fn foo(self: *const Self) {}
+   |                  ^^^^^^^^^^^
+   |
+   = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable
+   = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`
+
+error: raw pointer `self` is unstable (see issue #44874)
+  --> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:24:18
+   |
+24 |     fn bar(self: *const Self) {}
+   |                  ^^^^^^^^^^^
+   |
+   = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable
+   = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`
+
+error: aborting due to 3 previous errors
+