Skip to content

Commit 5f33714

Browse files
committed
Arbitrary self types v2: better feature gate test
Slight improvement to the test for the arbitrary_self_types_pointers feature gate, to ensure it's independent of the arbitrary_self_types gate. Part of #44874
1 parent dd436ae commit 5f33714

3 files changed

+42
-3
lines changed

tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.stderr tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.default.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: `*const Bar` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature
2-
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:8:18
2+
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:11:18
33
|
44
LL | fn foo(self: *const Self) {}
55
| ^^^^^^^^^^^
@@ -10,7 +10,7 @@ LL | fn foo(self: *const Self) {}
1010
= help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
1111

1212
error[E0658]: `*mut Bar` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature
13-
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:12:18
13+
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:15:18
1414
|
1515
LL | fn bar(self: *mut Self) {}
1616
| ^^^^^^^^^
@@ -21,7 +21,7 @@ LL | fn bar(self: *mut Self) {}
2121
= help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
2222

2323
error[E0658]: `*const Self` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature
24-
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:2:18
24+
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:5:18
2525
|
2626
LL | fn foo(self: *const Self);
2727
| ^^^^^^^^^^^
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
error[E0658]: `*const Bar` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature
2+
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:11:18
3+
|
4+
LL | fn foo(self: *const Self) {}
5+
| ^^^^^^^^^^^
6+
|
7+
= note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information
8+
= help: add `#![feature(arbitrary_self_types_pointers)]` to the crate attributes to enable
9+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10+
= help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
11+
12+
error[E0658]: `*mut Bar` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature
13+
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:15:18
14+
|
15+
LL | fn bar(self: *mut Self) {}
16+
| ^^^^^^^^^
17+
|
18+
= note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information
19+
= help: add `#![feature(arbitrary_self_types_pointers)]` to the crate attributes to enable
20+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
21+
= help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
22+
23+
error[E0658]: `*const Self` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature
24+
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:5:18
25+
|
26+
LL | fn foo(self: *const Self);
27+
| ^^^^^^^^^^^
28+
|
29+
= note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information
30+
= help: add `#![feature(arbitrary_self_types_pointers)]` to the crate attributes to enable
31+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
32+
= help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
33+
34+
error: aborting due to 3 previous errors
35+
36+
For more information about this error, try `rustc --explain E0658`.

tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//@ revisions: default feature
2+
#![cfg_attr(feature, feature(arbitrary_self_types))]
3+
14
trait Foo {
25
fn foo(self: *const Self); //~ ERROR `*const Self` cannot be used as the type of `self`
36
}

0 commit comments

Comments
 (0)