|
1 |
| -// Based on https://stackoverflow.com/a/49250753/1290530 |
2 |
| - |
3 | 1 | use std::env;
|
4 | 2 |
|
5 |
| -use rustc_version::{version_meta, Channel}; |
6 |
| - |
7 | 3 | fn main() {
|
8 |
| - // Set cfg flags depending on release channel |
9 |
| - match version_meta().unwrap().channel { |
10 |
| - // Enable our feature on nightly, or when using a |
11 |
| - // locally build rustc. |
12 |
| - // |
13 |
| - // This is intended to avoid the issue that cannot know the actual |
14 |
| - // trait implementation bounds of the `Unpin` implementation from the |
15 |
| - // document of generated code. |
16 |
| - // See [taiki-e/pin-project#53] and [rust-lang/rust#63281] for more details. |
17 |
| - // |
18 |
| - // [taiki-e/pin-project#53]: https://github.com/taiki-e/pin-project/pull/53#issuecomment-525906867 |
19 |
| - // [rust-lang/rust#63281]: https://github.com/rust-lang/rust/issues/63281 |
20 |
| - // |
21 |
| - // You can opt-out of this in one of the followg ways: |
22 |
| - // * Use `--cfg pin_project_stable_docs` in RUSTFLAGS. |
23 |
| - // ```toml |
24 |
| - // # in Cargo.toml |
25 |
| - // [package.metadata.docs.rs] |
26 |
| - // rustdoc-args = ["--cfg", "pin_project_stable_docs"] |
27 |
| - // ``` |
28 |
| - // * Use `-Zallow-features` in RUSTFLAGS to disallow unstable features. |
29 |
| - Channel::Nightly | Channel::Dev |
30 |
| - if feature_allowed("proc_macro_def_site") && !cfg!(pin_project_stable_docs) => |
31 |
| - { |
32 |
| - println!("cargo:rustc-cfg=proc_macro_def_site"); |
33 |
| - } |
34 |
| - _ => {} |
| 4 | + // While this crate supports stable Rust, it currently requires |
| 5 | + // nightly Rust in order for rustdoc to correctly document auto-generated |
| 6 | + // `Unpin` impls. This does not affect the runtime functionality of this crate, |
| 7 | + // nor does it affect the safety of the api provided by this crate. |
| 8 | + // |
| 9 | + // This is disabled by default and can be enabled using |
| 10 | + // `--cfg pin_project_show_unpin_struct` in RUSTFLAGS. |
| 11 | + // |
| 12 | + // Refs: |
| 13 | + // * https://github.com/taiki-e/pin-project/pull/53#issuecomment-525906867 |
| 14 | + // * https://github.com/taiki-e/pin-project/pull/70 |
| 15 | + // * https://github.com/rust-lang/rust/issues/63281 |
| 16 | + if cfg!(pin_project_show_unpin_struct) && feature_allowed("proc_macro_def_site") { |
| 17 | + println!("cargo:rustc-cfg=proc_macro_def_site"); |
35 | 18 | }
|
36 | 19 | }
|
37 | 20 |
|
|
0 commit comments