Skip to content

Commit

Permalink
Add a feature_gate test for raw pointer self
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeyhew committed Dec 17, 2017
1 parent bff74fb commit cb9f552
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
28 changes: 28 additions & 0 deletions 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() {}
29 changes: 29 additions & 0 deletions 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

0 comments on commit cb9f552

Please sign in to comment.