From b0636980b1ec66dad24184f5f9b971624884ae45 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Thu, 19 Sep 2019 08:38:34 +0900 Subject: [PATCH] Remove "project_attr" feature and enable #[project] attribute by default --- Cargo.toml | 2 -- pin-project-internal/Cargo.toml | 4 +--- pin-project-internal/src/lib.rs | 16 ++-------------- src/lib.rs | 1 - tests/compiletest.rs | 1 - tests/project.rs | 1 - 6 files changed, 3 insertions(+), 22 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a22560d8..d4b4740e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,8 +18,6 @@ all-features = true members = ["pin-project-internal"] [features] -# Enable to use `project` attribute. -project_attr = ["pin-project-internal/project_attr"] # Enable to allow using this crate as a renamed dependency renamed = ["pin-project-internal/renamed"] diff --git a/pin-project-internal/Cargo.toml b/pin-project-internal/Cargo.toml index 2c0c26c1..88546f56 100644 --- a/pin-project-internal/Cargo.toml +++ b/pin-project-internal/Cargo.toml @@ -17,15 +17,13 @@ all-features = true proc-macro = true [features] -# Enable to use `project` attribute. -project_attr = ["syn/visit-mut"] # Enable to allow using the crate with a renamed 'pin-project' dependency renamed = ["proc-macro-crate", "serde", "lazy_static"] [dependencies] proc-macro2 = "1.0" quote = "1.0" -syn = { version = "1.0", features = ["full"] } +syn = { version = "1.0", features = ["full", "visit-mut"] } proc-macro-crate = { version = "0.1.4", optional = true } # Required until a new toml-rs release is made with https://github.com/alexcrichton/toml-rs/pull/311, diff --git a/pin-project-internal/src/lib.rs b/pin-project-internal/src/lib.rs index 733f45c9..e671a9e6 100644 --- a/pin-project-internal/src/lib.rs +++ b/pin-project-internal/src/lib.rs @@ -19,7 +19,6 @@ mod utils; mod pin_project; mod pinned_drop; -#[cfg(feature = "project_attr")] mod project; use proc_macro::TokenStream; @@ -265,22 +264,16 @@ use syn::parse::Nothing; /// /// ### Enums /// -/// `pin_project` also supports enums, but to use it ergonomically, you need -/// to use the [`project`] attribute. -/// -/// *This attribute is only available if pin-project is built -/// with the `"project_attr"` feature.* +/// `pin_project` also supports enums, but to use it, you need to use with the +/// [`project`] attribute. /// /// The attribute at the expression position is not stable, so you need to use /// a dummy `#[project]` attribute for the function. /// /// ```rust -/// # #[cfg(feature = "project_attr")] /// use pin_project::{project, pin_project}; -/// # #[cfg(feature = "project_attr")] /// use std::pin::Pin; /// -/// # #[cfg(feature = "project_attr")] /// #[pin_project] /// enum Foo { /// Tuple(#[pin] A, B), @@ -288,7 +281,6 @@ use syn::parse::Nothing; /// Unit, /// } /// -/// # #[cfg(feature = "project_attr")] /// impl Foo { /// #[project] // Nightly does not need a dummy attribute to the function. /// fn baz(self: Pin<&mut Self>) { @@ -368,9 +360,6 @@ pub fn pinned_drop(args: TokenStream, input: TokenStream) -> TokenStream { // TODO: Move this doc into pin-project crate when https://github.com/rust-lang/rust/pull/62855 merged. /// An attribute to provide way to refer to the projected type. /// -/// *This attribute is available if pin-project is built with the -/// `"project_attr"` feature.* -/// /// The following three syntaxes are supported. /// /// ## `impl` blocks @@ -479,7 +468,6 @@ pub fn pinned_drop(args: TokenStream, input: TokenStream) -> TokenStream { /// } /// } /// ``` -#[cfg(feature = "project_attr")] #[proc_macro_attribute] pub fn project(args: TokenStream, input: TokenStream) -> TokenStream { let _: Nothing = syn::parse_macro_input!(args); diff --git a/src/lib.rs b/src/lib.rs index f30f5bca..ba970475 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -57,7 +57,6 @@ pub use pin_project_internal::pin_project; #[doc(hidden)] pub use pin_project_internal::pinned_drop; -#[cfg(feature = "project_attr")] #[doc(hidden)] pub use pin_project_internal::project; diff --git a/tests/compiletest.rs b/tests/compiletest.rs index 3e92e41b..67770209 100644 --- a/tests/compiletest.rs +++ b/tests/compiletest.rs @@ -1,6 +1,5 @@ #![cfg(compiletest)] #![cfg(pin_project_show_unpin_struct)] -#![cfg(feature = "project_attr")] #![warn(rust_2018_idioms, single_use_lifetimes)] use std::{env, path::PathBuf}; diff --git a/tests/project.rs b/tests/project.rs index f4c9b20b..8dd9be99 100644 --- a/tests/project.rs +++ b/tests/project.rs @@ -1,4 +1,3 @@ -#![cfg(feature = "project_attr")] #![warn(unsafe_code)] #![warn(rust_2018_idioms, single_use_lifetimes)] #![allow(dead_code)]