Skip to content

Commit cb9f552

Browse files
committed
Add a feature_gate test for raw pointer self
1 parent bff74fb commit cb9f552

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
struct Foo;
12+
13+
impl Foo {
14+
fn foo(self: *const Self) {}
15+
//~^ ERROR raw pointer `self` is unstable
16+
}
17+
18+
trait Bar {
19+
fn bar(self: *const Self);
20+
//~^ ERROR raw pointer `self` is unstable
21+
}
22+
23+
impl Bar for () {
24+
fn bar(self: *const Self) {}
25+
//~^ ERROR raw pointer `self` is unstable
26+
}
27+
28+
fn main() {}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
error: raw pointer `self` is unstable (see issue #44874)
2+
--> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:19:18
3+
|
4+
19 | fn bar(self: *const Self);
5+
| ^^^^^^^^^^^
6+
|
7+
= help: add #![feature(arbitrary_self_types)] to the crate attributes to enable
8+
= help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`
9+
10+
error: raw pointer `self` is unstable (see issue #44874)
11+
--> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:14:18
12+
|
13+
14 | fn foo(self: *const Self) {}
14+
| ^^^^^^^^^^^
15+
|
16+
= help: add #![feature(arbitrary_self_types)] to the crate attributes to enable
17+
= help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`
18+
19+
error: raw pointer `self` is unstable (see issue #44874)
20+
--> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:24:18
21+
|
22+
24 | fn bar(self: *const Self) {}
23+
| ^^^^^^^^^^^
24+
|
25+
= help: add #![feature(arbitrary_self_types)] to the crate attributes to enable
26+
= help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`
27+
28+
error: aborting due to 3 previous errors
29+

0 commit comments

Comments
 (0)