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

Remove "project_attr" feature and always enable #[project] attribute #94

Merged
merged 1 commit into from
Sep 19, 2019
Merged
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
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