Skip to content

Commit

Permalink
Merge #125
Browse files Browse the repository at this point in the history
125: Remove support for -Zallow-features r=taiki-e a=taiki-e

This is no longer be necessary as unstable features will not be enabled unless you explicitly use `--cfg pin_project_show_unpin_struct`.

Co-authored-by: Taiki Endo <[email protected]>
  • Loading branch information
bors[bot] and taiki-e authored Oct 12, 2019
2 parents 4803d04 + b108287 commit efaa173
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 48 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ jobs:
cargo test --all --all-features
env:
RUSTFLAGS: -Dwarnings --cfg pin_project_show_unpin_struct
- name: cargo check -Zallow-features
if: matrix.rust == 'nightly'
run: |
cargo check --all --all-features
env:
RUSTFLAGS: -Dwarnings --cfg pin_project_show_unpin_struct -Zallow-features=proc_macro_hygiene,stmt_expr_attributes
# Refs: https://github.com/rust-lang/cargo/issues/5657
- name: cargo check -Zminimal-versions
if: matrix.rust == 'nightly'
Expand Down
37 changes: 0 additions & 37 deletions pin-project-internal/build.rs

This file was deleted.

14 changes: 13 additions & 1 deletion pin-project-internal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,19 @@
#![warn(rust_2018_idioms, single_use_lifetimes, unreachable_pub)]
#![warn(clippy::all, clippy::pedantic)]
#![allow(clippy::use_self, clippy::needless_doctest_main)]
#![cfg_attr(proc_macro_def_site, feature(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
#![cfg_attr(pin_project_show_unpin_struct, feature(proc_macro_def_site))]

extern crate proc_macro;

Expand Down
9 changes: 5 additions & 4 deletions pin-project-internal/src/pin_project/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ impl DeriveContext {
let orig_ident = &self.ident;

let make_span = || {
#[cfg(proc_macro_def_site)]
#[cfg(pin_project_show_unpin_struct)]
{
proc_macro::Span::def_site().into()
}
#[cfg(not(proc_macro_def_site))]
#[cfg(not(pin_project_show_unpin_struct))]
{
proc_macro2::Span::call_site()
}
Expand Down Expand Up @@ -159,7 +159,8 @@ impl DeriveContext {
};
full_where_clause.predicates.push(unpin_clause);

let attrs = if cfg!(proc_macro_def_site) { quote!() } else { quote!(#[doc(hidden)]) };
let attrs =
if cfg!(pin_project_show_unpin_struct) { quote!() } else { quote!(#[doc(hidden)]) };

let inner_data = quote! {
// This needs to have the same visibility as the original type,
Expand All @@ -186,7 +187,7 @@ impl DeriveContext {
impl #impl_generics ::core::marker::Unpin for #orig_ident #ty_generics #full_where_clause {}
};

if cfg!(proc_macro_def_site) {
if cfg!(pin_project_show_unpin_struct) {
// On nightly, we use def-site hygiene to make it impossible
// for user code to refer to any of the types we define.
// This allows us to omit wrapping the generated types
Expand Down

0 comments on commit efaa173

Please sign in to comment.