Skip to content

Commit

Permalink
Remove "project_attr" feature and enable #[project] attribute by default
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Sep 18, 2019
1 parent ddc0122 commit b063698
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 22 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
4 changes: 1 addition & 3 deletions pin-project-internal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 2 additions & 14 deletions pin-project-internal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ mod utils;

mod pin_project;
mod pinned_drop;
#[cfg(feature = "project_attr")]
mod project;

use proc_macro::TokenStream;
Expand Down Expand Up @@ -265,30 +264,23 @@ 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<A, B, C> {
/// Tuple(#[pin] A, B),
/// Struct { field: C },
/// Unit,
/// }
///
/// # #[cfg(feature = "project_attr")]
/// impl<A, B, C> Foo<A, B, C> {
/// #[project] // Nightly does not need a dummy attribute to the function.
/// fn baz(self: Pin<&mut Self>) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion tests/compiletest.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
1 change: 0 additions & 1 deletion tests/project.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![cfg(feature = "project_attr")]
#![warn(unsafe_code)]
#![warn(rust_2018_idioms, single_use_lifetimes)]
#![allow(dead_code)]
Expand Down

0 comments on commit b063698

Please sign in to comment.