Change:
https://crater- https://crater- cc <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOT_END --
cc
label F-derivesmartpointer
Thread on zulip: https://rust-
claim
WG-prioritization assigning priority (). label -I-prioritize +P-high

Discussion:
EncodeCrossCrate::No, coroutines, experimental!(coroutines) ), <del> // `#[pointee]` attribute to designate the pointee type in SmartPointer derive-macro gated!( pointee, Normal, template!(Word), ErrorFollowing, EncodeCrossCrate::No, derive_smart_pointer, experimental!(pointee) ), </del> // RFC 3543 // `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]` gated!(

} /// Derive macro generating impls of traits related to smart pointers. <del> #[rustc_builtin_macro] </del> <ins> #[rustc_builtin_macro(SmartPointer, attributes(pointee))] </ins> #[allow_internal_unstable(dispatch_from_dyn, coerce_unsized, unsize)] #[unstable(feature = "derive_smart_pointer", issue = "123430")] pub macro SmartPointer($item:item) {

<ins> //@ force-host //@ no-prefer-dynamic #![crate_type = "proc-macro"] #![feature(proc_macro_quote)] extern crate proc_macro; use proc_macro::{quote, TokenStream}; #[proc_macro_derive(AnotherMacro, attributes(pointee))] pub fn derive(_input: TokenStream) -> TokenStream { quote! { const _: () = { const ANOTHER_MACRO_DERIVED: () = (); }; } .into() } #[proc_macro_attribute] pub fn pointee( _attr: proc_macro::TokenStream, _item: proc_macro::TokenStream, ) -> proc_macro::TokenStream { quote! { const _: () = { const POINTEE_MACRO_ATTR_DERIVED: () = (); }; } .into() } #[proc_macro_attribute] pub fn default( _attr: proc_macro::TokenStream, _item: proc_macro::TokenStream, ) -> proc_macro::TokenStream { quote! { const _: () = { const DEFAULT_MACRO_ATTR_DERIVED: () = (); }; } .into() } </ins>

<ins> //@ check-pass //@ aux-build: another-proc-macro.rs //@ compile-flags: -Zunpretty=expanded #![feature(derive_smart_pointer)] #[macro_use] extern crate another_proc_macro; use another_proc_macro::{pointee, AnotherMacro}; #[derive(core::marker::SmartPointer)] #[repr(transparent)] pub struct Ptr<'a, #[pointee] T: ?Sized> { data: &'a mut T, } #[pointee] fn f() {} #[derive(AnotherMacro)] #[pointee] struct MyStruct; fn main() {} </ins>

<ins> #![feature(prelude_import)] #![no_std] //@ check-pass //@ aux-build: another-proc-macro.rs //@ compile-flags: -Zunpretty=expanded #![feature(derive_smart_pointer)] #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; #[macro_use] extern crate another_proc_macro; use another_proc_macro::{pointee, AnotherMacro}; #[repr(transparent)] pub struct Ptr<'a, #[pointee] T: ?Sized> { data: &'a mut T, } #[automatically_derived] impl<'a, T: ?Sized + ::core::marker::Unsize<__S>, __S: ?Sized> ::core::ops::DispatchFromDyn<Ptr<'a, __S>> for Ptr<'a, T> { } #[automatically_derived] impl<'a, T: ?Sized + ::core::marker::Unsize<__S>, __S: ?Sized> ::core::ops::CoerceUnsized<Ptr<'a, __S>> for Ptr<'a, T> { } const _: () = { const POINTEE_MACRO_ATTR_DERIVED: () = (); }; #[pointee] struct MyStruct; const _: () = { const ANOTHER_MACRO_DERIVED: () = (); }; fn main() {} </ins>

<ins> // This test certify that we can mix attribute macros from Rust and external proc-macros. // For instance, `#[derive(Default)]` uses `#[default]` and `#[derive(SmartPointer)]` uses // `#[pointee]`. // The scoping rule should allow the use of the said two attributes when external proc-macros // are in scope. //@ check-pass //@ aux-build: another-proc-macro.rs //@ compile-flags: -Zunpretty=expanded #![feature(derive_smart_pointer)] #[macro_use] extern crate another_proc_macro; #[pointee] fn f() {} #[default] fn g() {} </ins>

<ins> #![feature(prelude_import)] #![no_std] // This test certify that we can mix attribute macros from Rust and external proc-macros. // For instance, `#[derive(Default)]` uses `#[default]` and `#[derive(SmartPointer)]` uses // `#[pointee]`. // The scoping rule should allow the use of the said two attributes when external proc-macros // are in scope. //@ check-pass //@ aux-build: another-proc-macro.rs //@ compile-flags: -Zunpretty=expanded #![feature(derive_smart_pointer)] #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; #[macro_use] extern crate another_proc_macro; const _: () = { const POINTEE_MACRO_ATTR_DERIVED: () = (); }; const _: () = { const DEFAULT_MACRO_ATTR_DERIVED: () = (); }; </ins>

#[derive(SmartPointer)] //~ ERROR use of unstable library feature 'derive_smart_pointer' #[repr(transparent)] struct MyPointer<'a, #[pointee] T: ?Sized> { <del> //~^ ERROR the `#[pointee]` attribute is an experimental feature </del> ptr: &'a T, }

= help: add `#![feature(derive_smart_pointer)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date <del> error[E0658]: the `#[pointee]` attribute is an experimental feature --> $DIR/feature-gate-derive-smart-pointer.rs:5:22 | LL | struct MyPointer<'a, #[pointee] T: ?Sized> { |                      ^^^^^^^^^^ | = note: see issue #123430 <https://github.com/rust-lang/rust/issues/123430> for more information = help: add `#![feature(derive_smart_pointer)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date </del> error[E0658]: use of unstable library feature 'derive_smart_pointer' --> $DIR/feature-gate-derive-smart-pointer.rs:1:5 |

= help: add `#![feature(derive_smart_pointer)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date <del> error: aborting due to 3 previous errors </del> <ins> error: aborting due to 2 previous errors </ins> For more information about this error, try `rustc --explain E0658`.