diff --git a/pin-project-internal/Cargo.toml b/pin-project-internal/Cargo.toml index 4b24a044..64870d5a 100644 --- a/pin-project-internal/Cargo.toml +++ b/pin-project-internal/Cargo.toml @@ -35,6 +35,3 @@ lazy_static = { version = "1.3", optional = true } [dev-dependencies] pin-project = { version = "0.4.0-alpha.8", path = ".." } - -[build-dependencies] -rustc_version = "0.2.3" diff --git a/pin-project-internal/build.rs b/pin-project-internal/build.rs index 0da8f8a2..953ca3ad 100644 --- a/pin-project-internal/build.rs +++ b/pin-project-internal/build.rs @@ -1,37 +1,20 @@ -// Based on https://stackoverflow.com/a/49250753/1290530 - use std::env; -use rustc_version::{version_meta, Channel}; - fn main() { - // Set cfg flags depending on release channel - match version_meta().unwrap().channel { - // Enable our feature on nightly, or when using a - // locally build rustc. - // - // This is intended to avoid the issue that cannot know the actual - // trait implementation bounds of the `Unpin` implementation from the - // document of generated code. - // See [taiki-e/pin-project#53] and [rust-lang/rust#63281] for more details. - // - // [taiki-e/pin-project#53]: https://github.com/taiki-e/pin-project/pull/53#issuecomment-525906867 - // [rust-lang/rust#63281]: https://github.com/rust-lang/rust/issues/63281 - // - // You can opt-out of this in one of the followg ways: - // * Use `--cfg pin_project_stable_docs` in RUSTFLAGS. - // ```toml - // # in Cargo.toml - // [package.metadata.docs.rs] - // rustdoc-args = ["--cfg", "pin_project_stable_docs"] - // ``` - // * Use `-Zallow-features` in RUSTFLAGS to disallow unstable features. - Channel::Nightly | Channel::Dev - if feature_allowed("proc_macro_def_site") && !cfg!(pin_project_stable_docs) => - { - println!("cargo:rustc-cfg=proc_macro_def_site"); - } - _ => {} + // While this crate supports stable Rust, it currently requires + // nightly Rust in order for rustdoc to correctly document auto-generated + // `Unpin` impls. This does not affect the runtime functionality of this crate, + // nor does it affect the safety of the api provided by this crate. + // + // This is disabled by default and can be enabled using + // `--cfg pin_project_show_unpin_struct` in RUSTFLAGS. + // + // Refs: + // * https://github.com/taiki-e/pin-project/pull/53#issuecomment-525906867 + // * https://github.com/taiki-e/pin-project/pull/70 + // * https://github.com/rust-lang/rust/issues/63281 + if cfg!(pin_project_show_unpin_struct) && feature_allowed("proc_macro_def_site") { + println!("cargo:rustc-cfg=proc_macro_def_site"); } } diff --git a/pin-project-internal/src/pin_project/mod.rs b/pin-project-internal/src/pin_project/mod.rs index a849b065..f32dc151 100644 --- a/pin-project-internal/src/pin_project/mod.rs +++ b/pin-project-internal/src/pin_project/mod.rs @@ -192,7 +192,6 @@ impl Context { { proc_macro::Span::def_site().into() } - #[cfg(not(proc_macro_def_site))] { Span::call_site() diff --git a/src/lib.rs b/src/lib.rs index 62547892..2f6a6ce0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,12 +6,6 @@ //! * [`pinned_drop`] - An attribute for annotating a function that implements `Drop`. //! * [`project`] - An attribute to support pattern matching. //! -//! NOTE: While this crate supports stable Rust, it currently requires -//! nightly Rust in order for rustdoc to correctly document auto-generated -//! `Unpin` impls. This does not affect the runtime functionality of this crate, -//! nor does it affect the safety of the api provided by this crate. -//! -//! //! ## Examples //! //! [`pin_project`] attribute creates a projection struct covering all the fields.