Skip to content

Commit 3da7341

Browse files
committed
Arbitrary self types v2: stabilize test changes
All the test changes necessary for stabilization here.
1 parent f16fc5b commit 3da7341

File tree

66 files changed

+362
-300
lines changed

Some content is hidden

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

66 files changed

+362
-300
lines changed

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/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.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-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/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 further restricting this bound
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;

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: unused implementer of `Iterator` that must be used
2-
--> $DIR/must_use-in-stdlib-traits.rs:42:4
2+
--> $DIR/must_use-in-stdlib-traits.rs:41:4
33
|
44
LL | iterator();
55
| ^^^^^^^^^^
@@ -12,31 +12,31 @@ LL | #![deny(unused_must_use)]
1212
| ^^^^^^^^^^^^^^^
1313

1414
error: unused implementer of `Future` that must be used
15-
--> $DIR/must_use-in-stdlib-traits.rs:43:4
15+
--> $DIR/must_use-in-stdlib-traits.rs:42:4
1616
|
1717
LL | future();
1818
| ^^^^^^^^
1919
|
2020
= note: futures do nothing unless you `.await` or poll them
2121

2222
error: unused implementer of `FnOnce` that must be used
23-
--> $DIR/must_use-in-stdlib-traits.rs:44:4
23+
--> $DIR/must_use-in-stdlib-traits.rs:43:4
2424
|
2525
LL | square_fn_once();
2626
| ^^^^^^^^^^^^^^^^
2727
|
2828
= note: closures are lazy and do nothing unless called
2929

3030
error: unused implementer of `FnMut` that must be used
31-
--> $DIR/must_use-in-stdlib-traits.rs:45:4
31+
--> $DIR/must_use-in-stdlib-traits.rs:44:4
3232
|
3333
LL | square_fn_mut();
3434
| ^^^^^^^^^^^^^^^
3535
|
3636
= note: closures are lazy and do nothing unless called
3737

3838
error: unused implementer of `Fn` that must be used
39-
--> $DIR/must_use-in-stdlib-traits.rs:46:4
39+
--> $DIR/must_use-in-stdlib-traits.rs:45:4
4040
|
4141
LL | square_fn();
4242
| ^^^^^^^^^^^

tests/ui/methods/call_method_unknown_referent.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ edition: 2018
22

3-
#![feature(arbitrary_self_types)]
4-
53
// tests that the referent type of a reference must be known to call methods on it
64

75
struct SmartPtr<T>(T);

tests/ui/methods/call_method_unknown_referent.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error[E0282]: type annotations needed
2-
--> $DIR/call_method_unknown_referent.rs:20:31
2+
--> $DIR/call_method_unknown_referent.rs:18:31
33
|
44
LL | let _a: i32 = (ptr as &_).read();
55
| ^^^^ cannot infer type
66

77
error[E0282]: type annotations needed
8-
--> $DIR/call_method_unknown_referent.rs:26:37
8+
--> $DIR/call_method_unknown_referent.rs:24:37
99
|
1010
LL | let _b = (rc as std::rc::Rc<_>).read();
1111
| ^^^^ cannot infer type
1212

1313
error[E0599]: no method named `read` found for struct `SmartPtr` in the current scope
14-
--> $DIR/call_method_unknown_referent.rs:46:35
14+
--> $DIR/call_method_unknown_referent.rs:44:35
1515
|
1616
LL | struct SmartPtr<T>(T);
1717
| ------------------ method `read` not found for this struct

tests/ui/methods/call_method_unknown_referent2.rs

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

4-
#![feature(arbitrary_self_types)]
5-
64
// tests that the referent type of a reference must be known to call methods on it
75

86
struct SmartPtr<T>(T);

tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(arbitrary_self_types, coerce_unsized, dispatch_from_dyn, unsize)]
1+
#![feature(coerce_unsized, dispatch_from_dyn, unsize)]
22
#![feature(unsized_locals, unsized_fn_params)]
33
//~^ WARN the feature `unsized_locals` is incomplete
44

tests/ui/privacy/privacy1.rs

-5
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,10 @@ pub trait Deref {
1212
type Target;
1313
}
1414

15-
#[lang="legacy_receiver"]
16-
pub trait LegacyReceiver: Deref {}
17-
1815
impl<'a, T> Deref for &'a T {
1916
type Target = T;
2017
}
2118

22-
impl<'a, T> LegacyReceiver for &'a T {}
23-
2419
mod bar {
2520
// shouldn't bring in too much
2621
pub use self::glob::*;

0 commit comments

Comments
 (0)