Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize derive(CoercePointee) #133820

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions library/core/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,6 @@ pub trait FnPtr: Copy + Clone {
///
/// By using the macro, the following example will compile:
/// ```
/// #![feature(derive_coerce_pointee)]
/// use std::marker::CoercePointee;
/// use std::ops::Deref;
///
Expand Down Expand Up @@ -1172,7 +1171,7 @@ pub trait FnPtr: Copy + Clone {
/// type as a receiver are dyn-compatible. For example, this compiles:
///
/// ```
/// #![feature(arbitrary_self_types, derive_coerce_pointee)]
/// #![feature(arbitrary_self_types)]
/// use std::marker::CoercePointee;
/// use std::ops::Deref;
///
Expand Down Expand Up @@ -1234,7 +1233,6 @@ pub trait FnPtr: Copy + Clone {
/// If the type has multiple type parameters, then you must explicitly specify which one should be
/// used for dynamic dispatch. For example:
/// ```
/// # #![feature(derive_coerce_pointee)]
/// # use std::marker::{CoercePointee, PhantomData};
/// #[derive(CoercePointee)]
/// #[repr(transparent)]
Expand All @@ -1249,7 +1247,6 @@ pub trait FnPtr: Copy + Clone {
///
/// A custom implementation of the `Rc` type:
/// ```
/// #![feature(derive_coerce_pointee)]
/// use std::marker::CoercePointee;
/// use std::ops::Deref;
/// use std::ptr::NonNull;
Expand Down Expand Up @@ -1306,7 +1303,7 @@ pub trait FnPtr: Copy + Clone {
#[rustc_builtin_macro(CoercePointee, attributes(pointee))]
#[allow_internal_unstable(dispatch_from_dyn, coerce_unsized, unsize, coerce_pointee_validated)]
#[rustc_diagnostic_item = "CoercePointee"]
#[unstable(feature = "derive_coerce_pointee", issue = "123430")]
#[stable(feature = "derive_coerce_pointee", since = "CURRENT_RUSTC_VERSION")]
pub macro CoercePointee($item:item) {
/* compiler built-in */
}
Expand Down
1 change: 0 additions & 1 deletion src/tools/miri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#![feature(strict_overflow_ops)]
#![feature(pointer_is_aligned_to)]
#![feature(unqualified_local_imports)]
#![feature(derive_coerce_pointee)]
#![feature(arbitrary_self_types)]
// Configure clippy and other lints
#![allow(
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/deriving/built-in-proc-macro-scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
//@ proc-macro: another-proc-macro.rs
//@ compile-flags: -Zunpretty=expanded

#![feature(derive_coerce_pointee)]

#[macro_use]
extern crate another_proc_macro;

Expand Down
8 changes: 3 additions & 5 deletions tests/ui/deriving/built-in-proc-macro-scope.stdout
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#![feature(prelude_import)]
#![no_std]
//@ check-pass
//@ proc-macro: another-proc-macro.rs
//@ compile-flags: -Zunpretty=expanded

#![feature(derive_coerce_pointee)]
#[prelude_import]
use ::std::prelude::rust_2015::*;
#[macro_use]
extern crate std;
//@ check-pass
//@ proc-macro: another-proc-macro.rs
//@ compile-flags: -Zunpretty=expanded

#[macro_use]
extern crate another_proc_macro;
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/deriving/coerce-pointee-bounds-issue-127647.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//@ check-pass

#![feature(derive_coerce_pointee)]

#[derive(core::marker::CoercePointee)]
#[repr(transparent)]
pub struct Ptr<'a, #[pointee] T: OnDrop + ?Sized, X> {
Expand Down
1 change: 0 additions & 1 deletion tests/ui/deriving/deriving-coerce-pointee-expanded.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@ check-pass
//@ compile-flags: -Zunpretty=expanded
#![feature(derive_coerce_pointee)]
use std::marker::CoercePointee;

pub trait MyTrait<T: ?Sized> {}
Expand Down
5 changes: 2 additions & 3 deletions tests/ui/deriving/deriving-coerce-pointee-expanded.stdout
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#![feature(prelude_import)]
#![no_std]
//@ check-pass
//@ compile-flags: -Zunpretty=expanded
#![feature(derive_coerce_pointee)]
#[prelude_import]
use ::std::prelude::rust_2015::*;
#[macro_use]
extern crate std;
//@ check-pass
//@ compile-flags: -Zunpretty=expanded
use std::marker::CoercePointee;

pub trait MyTrait<T: ?Sized> {}
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,5 +1,5 @@
//@ proc-macro: malicious-macro.rs
#![feature(derive_coerce_pointee, arbitrary_self_types)]
#![feature(arbitrary_self_types)]

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

#![feature(arbitrary_self_types)]

use std::marker::CoercePointee;

Expand Down
2 changes: 0 additions & 2 deletions tests/ui/deriving/proc-macro-attribute-mixing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
//@ proc-macro: another-proc-macro.rs
//@ compile-flags: -Zunpretty=expanded

#![feature(derive_coerce_pointee)]

#[macro_use]
extern crate another_proc_macro;

Expand Down
10 changes: 4 additions & 6 deletions tests/ui/deriving/proc-macro-attribute-mixing.stdout
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#![feature(prelude_import)]
#![no_std]
#[prelude_import]
use ::std::prelude::rust_2015::*;
#[macro_use]
extern crate std;
// This test certify that we can mix attribute macros from Rust and external proc-macros.
// For instance, `#[derive(Default)]` uses `#[default]` and `#[derive(CoercePointee)]` uses
// `#[pointee]`.
Expand All @@ -10,12 +14,6 @@
//@ proc-macro: another-proc-macro.rs
//@ compile-flags: -Zunpretty=expanded

#![feature(derive_coerce_pointee)]
#[prelude_import]
use ::std::prelude::rust_2015::*;
#[macro_use]
extern crate std;

#[macro_use]
extern crate another_proc_macro;

Expand Down
9 changes: 0 additions & 9 deletions tests/ui/feature-gates/feature-gate-derive-coerce-pointee.rs

This file was deleted.

23 changes: 0 additions & 23 deletions tests/ui/feature-gates/feature-gate-derive-coerce-pointee.stderr

This file was deleted.

1 change: 0 additions & 1 deletion tests/ui/self/arbitrary_self_types_dispatch_to_vtable.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@ check-pass

#![feature(derive_coerce_pointee)]
#![feature(arbitrary_self_types)]

use std::marker::CoercePointee;
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/self/dyn-dispatch-requires-supertrait-norm.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
//@ check-pass

#![feature(derive_coerce_pointee)]
#![feature(arbitrary_self_types)]

use std::ops::Deref;
use std::marker::CoercePointee;
use std::ops::Deref;
use std::sync::Arc;

trait MyTrait<T> {}
Expand Down
5 changes: 2 additions & 3 deletions tests/ui/self/dyn-dispatch-requires-supertrait.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
//@ check-pass

#![feature(derive_coerce_pointee)]
#![feature(arbitrary_self_types)]

use std::ops::Deref;
use std::marker::CoercePointee;
use std::ops::Deref;
use std::sync::Arc;

trait MyTrait {}
Expand All @@ -15,7 +14,7 @@ struct MyArc<T>
where
T: MyTrait + ?Sized,
{
inner: Arc<T>
inner: Arc<T>,
}

impl<T: MyTrait + ?Sized> Deref for MyArc<T> {
Expand Down
Loading