Add a feature_gate test for raw pointer self
This commit is contained in:
parent
bff74fbfe2
commit
cb9f552b7c
28
src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.rs
Normal file
28
src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.rs
Normal file
@ -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() {}
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user