Skip to content

Commit 78dbe11

Browse files
committed
Arbitrary self types v2: stabilize test changes
All the test changes necessary for stabilization here.
1 parent c93c894 commit 78dbe11

File tree

93 files changed

+397
-401
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+397
-401
lines changed

compiler/rustc_codegen_cranelift/example/arbitrary_self_types_pointers_and_wrappers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Adapted from rustc run-pass test suite
22

3-
#![feature(arbitrary_self_types, unsize, coerce_unsized, dispatch_from_dyn)]
3+
#![feature(unsize, coerce_unsized, dispatch_from_dyn)]
44

55
use std::marker::Unsize;
66
use std::ops::{CoerceUnsized, Deref, DispatchFromDyn};

compiler/rustc_codegen_cranelift/example/mini_core.rs

-7
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,6 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<*const U> for *const T {}
4747
impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<*mut U> for *mut T {}
4848
impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U>> for Box<T> {}
4949

50-
#[lang = "legacy_receiver"]
51-
pub trait LegacyReceiver {}
52-
53-
impl<T: ?Sized> LegacyReceiver for &T {}
54-
impl<T: ?Sized> LegacyReceiver for &mut T {}
55-
impl<T: ?Sized> LegacyReceiver for Box<T> {}
56-
5750
#[lang = "copy"]
5851
pub trait Copy {}
5952

compiler/rustc_codegen_gcc/example/arbitrary_self_types_pointers_and_wrappers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Adapted from rustc run-pass test suite
22

3-
#![feature(arbitrary_self_types, unsize, coerce_unsized, dispatch_from_dyn)]
3+
#![feature(unsize, coerce_unsized, dispatch_from_dyn)]
44
#![feature(rustc_attrs)]
55
#![allow(internal_features)]
66

compiler/rustc_codegen_gcc/example/mini_core.rs

-7
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@ impl<T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<*const U> for *const T {}
4444
impl<T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<*mut U> for *mut T {}
4545
impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U, ()>> for Box<T, ()> {}
4646

47-
#[lang = "legacy_receiver"]
48-
pub trait LegacyReceiver {}
49-
50-
impl<T: ?Sized> LegacyReceiver for &T {}
51-
impl<T: ?Sized> LegacyReceiver for &mut T {}
52-
impl<T: ?Sized, A: Allocator> LegacyReceiver for Box<T, A> {}
53-
5447
#[lang = "copy"]
5548
pub trait Copy {}
5649

compiler/rustc_lint_defs/src/builtin.rs

