• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #![warn(nonstandard_style, rust_2018_idioms, unused)]
2 // Note: This does not guarantee compatibility with forbidding these lints in the future.
3 // If rustc adds a new lint, we may not be able to keep this.
4 #![forbid(future_incompatible, rust_2018_compatibility)]
5 #![allow(unknown_lints)] // for old compilers
6 #![warn(
7     box_pointers,
8     deprecated_in_future,
9     disjoint_capture_drop_reorder,
10     elided_lifetimes_in_paths,
11     explicit_outlives_requirements,
12     macro_use_extern_crate,
13     meta_variable_misuse,
14     missing_abi,
15     missing_copy_implementations,
16     missing_debug_implementations,
17     missing_docs,
18     non_ascii_idents,
19     noop_method_call,
20     single_use_lifetimes,
21     trivial_casts,
22     trivial_numeric_casts,
23     unaligned_references,
24     unreachable_pub,
25     unused_extern_crates,
26     unused_import_braces,
27     unused_lifetimes,
28     unused_qualifications,
29     unused_results,
30     variant_size_differences
31 )]
32 // absolute_paths_not_starting_with_crate, anonymous_parameters, keyword_idents, pointer_structural_match, semicolon_in_expressions_from_macros: forbidden as a part of future_incompatible
33 // unsafe_block_in_unsafe_fn: unstable: https://github.com/rust-lang/rust/issues/71668
34 // unsafe_code: checked in forbid_unsafe module
35 // unstable_features: deprecated: https://doc.rust-lang.org/beta/rustc/lints/listing/allowed-by-default.html#unstable-features
36 // unused_crate_dependencies: unrelated
37 #![warn(clippy::all, clippy::pedantic, clippy::nursery)]
38 #![warn(clippy::restriction)]
39 #![allow(clippy::blanket_clippy_restriction_lints)] // this is a test, so enable all restriction lints intentionally.
40 #![allow(clippy::exhaustive_structs, clippy::exhaustive_enums)] // TODO
41 
42 // Check interoperability with rustc and clippy lints.
43 
44 pub mod basic {
45     include!("include/basic.rs");
46 
47     pub mod inside_macro {
48         #[rustfmt::skip]
49         macro_rules! mac {
50             () => {
51                 #[::pin_project::pin_project]
52                 #[derive(Debug)]
53                 pub struct DefaultStruct<T, U> {
54                     #[pin]
55                     pub pinned: T,
56                     pub unpinned: U,
57                 }
58 
59                 #[::pin_project::pin_project(
60                     project = DefaultStructNamedProj,
61                     project_ref = DefaultStructNamedProjRef,
62                 )]
63                 #[derive(Debug)]
64                 pub struct DefaultStructNamed<T, U> {
65                     #[pin]
66                     pub pinned: T,
67                     pub unpinned: U,
68                 }
69 
70                 #[::pin_project::pin_project]
71                 #[derive(Debug)]
72                 pub struct DefaultTupleStruct<T, U>(#[pin] pub T, pub U);
73 
74                 #[::pin_project::pin_project(
75                     project = DefaultTupleStructNamedProj,
76                     project_ref = DefaultTupleStructNamedProjRef,
77                 )]
78                 #[derive(Debug)]
79                 pub struct DefaultTupleStructNamed<T, U>(#[pin] pub T, pub U);
80 
81                 #[::pin_project::pin_project(
82                     project = DefaultEnumProj,
83                     project_ref = DefaultEnumProjRef,
84                 )]
85                 #[derive(Debug)]
86                 pub enum DefaultEnum<T, U> {
87                     Struct {
88                         #[pin]
89                         pinned: T,
90                         unpinned: U,
91                     },
92                     Tuple(#[pin] T, U),
93                     Unit,
94                 }
95 
96                 #[::pin_project::pin_project(PinnedDrop)]
97                 #[derive(Debug)]
98                 pub struct PinnedDropStruct<T, U> {
99                     #[pin]
100                     pub pinned: T,
101                     pub unpinned: U,
102                 }
103 
104                 #[::pin_project::pinned_drop]
105                 impl<T, U> PinnedDrop for PinnedDropStruct<T, U> {
106                     fn drop(self: ::pin_project::__private::Pin<&mut Self>) {}
107                 }
108 
109                 #[::pin_project::pin_project(PinnedDrop)]
110                 #[derive(Debug)]
111                 pub struct PinnedDropTupleStruct<T, U>(#[pin] pub T, pub U);
112 
113                 #[::pin_project::pinned_drop]
114                 impl<T, U> PinnedDrop for PinnedDropTupleStruct<T, U> {
115                     fn drop(self: ::pin_project::__private::Pin<&mut Self>) {}
116                 }
117 
118                 #[::pin_project::pin_project(
119                     PinnedDrop,
120                     project = PinnedDropEnumProj,
121                     project_ref = PinnedDropEnumProjRef,
122                 )]
123                 #[derive(Debug)]
124                 pub enum PinnedDropEnum<T, U> {
125                     Struct {
126                         #[pin]
127                         pinned: T,
128                         unpinned: U,
129                     },
130                     Tuple(#[pin] T, U),
131                     Unit,
132                 }
133 
134                 #[::pin_project::pinned_drop]
135                 impl<T, U> PinnedDrop for PinnedDropEnum<T, U> {
136                     fn drop(self: ::pin_project::__private::Pin<&mut Self>) {}
137                 }
138 
139                 #[::pin_project::pin_project(project_replace)]
140                 #[derive(Debug)]
141                 pub struct ReplaceStruct<T, U> {
142                     #[pin]
143                     pub pinned: T,
144                     pub unpinned: U,
145                 }
146 
147                 #[::pin_project::pin_project(
148                     project = ReplaceStructNamedProj,
149                     project_ref = ReplaceStructNamedProjRef,
150                     project_replace = ReplaceStructNamedProjOwn,
151                 )]
152                 #[derive(Debug)]
153                 pub struct ReplaceStructNamed<T, U> {
154                     #[pin]
155                     pub pinned: T,
156                     pub unpinned: U,
157                 }
158 
159                 #[::pin_project::pin_project(project_replace)]
160                 #[derive(Debug)]
161                 pub struct ReplaceTupleStruct<T, U>(#[pin] pub T, pub U);
162 
163                 #[::pin_project::pin_project(
164                     project = ReplaceTupleStructNamedProj,
165                     project_ref = ReplaceTupleStructNamedProjRef,
166                     project_replace = ReplaceTupleStructNamedProjOwn,
167                 )]
168                 #[derive(Debug)]
169                 pub struct ReplaceTupleStructNamed<T, U>(#[pin] pub T, pub U);
170 
171                 #[::pin_project::pin_project(
172                     project = ReplaceEnumProj,
173                     project_ref = ReplaceEnumProjRef,
174                     project_replace = ReplaceEnumProjOwn,
175                 )]
176                 #[derive(Debug)]
177                 pub enum ReplaceEnum<T, U> {
178                     Struct {
179                         #[pin]
180                         pinned: T,
181                         unpinned: U,
182                     },
183                     Tuple(#[pin] T, U),
184                     Unit,
185                 }
186 
187                 #[::pin_project::pin_project(UnsafeUnpin)]
188                 #[derive(Debug)]
189                 pub struct UnsafeUnpinStruct<T, U> {
190                     #[pin]
191                     pub pinned: T,
192                     pub unpinned: U,
193                 }
194 
195                 #[::pin_project::pin_project(UnsafeUnpin)]
196                 #[derive(Debug)]
197                 pub struct UnsafeUnpinTupleStruct<T, U>(#[pin] pub T, pub U);
198 
199                 #[::pin_project::pin_project(
200                     UnsafeUnpin,
201                     project = UnsafeUnpinEnumProj,
202                     project_ref = UnsafeUnpinEnumProjRef,
203                 )]
204                 #[derive(Debug)]
205                 pub enum UnsafeUnpinEnum<T, U> {
206                     Struct {
207                         #[pin]
208                         pinned: T,
209                         unpinned: U,
210                     },
211                     Tuple(#[pin] T, U),
212                     Unit,
213                 }
214 
215                 #[::pin_project::pin_project(!Unpin)]
216                 #[derive(Debug)]
217                 pub struct NotUnpinStruct<T, U> {
218                     #[pin]
219                     pub pinned: T,
220                     pub unpinned: U,
221                 }
222 
223                 #[::pin_project::pin_project(!Unpin)]
224                 #[derive(Debug)]
225                 pub struct NotUnpinTupleStruct<T, U>(#[pin] pub T, pub U);
226 
227                 #[::pin_project::pin_project(
228                     !Unpin,
229                     project = NotUnpinEnumProj,
230                     project_ref = NotUnpinEnumProjRef,
231                 )]
232                 #[derive(Debug)]
233                 pub enum NotUnpinEnum<T, U> {
234                     Struct {
235                         #[pin]
236                         pinned: T,
237                         unpinned: U,
238                     },
239                     Tuple(#[pin] T, U),
240                     Unit,
241                 }
242 
243                 unsafe impl<T: ::pin_project::__private::Unpin, U: ::pin_project::__private::Unpin>
244                     ::pin_project::UnsafeUnpin for UnsafeUnpinStruct<T, U>
245                 {
246                 }
247                 unsafe impl<T: ::pin_project::__private::Unpin, U: ::pin_project::__private::Unpin>
248                     ::pin_project::UnsafeUnpin for UnsafeUnpinTupleStruct<T, U>
249                 {
250                 }
251                 unsafe impl<T: ::pin_project::__private::Unpin, U: ::pin_project::__private::Unpin>
252                     ::pin_project::UnsafeUnpin for UnsafeUnpinEnum<T, U>
253                 {
254                 }
255             };
256         }
257 
258         mac!();
259     }
260 }
261 
262 pub mod forbid_unsafe {
263     #![forbid(unsafe_code)]
264 
265     include!("include/basic-safe-part.rs");
266 
267     pub mod inside_macro {
268         #[rustfmt::skip]
269         macro_rules! mac {
270             () => {
271                 #[::pin_project::pin_project]
272                 #[derive(Debug)]
273                 pub struct DefaultStruct<T, U> {
274                     #[pin]
275                     pub pinned: T,
276                     pub unpinned: U,
277                 }
278 
279                 #[::pin_project::pin_project(
280                     project = DefaultStructNamedProj,
281                     project_ref = DefaultStructNamedProjRef,
282                 )]
283                 #[derive(Debug)]
284                 pub struct DefaultStructNamed<T, U> {
285                     #[pin]
286                     pub pinned: T,
287                     pub unpinned: U,
288                 }
289 
290                 #[::pin_project::pin_project]
291                 #[derive(Debug)]
292                 pub struct DefaultTupleStruct<T, U>(#[pin] pub T, pub U);
293 
294                 #[::pin_project::pin_project(
295                     project = DefaultTupleStructNamedProj,
296                     project_ref = DefaultTupleStructNamedProjRef,
297                 )]
298                 #[derive(Debug)]
299                 pub struct DefaultTupleStructNamed<T, U>(#[pin] pub T, pub U);
300 
301                 #[::pin_project::pin_project(
302                     project = DefaultEnumProj,
303                     project_ref = DefaultEnumProjRef,
304                 )]
305                 #[derive(Debug)]
306                 pub enum DefaultEnum<T, U> {
307                     Struct {
308                         #[pin]
309                         pinned: T,
310                         unpinned: U,
311                     },
312                     Tuple(#[pin] T, U),
313                     Unit,
314                 }
315 
316                 #[::pin_project::pin_project(PinnedDrop)]
317                 #[derive(Debug)]
318                 pub struct PinnedDropStruct<T, U> {
319                     #[pin]
320                     pub pinned: T,
321                     pub unpinned: U,
322                 }
323 
324                 #[::pin_project::pinned_drop]
325                 impl<T, U> PinnedDrop for PinnedDropStruct<T, U> {
326                     fn drop(self: ::pin_project::__private::Pin<&mut Self>) {}
327                 }
328 
329                 #[::pin_project::pin_project(PinnedDrop)]
330                 #[derive(Debug)]
331                 pub struct PinnedDropTupleStruct<T, U>(#[pin] pub T, pub U);
332 
333                 #[::pin_project::pinned_drop]
334                 impl<T, U> PinnedDrop for PinnedDropTupleStruct<T, U> {
335                     fn drop(self: ::pin_project::__private::Pin<&mut Self>) {}
336                 }
337 
338                 #[::pin_project::pin_project(
339                     PinnedDrop,
340                     project = PinnedDropEnumProj,
341                     project_ref = PinnedDropEnumProjRef,
342                 )]
343                 #[derive(Debug)]
344                 pub enum PinnedDropEnum<T, U> {
345                     Struct {
346                         #[pin]
347                         pinned: T,
348                         unpinned: U,
349                     },
350                     Tuple(#[pin] T, U),
351                     Unit,
352                 }
353 
354                 #[::pin_project::pinned_drop]
355                 impl<T, U> PinnedDrop for PinnedDropEnum<T, U> {
356                     fn drop(self: ::pin_project::__private::Pin<&mut Self>) {}
357                 }
358 
359                 #[::pin_project::pin_project(project_replace)]
360                 #[derive(Debug)]
361                 pub struct ReplaceStruct<T, U> {
362                     #[pin]
363                     pub pinned: T,
364                     pub unpinned: U,
365                 }
366 
367                 #[::pin_project::pin_project(
368                     project = ReplaceStructNamedProj,
369                     project_ref = ReplaceStructNamedProjRef,
370                     project_replace = ReplaceStructNamedProjOwn,
371                 )]
372                 #[derive(Debug)]
373                 pub struct ReplaceStructNamed<T, U> {
374                     #[pin]
375                     pub pinned: T,
376                     pub unpinned: U,
377                 }
378 
379                 #[::pin_project::pin_project(project_replace)]
380                 #[derive(Debug)]
381                 pub struct ReplaceTupleStruct<T, U>(#[pin] pub T, pub U);
382 
383                 #[::pin_project::pin_project(
384                     project = ReplaceTupleStructNamedProj,
385                     project_ref = ReplaceTupleStructNamedProjRef,
386                     project_replace = ReplaceTupleStructNamedProjOwn,
387                 )]
388                 #[derive(Debug)]
389                 pub struct ReplaceTupleStructNamed<T, U>(#[pin] pub T, pub U);
390 
391                 #[::pin_project::pin_project(
392                     project = ReplaceEnumProj,
393                     project_ref = ReplaceEnumProjRef,
394                     project_replace = ReplaceEnumProjOwn,
395                 )]
396                 #[derive(Debug)]
397                 pub enum ReplaceEnum<T, U> {
398                     Struct {
399                         #[pin]
400                         pinned: T,
401                         unpinned: U,
402                     },
403                     Tuple(#[pin] T, U),
404                     Unit,
405                 }
406 
407                 #[::pin_project::pin_project(UnsafeUnpin)]
408                 #[derive(Debug)]
409                 pub struct UnsafeUnpinStruct<T, U> {
410                     #[pin]
411                     pub pinned: T,
412                     pub unpinned: U,
413                 }
414 
415                 #[::pin_project::pin_project(UnsafeUnpin)]
416                 #[derive(Debug)]
417                 pub struct UnsafeUnpinTupleStruct<T, U>(#[pin] pub T, pub U);
418 
419                 #[::pin_project::pin_project(
420                     UnsafeUnpin,
421                     project = UnsafeUnpinEnumProj,
422                     project_ref = UnsafeUnpinEnumProjRef,
423                 )]
424                 #[derive(Debug)]
425                 pub enum UnsafeUnpinEnum<T, U> {
426                     Struct {
427                         #[pin]
428                         pinned: T,
429                         unpinned: U,
430                     },
431                     Tuple(#[pin] T, U),
432                     Unit,
433                 }
434 
435                 #[::pin_project::pin_project(!Unpin)]
436                 #[derive(Debug)]
437                 pub struct NotUnpinStruct<T, U> {
438                     #[pin]
439                     pub pinned: T,
440                     pub unpinned: U,
441                 }
442 
443                 #[::pin_project::pin_project(!Unpin)]
444                 #[derive(Debug)]
445                 pub struct NotUnpinTupleStruct<T, U>(#[pin] pub T, pub U);
446 
447                 #[::pin_project::pin_project(
448                     !Unpin,
449                     project = NotUnpinEnumProj,
450                     project_ref = NotUnpinEnumProjRef,
451                 )]
452                 #[derive(Debug)]
453                 pub enum NotUnpinEnum<T, U> {
454                     Struct {
455                         #[pin]
456                         pinned: T,
457                         unpinned: U,
458                     },
459                     Tuple(#[pin] T, U),
460                     Unit,
461                 }
462             };
463         }
464 
465         mac!();
466     }
467 }
468 
469 pub mod box_pointers {
470     use pin_project::pin_project;
471 
472     #[allow(box_pointers)] // for the type itself
473     #[pin_project(project_replace)]
474     #[derive(Debug)]
475     pub struct Struct {
476         #[pin]
477         pub p: Box<isize>,
478         pub u: Box<isize>,
479     }
480 
481     #[allow(box_pointers)] // for the type itself
482     #[pin_project(project_replace)]
483     #[derive(Debug)]
484     pub struct TupleStruct(#[pin] pub Box<isize>, pub Box<isize>);
485 
486     #[allow(box_pointers)] // for the type itself
487     #[pin_project(
488         project = EnumProj,
489         project_ref = EnumProjRef,
490         project_replace = EnumProjOwn,
491     )]
492     #[derive(Debug)]
493     pub enum Enum {
494         Struct {
495             #[pin]
496             p: Box<isize>,
497             u: Box<isize>,
498         },
499         Tuple(#[pin] Box<isize>, Box<isize>),
500         Unit,
501     }
502 
503     pub mod inside_macro {
504         use pin_project::pin_project;
505 
506         #[rustfmt::skip]
507         macro_rules! mac {
508             () => {
509                 #[allow(box_pointers)] // for the type itself
510                 #[pin_project(project_replace)]
511                 #[derive(Debug)]
512                 pub struct Struct {
513                     #[pin]
514                     pub p: Box<isize>,
515                     pub u: Box<isize>,
516                 }
517 
518                 #[allow(box_pointers)] // for the type itself
519                 #[pin_project(project_replace)]
520                 #[derive(Debug)]
521                 pub struct TupleStruct(#[pin] pub Box<isize>, pub Box<isize>);
522 
523                 #[allow(box_pointers)] // for the type itself
524                 #[pin_project(
525                     project = EnumProj,
526                     project_ref = EnumProjRef,
527                     project_replace = EnumProjOwn,
528                 )]
529                 #[derive(Debug)]
530                 pub enum Enum {
531                     Struct {
532                         #[pin]
533                         p: Box<isize>,
534                         u: Box<isize>,
535                     },
536                     Tuple(#[pin] Box<isize>, Box<isize>),
537                     Unit,
538                 }
539             };
540         }
541 
542         mac!();
543     }
544 }
545 
546 pub mod deprecated {
547     use pin_project::pin_project;
548 
549     #[allow(deprecated)] // for the type itself
550     #[pin_project(project_replace)]
551     #[derive(Debug, Clone, Copy)]
552     #[deprecated]
553     pub struct Struct {
554         #[deprecated]
555         #[pin]
556         pub p: (),
557         #[deprecated]
558         pub u: (),
559     }
560 
561     #[allow(deprecated)] // for the type itself
562     #[pin_project(project_replace)]
563     #[derive(Debug, Clone, Copy)]
564     #[deprecated]
565     pub struct TupleStruct(
566         #[deprecated]
567         #[pin]
568         pub (),
569         #[deprecated] pub (),
570     );
571 
572     #[allow(deprecated)] // for the type itself
573     #[pin_project(
574         project = EnumProj,
575         project_ref = EnumProjRef,
576         project_replace = EnumProjOwn,
577     )]
578     #[derive(Debug, Clone, Copy)]
579     #[deprecated]
580     pub enum Enum {
581         #[deprecated]
582         Struct {
583             #[deprecated]
584             #[pin]
585             p: (),
586             #[deprecated]
587             u: (),
588         },
589         #[deprecated]
590         Tuple(
591             #[deprecated]
592             #[pin]
593             (),
594             #[deprecated] (),
595         ),
596         #[deprecated]
597         Unit,
598     }
599 
600     pub mod inside_macro {
601         use pin_project::pin_project;
602 
603         #[rustfmt::skip]
604         macro_rules! mac {
605             () => {
606                 #[allow(deprecated)] // for the type itself
607                 #[pin_project(project_replace)]
608                 #[derive(Debug, Clone, Copy)]
609                 #[deprecated]
610                 pub struct Struct {
611                     #[deprecated]
612                     #[pin]
613                     pub p: (),
614                     #[deprecated]
615                     pub u: (),
616                 }
617 
618                 #[allow(deprecated)] // for the type itself
619                 #[pin_project(project_replace)]
620                 #[derive(Debug, Clone, Copy)]
621                 #[deprecated]
622                 pub struct TupleStruct(
623                     #[deprecated]
624                     #[pin]
625                     pub (),
626                     #[deprecated] pub (),
627                 );
628 
629                 #[allow(deprecated)] // for the type itself
630                 #[pin_project(
631                     project = EnumProj,
632                     project_ref = EnumProjRef,
633                     project_replace = EnumProjOwn,
634                 )]
635                 #[derive(Debug, Clone, Copy)]
636                 #[deprecated]
637                 pub enum Enum {
638                     #[deprecated]
639                     Struct {
640                         #[deprecated]
641                         #[pin]
642                         p: (),
643                         #[deprecated]
644                         u: (),
645                     },
646                     #[deprecated]
647                     Tuple(
648                         #[deprecated]
649                         #[pin]
650                         (),
651                         #[deprecated] (),
652                     ),
653                     #[deprecated]
654                     Unit,
655                 }
656             };
657         }
658 
659         mac!();
660     }
661 }
662 
663 pub mod explicit_outlives_requirements {
664     use pin_project::pin_project;
665 
666     #[allow(explicit_outlives_requirements)] // for the type itself: https://github.com/rust-lang/rust/issues/60993
667     #[pin_project(project_replace)]
668     #[derive(Debug)]
669     pub struct Struct<'a, T, U>
670     where
671         T: ?Sized,
672         U: ?Sized,
673     {
674         #[pin]
675         pub pinned: &'a mut T,
676         pub unpinned: &'a mut U,
677     }
678 
679     #[allow(explicit_outlives_requirements)] // for the type itself: https://github.com/rust-lang/rust/issues/60993
680     #[pin_project(project_replace)]
681     #[derive(Debug)]
682     pub struct TupleStruct<'a, T, U>(#[pin] pub &'a mut T, pub &'a mut U)
683     where
684         T: ?Sized,
685         U: ?Sized;
686 
687     #[allow(explicit_outlives_requirements)] // for the type itself: https://github.com/rust-lang/rust/issues/60993
688     #[pin_project(
689         project = EnumProj,
690         project_ref = EnumProjRef,
691         project_replace = EnumProjOwn,
692     )]
693     #[derive(Debug)]
694     pub enum Enum<'a, T, U>
695     where
696         T: ?Sized,
697         U: ?Sized,
698     {
699         Struct {
700             #[pin]
701             pinned: &'a mut T,
702             unpinned: &'a mut U,
703         },
704         Tuple(#[pin] &'a mut T, &'a mut U),
705         Unit,
706     }
707 
708     pub mod inside_macro {
709         use pin_project::pin_project;
710 
711         #[rustfmt::skip]
712         macro_rules! mac {
713             () => {
714                 #[allow(explicit_outlives_requirements)] // for the type itself: https://github.com/rust-lang/rust/issues/60993
715                 #[pin_project(project_replace)]
716                 #[derive(Debug)]
717                 pub struct Struct<'a, T, U>
718                 where
719                     T: ?Sized,
720                     U: ?Sized,
721                 {
722                     #[pin]
723                     pub pinned: &'a mut T,
724                     pub unpinned: &'a mut U,
725                 }
726 
727                 #[allow(explicit_outlives_requirements)] // for the type itself: https://github.com/rust-lang/rust/issues/60993
728                 #[pin_project(project_replace)]
729                 #[derive(Debug)]
730                 pub struct TupleStruct<'a, T, U>(#[pin] pub &'a mut T, pub &'a mut U)
731                 where
732                     T: ?Sized,
733                     U: ?Sized;
734 
735                 #[allow(explicit_outlives_requirements)] // for the type itself: https://github.com/rust-lang/rust/issues/60993
736                 #[pin_project(
737                     project = EnumProj,
738                     project_ref = EnumProjRef,
739                     project_replace = EnumProjOwn,
740                 )]
741                 #[derive(Debug)]
742                 pub enum Enum<'a, T, U>
743                 where
744                     T: ?Sized,
745                     U: ?Sized,
746                 {
747                     Struct {
748                         #[pin]
749                         pinned: &'a mut T,
750                         unpinned: &'a mut U,
751                     },
752                     Tuple(#[pin] &'a mut T, &'a mut U),
753                     Unit,
754                 }
755             };
756         }
757 
758         mac!();
759     }
760 }
761 
762 pub mod single_use_lifetimes {
763     use pin_project::pin_project;
764 
765     #[allow(unused_lifetimes)]
766     pub trait Trait<'a> {}
767 
768     #[allow(unused_lifetimes)] // for the type itself
769     #[allow(single_use_lifetimes)] // for the type itself: https://github.com/rust-lang/rust/issues/55058
770     #[pin_project(project_replace)]
771     #[derive(Debug)]
772     pub struct Hrtb<'pin___, T>
773     where
774         for<'pin> &'pin T: Unpin,
775         T: for<'pin> Trait<'pin>,
776         for<'pin, 'pin_, 'pin__> &'pin &'pin_ &'pin__ T: Unpin,
777     {
778         #[pin]
779         f: &'pin___ mut T,
780     }
781 
782     pub mod inside_macro {
783         use pin_project::pin_project;
784 
785         #[rustfmt::skip]
786         macro_rules! mac {
787             () => {
788                 #[allow(unused_lifetimes)]
789                 pub trait Trait<'a> {}
790 
791                 #[allow(unused_lifetimes)] // for the type itself
792                 #[allow(single_use_lifetimes)] // for the type itself: https://github.com/rust-lang/rust/issues/55058
793                 #[pin_project(project_replace)]
794                 #[derive(Debug)]
795                 pub struct Hrtb<'pin___, T>
796                 where
797                     for<'pin> &'pin T: Unpin,
798                     T: for<'pin> Trait<'pin>,
799                     for<'pin, 'pin_, 'pin__> &'pin &'pin_ &'pin__ T: Unpin,
800                 {
801                     #[pin]
802                     f: &'pin___ mut T,
803                 }
804             };
805         }
806 
807         mac!();
808     }
809 }
810 
811 pub mod variant_size_differences {
812     use pin_project::pin_project;
813 
814     #[allow(missing_debug_implementations, missing_copy_implementations)] // https://github.com/rust-lang/rust/pull/74060
815     #[allow(variant_size_differences)] // for the type itself
816     #[allow(clippy::large_enum_variant)] // for the type itself
817     #[pin_project(
818         project = EnumProj,
819         project_ref = EnumProjRef,
820         project_replace = EnumProjOwn,
821     )]
822     pub enum Enum {
823         V1(u8),
824         V2([u8; 1024]),
825     }
826 
827     pub mod inside_macro {
828         use pin_project::pin_project;
829 
830         #[rustfmt::skip]
831         macro_rules! mac {
832             () => {
833                 #[allow(missing_debug_implementations, missing_copy_implementations)] // https://github.com/rust-lang/rust/pull/74060
834                 #[allow(variant_size_differences)] // for the type itself
835                 #[allow(clippy::large_enum_variant)] // for the type itself
836                 #[pin_project(
837                     project = EnumProj,
838                     project_ref = EnumProjRef,
839                     project_replace = EnumProjOwn,
840                 )]
841                 pub enum Enum {
842                     V1(u8),
843                     V2([u8; 1024]),
844                 }
845             };
846         }
847 
848         mac!();
849     }
850 }
851 
852 pub mod clippy_mut_mut {
853     use pin_project::pin_project;
854 
855     #[pin_project(project_replace)]
856     #[derive(Debug)]
857     pub struct Struct<'a, T, U> {
858         #[pin]
859         pub pinned: &'a mut T,
860         pub unpinned: &'a mut U,
861     }
862 
863     #[pin_project(project_replace)]
864     #[derive(Debug)]
865     pub struct TupleStruct<'a, T, U>(#[pin] &'a mut T, &'a mut U);
866 
867     #[pin_project(
868         project = EnumProj,
869         project_ref = EnumProjRef,
870         project_replace = EnumProjOwn,
871     )]
872     #[derive(Debug)]
873     pub enum Enum<'a, T, U> {
874         Struct {
875             #[pin]
876             pinned: &'a mut T,
877             unpinned: &'a mut U,
878         },
879         Tuple(#[pin] &'a mut T, &'a mut U),
880         Unit,
881     }
882 
883     pub mod inside_macro {
884         use pin_project::pin_project;
885 
886         #[rustfmt::skip]
887         macro_rules! mac {
888             () => {
889                 #[pin_project(project_replace)]
890                 #[derive(Debug)]
891                 pub struct Struct<'a, T, U> {
892                     #[pin]
893                     pub pinned: &'a mut T,
894                     pub unpinned: &'a mut U,
895                 }
896 
897                 #[pin_project(project_replace)]
898                 #[derive(Debug)]
899                 pub struct TupleStruct<'a, T, U>(#[pin] &'a mut T, &'a mut U);
900 
901                 #[pin_project(
902                     project = EnumProj,
903                     project_ref = EnumProjRef,
904                     project_replace = EnumProjOwn,
905                 )]
906                 #[derive(Debug)]
907                 pub enum Enum<'a, T, U> {
908                     Struct {
909                         #[pin]
910                         pinned: &'a mut T,
911                         unpinned: &'a mut U,
912                     },
913                     Tuple(#[pin] &'a mut T, &'a mut U),
914                     Unit,
915                 }
916             };
917         }
918 
919         mac!();
920     }
921 }
922 
923 #[allow(unreachable_pub)]
924 mod clippy_redundant_pub_crate {
925     use pin_project::pin_project;
926 
927     #[pin_project(project_replace)]
928     #[derive(Debug)]
929     pub struct Struct<T, U> {
930         #[pin]
931         pub pinned: T,
932         pub unpinned: U,
933     }
934 
935     #[pin_project(project_replace)]
936     #[derive(Debug)]
937     pub struct TupleStruct<T, U>(#[pin] pub T, pub U);
938 
939     #[allow(dead_code)]
940     #[pin_project(
941         project = EnumProj,
942         project_ref = EnumProjRef,
943         project_replace = EnumProjOwn,
944     )]
945     #[derive(Debug)]
946     pub enum Enum<T, U> {
947         Struct {
948             #[pin]
949             pinned: T,
950             unpinned: U,
951         },
952         Tuple(#[pin] T, U),
953         Unit,
954     }
955 
956     pub mod inside_macro {
957         use pin_project::pin_project;
958 
959         #[rustfmt::skip]
960         macro_rules! mac {
961             () => {
962                 #[pin_project(project_replace)]
963                 #[derive(Debug)]
964                 pub struct Struct<T, U> {
965                     #[pin]
966                     pub pinned: T,
967                     pub unpinned: U,
968                 }
969 
970                 #[pin_project(project_replace)]
971                 #[derive(Debug)]
972                 pub struct TupleStruct<T, U>(#[pin] pub T, pub U);
973 
974                 #[allow(dead_code)]
975                 #[pin_project(
976                     project = EnumProj,
977                     project_ref = EnumProjRef,
978                     project_replace = EnumProjOwn,
979                 )]
980                 #[derive(Debug)]
981                 pub enum Enum<T, U> {
982                     Struct {
983                         #[pin]
984                         pinned: T,
985                         unpinned: U,
986                     },
987                     Tuple(#[pin] T, U),
988                     Unit,
989                 }
990             };
991         }
992 
993         mac!();
994     }
995 }
996 
997 pub mod clippy_type_repetition_in_bounds {
998     use pin_project::pin_project;
999 
1000     #[pin_project(project_replace)]
1001     #[derive(Debug)]
1002     pub struct Struct<T, U>
1003     where
1004         Self: Sized,
1005     {
1006         #[pin]
1007         pub pinned: T,
1008         pub unpinned: U,
1009     }
1010 
1011     #[pin_project(project_replace)]
1012     #[derive(Debug)]
1013     pub struct TupleStruct<T, U>(#[pin] T, U)
1014     where
1015         Self: Sized;
1016 
1017     #[pin_project(
1018         project = EnumProj,
1019         project_ref = EnumProjRef,
1020         project_replace = EnumProjOwn,
1021     )]
1022     #[derive(Debug)]
1023     pub enum Enum<T, U>
1024     where
1025         Self: Sized,
1026     {
1027         Struct {
1028             #[pin]
1029             pinned: T,
1030             unpinned: U,
1031         },
1032         Tuple(#[pin] T, U),
1033         Unit,
1034     }
1035 
1036     pub mod inside_macro {
1037         use pin_project::pin_project;
1038 
1039         #[rustfmt::skip]
1040         macro_rules! mac {
1041             () => {
1042                 #[pin_project(project_replace)]
1043                 #[derive(Debug)]
1044                 pub struct Struct<T, U>
1045                 where
1046                     Self: Sized,
1047                 {
1048                     #[pin]
1049                     pub pinned: T,
1050                     pub unpinned: U,
1051                 }
1052 
1053                 #[pin_project(project_replace)]
1054                 #[derive(Debug)]
1055                 pub struct TupleStruct<T, U>(#[pin] T, U)
1056                 where
1057                     Self: Sized;
1058 
1059                 #[pin_project(
1060                     project = EnumProj,
1061                     project_ref = EnumProjRef,
1062                     project_replace = EnumProjOwn,
1063                 )]
1064                 #[derive(Debug)]
1065                 pub enum Enum<T, U>
1066                 where
1067                     Self: Sized,
1068                 {
1069                     Struct {
1070                         #[pin]
1071                         pinned: T,
1072                         unpinned: U,
1073                     },
1074                     Tuple(#[pin] T, U),
1075                     Unit,
1076                 }
1077             };
1078         }
1079 
1080         mac!();
1081     }
1082 }
1083 
1084 pub mod clippy_used_underscore_binding {
1085     use pin_project::pin_project;
1086 
1087     #[pin_project(project_replace)]
1088     #[derive(Debug)]
1089     pub struct Struct<T, U> {
1090         #[pin]
1091         pub _pinned: T,
1092         pub _unpinned: U,
1093     }
1094 
1095     #[pin_project(
1096         project = EnumProj,
1097         project_ref = EnumProjRef,
1098         project_replace = EnumProjOwn,
1099     )]
1100     #[derive(Debug)]
1101     pub enum Enum<T, U> {
1102         Struct {
1103             #[pin]
1104             _pinned: T,
1105             _unpinned: U,
1106         },
1107     }
1108 
1109     pub mod inside_macro {
1110         use pin_project::pin_project;
1111 
1112         #[rustfmt::skip]
1113         macro_rules! mac {
1114             () => {
1115                 #[pin_project(project_replace)]
1116                 #[derive(Debug)]
1117                 pub struct Struct<T, U> {
1118                     #[pin]
1119                     pub _pinned: T,
1120                     pub _unpinned: U,
1121                 }
1122 
1123                 #[pin_project(
1124                     project = EnumProj,
1125                     project_ref = EnumProjRef,
1126                     project_replace = EnumProjOwn,
1127                 )]
1128                 #[derive(Debug)]
1129                 pub enum Enum<T, U> {
1130                     Struct {
1131                         #[pin]
1132                         _pinned: T,
1133                         _unpinned: U,
1134                     },
1135                 }
1136             };
1137         }
1138 
1139         mac!();
1140     }
1141 }
1142 
1143 pub mod clippy_ref_option_ref {
1144     use pin_project::pin_project;
1145 
1146     #[pin_project]
1147     #[derive(Debug)]
1148     pub struct Struct<'a> {
1149         #[pin]
1150         pub _pinned: Option<&'a ()>,
1151         pub _unpinned: Option<&'a ()>,
1152     }
1153 
1154     #[pin_project(project = EnumProj, project_ref = EnumProjRef)]
1155     #[derive(Debug)]
1156     pub enum Enum<'a> {
1157         Struct {
1158             #[pin]
1159             _pinned: Option<&'a ()>,
1160             _unpinned: Option<&'a ()>,
1161         },
1162     }
1163 }
1164