Skip to content

Commit

Permalink
Add #[doc(hidden)] to projected types/methods to mitigate impact of r…
Browse files Browse the repository at this point in the history
…ustc bug
  • Loading branch information
taiki-e committed Aug 9, 2023
1 parent 92cc847 commit 918fd48
Show file tree
Hide file tree
Showing 18 changed files with 76 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,7 @@ macro_rules! __pin_project_make_proj_ty_body {
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
[$($body_data:tt)+]
) => {
#[doc(hidden)] // Work around https://github.com/taiki-e/pin-project-lite/issues/77
#[allow(dead_code)] // This lint warns unused fields/variants.
#[allow(single_use_lifetimes)] // https://github.com/rust-lang/rust/issues/55058
// This lint warns of `clippy::*` generated by external macros.
Expand Down Expand Up @@ -898,6 +899,7 @@ macro_rules! __pin_project_make_proj_replace_ty_body {
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
[$($body_data:tt)+]
) => {
#[doc(hidden)] // Work around https://github.com/taiki-e/pin-project-lite/issues/77
#[allow(dead_code)] // This lint warns unused fields/variants.
#[allow(single_use_lifetimes)] // https://github.com/rust-lang/rust/issues/55058
#[allow(clippy::mut_mut)] // This lint warns `&mut &mut <ty>`. (only needed for project)
Expand Down Expand Up @@ -976,6 +978,7 @@ macro_rules! __pin_project_struct_make_proj_method {
),+
}
) => {
#[doc(hidden)] // Work around https://github.com/taiki-e/pin-project-lite/issues/77
#[inline]
$proj_vis fn $method_ident<'__pin>(
self: $crate::__private::Pin<&'__pin $($mut)? Self>,
Expand Down Expand Up @@ -1010,6 +1013,7 @@ macro_rules! __pin_project_struct_make_proj_replace_method {
),+
}
) => {
#[doc(hidden)] // Work around https://github.com/taiki-e/pin-project-lite/issues/77
#[inline]
$proj_vis fn project_replace(
self: $crate::__private::Pin<&mut Self>,
Expand Down Expand Up @@ -1058,6 +1062,7 @@ macro_rules! __pin_project_enum_make_proj_method {
),+
}
) => {
#[doc(hidden)] // Work around https://github.com/taiki-e/pin-project-lite/issues/77
#[inline]
$proj_vis fn $method_ident<'__pin>(
self: $crate::__private::Pin<&'__pin $($mut)? Self>,
Expand Down Expand Up @@ -1102,6 +1107,7 @@ macro_rules! __pin_project_enum_make_proj_replace_method {
),+
}
) => {
#[doc(hidden)] // Work around https://github.com/taiki-e/pin-project-lite/issues/77
#[inline]
$proj_vis fn project_replace(
self: $crate::__private::Pin<&mut Self>,
Expand Down
6 changes: 6 additions & 0 deletions tests/expand/default/enum.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ enum Enum<T, U> {
Struct { pinned: T, unpinned: U },
Unit,
}
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::unknown_clippy_lints)]
Expand All @@ -20,6 +21,7 @@ where
},
Unit,
}
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::unknown_clippy_lints)]
Expand All @@ -37,6 +39,7 @@ where
},
Unit,
}
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::mut_mut)]
Expand All @@ -51,6 +54,7 @@ enum EnumProjReplace<T, U> {
#[allow(clippy::used_underscore_binding)]
const _: () = {
impl<T, U> Enum<T, U> {
#[doc(hidden)]
#[inline]
fn project<'__pin>(
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
Expand All @@ -69,6 +73,7 @@ const _: () = {
}
}
}
#[doc(hidden)]
#[inline]
fn project_ref<'__pin>(
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
Expand All @@ -87,6 +92,7 @@ const _: () = {
}
}
}
#[doc(hidden)]
#[inline]
fn project_replace(
self: ::pin_project_lite::__private::Pin<&mut Self>,
Expand Down
4 changes: 4 additions & 0 deletions tests/expand/default/struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ struct Struct<T, U> {
#[allow(clippy::redundant_pub_crate)]
#[allow(clippy::used_underscore_binding)]
const _: () = {
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::unknown_clippy_lints)]
Expand All @@ -23,6 +24,7 @@ const _: () = {
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
unpinned: &'__pin mut (U),
}
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::unknown_clippy_lints)]
Expand All @@ -38,6 +40,7 @@ const _: () = {
unpinned: &'__pin (U),
}
impl<T, U> Struct<T, U> {
#[doc(hidden)]
#[inline]
fn project<'__pin>(
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
Expand All @@ -50,6 +53,7 @@ const _: () = {
}
}
}
#[doc(hidden)]
#[inline]
fn project_ref<'__pin>(
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
Expand Down
2 changes: 2 additions & 0 deletions tests/expand/multifields/enum.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ enum Enum<T, U> {
Struct { pinned1: T, pinned2: T, unpinned1: U, unpinned2: U },
Unit,
}
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::mut_mut)]
Expand All @@ -22,6 +23,7 @@ enum EnumProjReplace<T, U> {
#[allow(clippy::used_underscore_binding)]
const _: () = {
impl<T, U> Enum<T, U> {
#[doc(hidden)]
#[inline]
fn project_replace(
self: ::pin_project_lite::__private::Pin<&mut Self>,
Expand Down
6 changes: 6 additions & 0 deletions tests/expand/multifields/struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ struct Struct<T, U> {
unpinned1: U,
unpinned2: U,
}
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::mut_mut)]
Expand All @@ -22,6 +23,7 @@ struct StructProjReplace<T, U> {
#[allow(clippy::redundant_pub_crate)]
#[allow(clippy::used_underscore_binding)]
const _: () = {
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::unknown_clippy_lints)]
Expand All @@ -38,6 +40,7 @@ const _: () = {
unpinned1: &'__pin mut (U),
unpinned2: &'__pin mut (U),
}
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::unknown_clippy_lints)]
Expand All @@ -55,6 +58,7 @@ const _: () = {
unpinned2: &'__pin (U),
}
impl<T, U> Struct<T, U> {
#[doc(hidden)]
#[inline]
fn project<'__pin>(
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
Expand All @@ -70,6 +74,7 @@ const _: () = {
}
}
}
#[doc(hidden)]
#[inline]
fn project_ref<'__pin>(
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
Expand All @@ -84,6 +89,7 @@ const _: () = {
}
}
}
#[doc(hidden)]
#[inline]
fn project_replace(
self: ::pin_project_lite::__private::Pin<&mut Self>,
Expand Down
6 changes: 6 additions & 0 deletions tests/expand/naming/enum-all.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ enum Enum<T, U> {
Struct { pinned: T, unpinned: U },
Unit,
}
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::unknown_clippy_lints)]
Expand All @@ -20,6 +21,7 @@ where
},
Unit,
}
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::unknown_clippy_lints)]
Expand All @@ -37,6 +39,7 @@ where
},
Unit,
}
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::mut_mut)]
Expand All @@ -51,6 +54,7 @@ enum EnumProjReplace<T, U> {
#[allow(clippy::used_underscore_binding)]
const _: () = {
impl<T, U> Enum<T, U> {
#[doc(hidden)]
#[inline]
fn project<'__pin>(
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
Expand All @@ -69,6 +73,7 @@ const _: () = {
}
}
}
#[doc(hidden)]
#[inline]
fn project_ref<'__pin>(
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
Expand All @@ -87,6 +92,7 @@ const _: () = {
}
}
}
#[doc(hidden)]
#[inline]
fn project_replace(
self: ::pin_project_lite::__private::Pin<&mut Self>,
Expand Down
2 changes: 2 additions & 0 deletions tests/expand/naming/enum-mut.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ enum Enum<T, U> {
Struct { pinned: T, unpinned: U },
Unit,
}
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::unknown_clippy_lints)]
Expand All @@ -25,6 +26,7 @@ where
#[allow(clippy::used_underscore_binding)]
const _: () = {
impl<T, U> Enum<T, U> {
#[doc(hidden)]
#[inline]
fn project<'__pin>(
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
Expand Down
2 changes: 2 additions & 0 deletions tests/expand/naming/enum-ref.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ enum Enum<T, U> {
Struct { pinned: T, unpinned: U },
Unit,
}
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::unknown_clippy_lints)]
Expand All @@ -25,6 +26,7 @@ where
#[allow(clippy::used_underscore_binding)]
const _: () = {
impl<T, U> Enum<T, U> {
#[doc(hidden)]
#[inline]
fn project_ref<'__pin>(
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
Expand Down
6 changes: 6 additions & 0 deletions tests/expand/naming/struct-all.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ struct Struct<T, U> {
pinned: T,
unpinned: U,
}
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::unknown_clippy_lints)]
Expand All @@ -17,6 +18,7 @@ where
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
unpinned: &'__pin mut (U),
}
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::unknown_clippy_lints)]
Expand All @@ -31,6 +33,7 @@ where
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
unpinned: &'__pin (U),
}
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::mut_mut)]
Expand All @@ -47,6 +50,7 @@ struct StructProjReplace<T, U> {
#[allow(clippy::used_underscore_binding)]
const _: () = {
impl<T, U> Struct<T, U> {
#[doc(hidden)]
#[inline]
fn project<'__pin>(
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
Expand All @@ -59,6 +63,7 @@ const _: () = {
}
}
}
#[doc(hidden)]
#[inline]
fn project_ref<'__pin>(
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
Expand All @@ -71,6 +76,7 @@ const _: () = {
}
}
}
#[doc(hidden)]
#[inline]
fn project_replace(
self: ::pin_project_lite::__private::Pin<&mut Self>,
Expand Down
4 changes: 4 additions & 0 deletions tests/expand/naming/struct-mut.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ struct Struct<T, U> {
pinned: T,
unpinned: U,
}
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::unknown_clippy_lints)]
Expand All @@ -23,6 +24,7 @@ where
#[allow(clippy::redundant_pub_crate)]
#[allow(clippy::used_underscore_binding)]
const _: () = {
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::unknown_clippy_lints)]
Expand All @@ -38,6 +40,7 @@ const _: () = {
unpinned: &'__pin (U),
}
impl<T, U> Struct<T, U> {
#[doc(hidden)]
#[inline]
fn project<'__pin>(
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
Expand All @@ -50,6 +53,7 @@ const _: () = {
}
}
}
#[doc(hidden)]
#[inline]
fn project_ref<'__pin>(
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
Expand Down
4 changes: 4 additions & 0 deletions tests/expand/naming/struct-none.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ struct Struct<T, U> {
#[allow(clippy::redundant_pub_crate)]
#[allow(clippy::used_underscore_binding)]
const _: () = {
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::unknown_clippy_lints)]
Expand All @@ -23,6 +24,7 @@ const _: () = {
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
unpinned: &'__pin mut (U),
}
#[doc(hidden)]
#[allow(dead_code)]
#[allow(single_use_lifetimes)]
#[allow(clippy::unknown_clippy_lints)]
Expand All @@ -38,6 +40,7 @@ const _: () = {
unpinned: &'__pin (U),
}
impl<T, U> Struct<T, U> {
#[doc(hidden)]
#[inline]
fn project<'__pin>(
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
Expand All @@ -50,6 +53,7 @@ const _: () = {
}
}
}
#[doc(hidden)]
#[inline]
fn project_ref<'__pin>(
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
Expand Down
Loading

0 comments on commit 918fd48

Please sign in to comment.