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