Skip to content

Commit

Permalink
Arbitrary self types v2: stabilize test changes
Browse files Browse the repository at this point in the history
All the test changes necessary for stabilization here.
  • Loading branch information
adetaylor committed Nov 22, 2024
1 parent c0bf133 commit 0325163
Show file tree
Hide file tree
Showing 66 changed files with 361 additions and 299 deletions.
5 changes: 0 additions & 5 deletions tests/auxiliary/minicore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ macro_rules! impl_marker_trait {
#[lang = "sized"]
pub trait Sized {}

#[lang = "legacy_receiver"]
pub trait LegacyReceiver {}
impl<T: ?Sized> LegacyReceiver for &T {}
impl<T: ?Sized> LegacyReceiver for &mut T {}

#[lang = "copy"]
pub trait Copy: Sized {}

Expand Down
4 changes: 1 addition & 3 deletions tests/codegen/avr/avr-func-addrspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// It also validates that functions can be called through function pointers
// through traits.

#![feature(no_core, lang_items, intrinsics, unboxed_closures, arbitrary_self_types)]
#![feature(no_core, lang_items, intrinsics, unboxed_closures)]
#![crate_type = "lib"]
#![no_core]

Expand All @@ -18,8 +18,6 @@ pub trait Sized {}
#[lang = "copy"]
pub trait Copy {}
impl<T: ?Sized> Copy for *const T {}
#[lang = "legacy_receiver"]
pub trait LegacyReceiver {}
#[lang = "tuple_trait"]
pub trait Tuple {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@
//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0

#![crate_type = "lib"]
#![feature(arbitrary_self_types, no_core, lang_items)]
#![feature(no_core, lang_items)]
#![no_core]

#[lang = "sized"]
trait Sized {}
#[lang = "copy"]
trait Copy {}
impl<T: ?Sized> Copy for &T {}
#[lang = "legacy_receiver"]
trait LegacyReceiver {}
#[lang = "dispatch_from_dyn"]
trait DispatchFromDyn<T> {}
impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {}
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/async-await/issues/issue-53249.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//@ check-pass
//@ edition:2018

#![feature(arbitrary_self_types)]

use std::task::{self, Poll};
use std::future::Future;
use std::marker::Unpin;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/deriving/deriving-coerce-pointee-neg.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(derive_coerce_pointee, arbitrary_self_types)]
#![feature(derive_coerce_pointee)]

extern crate core;
use std::marker::CoercePointee;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/deriving/deriving-coerce-pointee.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ run-pass
#![feature(derive_coerce_pointee, arbitrary_self_types)]
#![feature(derive_coerce_pointee)]

use std::marker::CoercePointee;

Expand Down
29 changes: 0 additions & 29 deletions tests/ui/feature-gates/feature-gate-arbitrary-self-types.rs

This file was deleted.

36 changes: 0 additions & 36 deletions tests/ui/feature-gates/feature-gate-arbitrary-self-types.stderr

This file was deleted.

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

#![feature(arbitrary_self_types, unsize, coerce_unsized)]
#![feature(unsize, coerce_unsized)]

use std::{
marker::Unsize,
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/lifetimes/could-not-resolve-issue-121503.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
struct Struct;
impl Struct {
async fn box_ref_Struct(self: Box<Self, impl FnMut(&mut Self)>) -> &u32 {
//~^ ERROR Box<Struct, impl FnMut(&mut Self)>` cannot be used as the type of `self` without
//~^ ERROR the trait bound
&1
}
}
Expand Down
16 changes: 9 additions & 7 deletions tests/ui/lifetimes/could-not-resolve-issue-121503.stderr
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
error[E0658]: `Box<Struct, impl FnMut(&mut Self)>` cannot be used as the type of `self` without the `arbitrary_self_types` feature
error[E0277]: the trait bound `impl FnMut(&mut Self): Allocator` is not satisfied
--> $DIR/could-not-resolve-issue-121503.rs:6:35
|
LL | async fn box_ref_Struct(self: Box<Self, impl FnMut(&mut Self)>) -> &u32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Allocator` is not implemented for `impl FnMut(&mut Self)`
|
= note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information
= help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= 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>`
note: required by a bound in `Box`
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
help: consider further restricting this bound
|
LL | async fn box_ref_Struct(self: Box<Self, impl FnMut(&mut Self) + std::alloc::Allocator>) -> &u32 {
| +++++++++++++++++++++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0658`.
For more information about this error, try `rustc --explain E0277`.
1 change: 0 additions & 1 deletion tests/ui/lint/unused/must_use-in-stdlib-traits.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![deny(unused_must_use)]
#![feature(arbitrary_self_types)]

use std::iter::Iterator;
use std::future::Future;
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/lint/unused/must_use-in-stdlib-traits.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: unused implementer of `Iterator` that must be used
--> $DIR/must_use-in-stdlib-traits.rs:42:4
--> $DIR/must_use-in-stdlib-traits.rs:41:4
|
LL | iterator();
| ^^^^^^^^^^
Expand All @@ -12,31 +12,31 @@ LL | #![deny(unused_must_use)]
| ^^^^^^^^^^^^^^^

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

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

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

error: unused implementer of `Fn` that must be used
--> $DIR/must_use-in-stdlib-traits.rs:46:4
--> $DIR/must_use-in-stdlib-traits.rs:45:4
|
LL | square_fn();
| ^^^^^^^^^^^
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/methods/call_method_unknown_referent.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//@ edition: 2018

#![feature(arbitrary_self_types)]

// tests that the referent type of a reference must be known to call methods on it

struct SmartPtr<T>(T);
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/methods/call_method_unknown_referent.stderr
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
error[E0282]: type annotations needed
--> $DIR/call_method_unknown_referent.rs:20:31
--> $DIR/call_method_unknown_referent.rs:18:31
|
LL | let _a: i32 = (ptr as &_).read();
| ^^^^ cannot infer type

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

error[E0599]: no method named `read` found for struct `SmartPtr` in the current scope
--> $DIR/call_method_unknown_referent.rs:46:35
--> $DIR/call_method_unknown_referent.rs:44:35
|
LL | struct SmartPtr<T>(T);
| ------------------ method `read` not found for this struct
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/methods/call_method_unknown_referent2.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//@ edition: 2018
//@ run-pass

#![feature(arbitrary_self_types)]

// tests that the referent type of a reference must be known to call methods on it

struct SmartPtr<T>(T);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(arbitrary_self_types, coerce_unsized, dispatch_from_dyn, unsize)]
#![feature(coerce_unsized, dispatch_from_dyn, unsize)]
#![feature(unsized_locals, unsized_fn_params)]
//~^ WARN the feature `unsized_locals` is incomplete

Expand Down
5 changes: 0 additions & 5 deletions tests/ui/privacy/privacy1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,10 @@ pub trait Deref {
type Target;
}

#[lang="legacy_receiver"]
pub trait LegacyReceiver: Deref {}

impl<'a, T> Deref for &'a T {
type Target = T;
}

impl<'a, T> LegacyReceiver for &'a T {}

mod bar {
// shouldn't bring in too much
pub use self::glob::*;
Expand Down
Loading

0 comments on commit 0325163

Please sign in to comment.