From cb9f552b7c1b2e7a13d4d8419e39ed186a26c80d Mon Sep 17 00:00:00 2001 From: Michael Hewson Date: Mon, 11 Dec 2017 18:14:47 +0100 Subject: [PATCH] Add a feature_gate test for raw pointer self --- ...e-gate-arbitrary_self_types-raw-pointer.rs | 28 ++++++++++++++++++ ...te-arbitrary_self_types-raw-pointer.stderr | 29 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.rs create mode 100644 src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.stderr 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 or the MIT license +// , 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` + +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` + +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` + +error: aborting due to 3 previous errors +