Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a feature_gate test for raw pointer self
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
29
src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|