-2
Original file line numberDiff line numberDiff line change
@@ -4894,8 +4894,6 @@ declare_lint! {
48944894
/// UB in safe code afterwards. For example:
48954895
///
48964896
/// ```ignore (causes a warning)
4897-
/// #![feature(arbitrary_self_types)]
4898-
///
48994897
/// trait Trait {
49004898
/// fn f(self: *const Self)
49014899
/// where

library/core/src/ops/deref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ unsafe impl<T: ?Sized> DerefPure for &mut T {}
300300

301301
/// Indicates that a struct can be used as a method receiver.
302302
/// That is, a type can use this type as a type of `self`, like this:
303-
/// ```compile_fail
303+
/// ```
304304
/// # // This is currently compile_fail because the compiler-side parts
305305
/// # // of arbitrary_self_types are not implemented
306306
/// use std::ops::Receiver;

src/doc/unstable-book/src/language-features/coroutines.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Feedback on the design and usage is always appreciated!
8989
The `Coroutine` trait in `std::ops` currently looks like:
9090

9191
```rust
92-
# #![feature(arbitrary_self_types, coroutine_trait)]
92+
# #![feature(coroutine_trait)]
9393
# use std::ops::CoroutineState;
9494
# use std::pin::Pin;
9595

@@ -184,7 +184,7 @@ fn main() {
184184
This coroutine literal will compile down to something similar to:
185185

186186
```rust
187-
#![feature(arbitrary_self_types, coroutine_trait)]
187+
#![feature(coroutine_trait)]
188188

189189
use std::ops::{Coroutine, CoroutineState};
190190
use std::pin::Pin;

tests/auxiliary/minicore.rs

-5
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ macro_rules! impl_marker_trait {
3131
#[lang = "sized"]
3232
pub trait Sized {}
3333

34-
#[lang = "legacy_receiver"]
35-
pub trait LegacyReceiver {}
36-
impl<T: ?Sized> LegacyReceiver for &T {}
37-
impl<T: ?Sized> LegacyReceiver for &mut T {}
38-
3934
#[lang = "copy"]
4035
pub trait Copy: Sized {}
4136

tests/codegen/avr/avr-func-addrspace.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// It also validates that functions can be called through function pointers
1010
// through traits.
1111

12-
#![feature(no_core, lang_items, intrinsics, unboxed_closures, arbitrary_self_types)]
12+
#![feature(no_core, lang_items, intrinsics, unboxed_closures)]
1313
#![crate_type = "lib"]
1414
#![no_core]
1515

@@ -18,8 +18,6 @@ pub trait Sized {}
1818
#[lang = "copy"]
1919
pub trait Copy {}
2020
impl<T: ?Sized> Copy for *const T {}
21-
#[lang = "legacy_receiver"]
22-
pub trait LegacyReceiver {}
2321
#[lang = "tuple_trait"]
2422
pub trait Tuple {}
2523

tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@
88
//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0
99

1010
#![crate_type = "lib"]
11-
#![feature(arbitrary_self_types, no_core, lang_items)]
11+
#![feature(no_core, lang_items)]
1212
#![no_core]
1313

1414
#[lang = "sized"]
1515
trait Sized {}
1616
#[lang = "copy"]
1717
trait Copy {}
1818
impl<T: ?Sized> Copy for &T {}
19-
#[lang = "legacy_receiver"]
20-
trait LegacyReceiver {}
2119
#[lang = "dispatch_from_dyn"]
2220
trait DispatchFromDyn<T> {}
2321
impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {}

tests/rustdoc-json/impls/auto.rs

-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
#[lang = "sized"]
55
trait Sized {}
66

7-
#[lang = "legacy_receiver"]
8-
pub trait LegacyReceiver {}
9-
107
pub auto trait Bar {}
118

129
/// has span

tests/ui/async-await/inference_var_self_argument.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `&dyn Foo`
44
LL | async fn foo(self: &dyn Foo) {
55
| ^^^^^^^^
66
|
7-
= note: type of `self` must be `Self` or a type that dereferences to it
8-
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
7+
= note: type of `self` must be `Self` or some type implementing `Receiver`
8+
= 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>`
99

1010
error[E0038]: the trait `Foo` cannot be made into an object
1111
--> $DIR/inference_var_self_argument.rs:5:5

tests/ui/async-await/issue-66312.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `T`
44
LL | fn is_some(self: T);
55
| ^
66
|
7-
= note: type of `self` must be `Self` or a type that dereferences to it
8-
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
7+
= note: type of `self` must be `Self` or some type implementing `Receiver`
8+
= 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>`
99

1010
error[E0308]: mismatched types
1111
--> $DIR/issue-66312.rs:9:8

tests/ui/async-await/issues/issue-53249.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//@ check-pass
22
//@ edition:2018
33

4-
#![feature(arbitrary_self_types)]
5-
64
use std::task::{self, Poll};
75
use std::future::Future;
86
use std::marker::Unpin;

tests/ui/deriving/deriving-coerce-pointee-neg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(derive_coerce_pointee, arbitrary_self_types)]
1+
#![feature(derive_coerce_pointee)]
22

33
extern crate core;
44
use std::marker::CoercePointee;

tests/ui/deriving/deriving-coerce-pointee.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ run-pass
2-
#![feature(derive_coerce_pointee, arbitrary_self_types)]
2+
#![feature(derive_coerce_pointee)]
33

44
use std::marker::CoercePointee;
55

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

-36
This file was deleted.

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

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

tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.default.stderr tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.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:11:18
2+
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:8: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:15:18
13+
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:12: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:5:18
24+
--> $DIR/feature-gate-arbitrary-self-types-pointers.rs:2:18
2525
|
2626
LL | fn foo(self: *const Self);
2727
| ^^^^^^^^^^^

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

-29
This file was deleted.

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

-36
This file was deleted.

tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `Cell<&Self>`
44
LL | fn cell(self: Cell<&Self>);
55
| ^^^^^^^^^^^
66
|
7-
= note: type of `self` must be `Self` or a type that dereferences to it
8-
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
7+
= note: type of `self` must be `Self` or some type implementing `Receiver`
8+
= 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>`
99

1010
error: aborting due to 1 previous error
1111

tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Check that a self parameter type requires a DispatchFromDyn impl to be dyn-compatible.
22

3-
#![feature(arbitrary_self_types, unsize, coerce_unsized)]
3+
#![feature(unsize, coerce_unsized)]
44

55
use std::{
66
marker::Unsize,

tests/ui/issues/issue-56806.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `Box<(dyn Trait + 'static)>`
44
LL | fn dyn_instead_of_self(self: Box<dyn Trait>);
55
| ^^^^^^^^^^^^^^
66
|
7-
= note: type of `self` must be `Self` or a type that dereferences to it
8-
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
7+
= note: type of `self` must be `Self` or some type implementing `Receiver`
8+
= 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>`
99

1010
error: aborting due to 1 previous error
1111

tests/ui/lifetimes/could-not-resolve-issue-121503.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
struct Struct;
55
impl Struct {
66
async fn box_ref_Struct(self: Box<Self, impl FnMut(&mut Self)>) -> &u32 {
7-
//~^ ERROR Box<Struct, impl FnMut(&mut Self)>` cannot be used as the type of `self` without
7+
//~^ ERROR the trait bound
88
&1
99
}
1010
}
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
error[E0658]: `Box<Struct, impl FnMut(&mut Self)>` cannot be used as the type of `self` without the `arbitrary_self_types` feature
1+
error[E0277]: the trait bound `impl FnMut(&mut Self): Allocator` is not satisfied
22
--> $DIR/could-not-resolve-issue-121503.rs:6:35
33
|
44
LL | async fn box_ref_Struct(self: Box<Self, impl FnMut(&mut Self)>) -> &u32 {
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Allocator` is not implemented for `impl FnMut(&mut Self)`
66
|
7-
= note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information
8-
= help: add `#![feature(arbitrary_self_types)]` 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>`
7+
note: required by a bound in `Box`
8+
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
9+
help: consider restricting opaque type `impl FnMut(&mut Self)` with unstable trait `Allocator`
10+
|
11+
LL | async fn box_ref_Struct(self: Box<Self, impl FnMut(&mut Self) + std::alloc::Allocator>) -> &u32 {
12+
| +++++++++++++++++++++++
1113

1214
error: aborting due to 1 previous error
1315

14-
For more information about this error, try `rustc --explain E0658`.
16+
For more information about this error, try `rustc --explain E0277`.

tests/ui/lint/unused/must_use-in-stdlib-traits.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![deny(unused_must_use)]
2-
#![feature(arbitrary_self_types)]
32

43
use std::iter::Iterator;
54
use std::future::Future;

0 commit comments

Comments
 (0)