Skip to content

Commit 4595c6a

Browse files
committed
fix: silence some unneded warnings in generated code
Signed-off-by: Oleksandr Babak <[email protected]>
1 parent 871cf88 commit 4595c6a

File tree

5 files changed

+15
-1
lines changed

5 files changed

+15
-1
lines changed

src/macros.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,7 @@ macro_rules! __pin_data {
10051005
) => {
10061006
$crate::macros::paste! {
10071007
#[doc(hidden)]
1008+
#[allow(dead_code)]
10081009
$vis struct [< $name Projection >] <'__pin, $($decl_generics)*> {
10091010
$($(#[$($p_attr)*])* $pvis $p_field : ::core::pin::Pin<&'__pin mut $p_type>,)*
10101011
$($(#[$($attr)*])* $fvis $field : &'__pin mut $type,)*
@@ -1083,6 +1084,7 @@ macro_rules! __pin_data {
10831084
)*
10841085
$(
10851086
$(#[$($attr)*])*
1087+
#[allow(non_snake_case)]
10861088
$fvis unsafe fn $field<E>(
10871089
self,
10881090
slot: *mut $type,
@@ -1093,6 +1095,7 @@ macro_rules! __pin_data {
10931095
}
10941096

10951097
$(#[$($attr)*])*
1098+
#[allow(non_snake_case)]
10961099
$fvis unsafe fn [<__project_ $field>]<'__slot>(
10971100
self,
10981101
slot: &'__slot mut $type,

tests/ui/compile-fail/init/wrong_generics2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ help: you might have forgotten to add the struct literal inside the block
1212
--> src/macros.rs
1313
|
1414
~ ::core::ptr::write($slot, $t { SomeStruct {
15-
|2 $($acc)*
15+
|5 $($acc)*
1616
~ } });
1717
|
1818

tests/ui/expand/many_generics.expanded.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ where
1313
_pin: PhantomPinned,
1414
}
1515
#[doc(hidden)]
16+
#[allow(dead_code)]
1617
struct FooProjection<
1718
'__pin,
1819
'a,
@@ -97,26 +98,30 @@ const _: () = {
9798
) -> ::core::pin::Pin<&'__slot mut PhantomPinned> {
9899
::core::pin::Pin::new_unchecked(slot)
99100
}
101+
#[allow(non_snake_case)]
100102
unsafe fn array<E>(
101103
self,
102104
slot: *mut [u8; 1024 * 1024],
103105
init: impl ::pin_init::Init<[u8; 1024 * 1024], E>,
104106
) -> ::core::result::Result<(), E> {
105107
unsafe { ::pin_init::Init::__init(init, slot) }
106108
}
109+
#[allow(non_snake_case)]
107110
unsafe fn __project_array<'__slot>(
108111
self,
109112
slot: &'__slot mut [u8; 1024 * 1024],
110113
) -> &'__slot mut [u8; 1024 * 1024] {
111114
slot
112115
}
116+
#[allow(non_snake_case)]
113117
unsafe fn r<E>(
114118
self,
115119
slot: *mut &'b mut [&'a mut T; SIZE],
116120
init: impl ::pin_init::Init<&'b mut [&'a mut T; SIZE], E>,
117121
) -> ::core::result::Result<(), E> {
118122
unsafe { ::pin_init::Init::__init(init, slot) }
119123
}
124+
#[allow(non_snake_case)]
120125
unsafe fn __project_r<'__slot>(
121126
self,
122127
slot: &'__slot mut &'b mut [&'a mut T; SIZE],

tests/ui/expand/pin-data.expanded.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ struct Foo {
55
_pin: PhantomPinned,
66
}
77
#[doc(hidden)]
8+
#[allow(dead_code)]
89
struct FooProjection<'__pin> {
910
_pin: ::core::pin::Pin<&'__pin mut PhantomPinned>,
1011
array: &'__pin mut [u8; 1024 * 1024],
@@ -56,13 +57,15 @@ const _: () = {
5657
) -> ::core::pin::Pin<&'__slot mut PhantomPinned> {
5758
::core::pin::Pin::new_unchecked(slot)
5859
}
60+
#[allow(non_snake_case)]
5961
unsafe fn array<E>(
6062
self,
6163
slot: *mut [u8; 1024 * 1024],
6264
init: impl ::pin_init::Init<[u8; 1024 * 1024], E>,
6365
) -> ::core::result::Result<(), E> {
6466
unsafe { ::pin_init::Init::__init(init, slot) }
6567
}
68+
#[allow(non_snake_case)]
6669
unsafe fn __project_array<'__slot>(
6770
self,
6871
slot: &'__slot mut [u8; 1024 * 1024],

tests/ui/expand/pinned_drop.expanded.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ struct Foo {
55
_pin: PhantomPinned,
66
}
77
#[doc(hidden)]
8+
#[allow(dead_code)]
89
struct FooProjection<'__pin> {
910
_pin: ::core::pin::Pin<&'__pin mut PhantomPinned>,
1011
array: &'__pin mut [u8; 1024 * 1024],
@@ -56,13 +57,15 @@ const _: () = {
5657
) -> ::core::pin::Pin<&'__slot mut PhantomPinned> {
5758
::core::pin::Pin::new_unchecked(slot)
5859
}
60+
#[allow(non_snake_case)]
5961
unsafe fn array<E>(
6062
self,
6163
slot: *mut [u8; 1024 * 1024],
6264
init: impl ::pin_init::Init<[u8; 1024 * 1024], E>,
6365
) -> ::core::result::Result<(), E> {
6466
unsafe { ::pin_init::Init::__init(init, slot) }
6567
}
68+
#[allow(non_snake_case)]
6669
unsafe fn __project_array<'__slot>(
6770
self,
6871
slot: &'__slot mut [u8; 1024 * 1024],

0 commit comments

Comments
 (0)