diff --git a/internal/src/pin_data.rs b/internal/src/pin_data.rs index dbf9084b..08e11128 100644 --- a/internal/src/pin_data.rs +++ b/internal/src/pin_data.rs @@ -1792,13 +1792,13 @@ fn generate_projections(info: &StructInfo) -> TokenStream { #[doc = #docs] // Allow `non_snake_case` since the same warning will be emitted on // the struct definition. - #[allow(dead_code, non_snake_case)] + #[allow(dead_code, non_snake_case, explicit_outlives_requirements)] #[doc(hidden)] #projection_lt_def // Allow `non_snake_case` since the same warning will be emitted on // the struct definition. - #[allow(dead_code, non_snake_case)] + #[allow(dead_code, non_snake_case, explicit_outlives_requirements)] #[doc(hidden)] #projection_ref_lt_def @@ -2000,7 +2000,7 @@ fn generate_the_pin_data(info: &StructInfo) -> TokenStream { quote! { // We declare this struct which will host all of the projection function for our type. #[doc(hidden)] - #[allow(non_snake_case)] + #[allow(non_snake_case, explicit_outlives_requirements)] #vis struct __PinDataLt #generics_with_field_lt #whr_with_field_lt { diff --git a/tests/explicit_outlives_requirements.rs b/tests/explicit_outlives_requirements.rs new file mode 100644 index 00000000..682539ec --- /dev/null +++ b/tests/explicit_outlives_requirements.rs @@ -0,0 +1,15 @@ +#![deny(explicit_outlives_requirements)] + +use pin_init::*; + +#[pin_data] +struct ComplexCapture<'bound> { + #[uses('gpu: invariant)] + part: &'gpu (), + gpu: &'bar1 (), + #[borrowed] + bar1: &'bound (), + bar: &'bound (), +} + +fn main() {} diff --git a/tests/ui/expand/many_generics.expanded.rs b/tests/ui/expand/many_generics.expanded.rs index e7fb2634..9fe9affc 100644 --- a/tests/ui/expand/many_generics.expanded.rs +++ b/tests/ui/expand/many_generics.expanded.rs @@ -32,7 +32,7 @@ const _: () = { __this: ::core::marker::PhantomData<&'__this mut Foo<'a, 'b, T, SIZE>>, } /// Pin-projections of [`Foo`] - #[allow(dead_code, non_snake_case)] + #[allow(dead_code, non_snake_case, explicit_outlives_requirements)] #[doc(hidden)] struct __ProjectionLt< '__this, @@ -51,7 +51,7 @@ const _: () = { &'__this mut Foo<'a, 'b, T, SIZE>, >, } - #[allow(dead_code, non_snake_case)] + #[allow(dead_code, non_snake_case, explicit_outlives_requirements)] #[doc(hidden)] struct __ProjectionRef< '__this, @@ -136,7 +136,7 @@ const _: () = { } } #[doc(hidden)] - #[allow(non_snake_case)] + #[allow(non_snake_case, explicit_outlives_requirements)] struct __PinDataLt<'a, 'b: 'a, T: Bar<'b> + ?Sized + 'a, const SIZE: usize = 0> where T: Bar<'a, 1>, diff --git a/tests/ui/expand/pin-data.expanded.rs b/tests/ui/expand/pin-data.expanded.rs index b821bad7..47bec118 100644 --- a/tests/ui/expand/pin-data.expanded.rs +++ b/tests/ui/expand/pin-data.expanded.rs @@ -14,14 +14,14 @@ const _: () = { __this: ::core::marker::PhantomData<&'__this mut Foo>, } /// Pin-projections of [`Foo`] - #[allow(dead_code, non_snake_case)] + #[allow(dead_code, non_snake_case, explicit_outlives_requirements)] #[doc(hidden)] struct __ProjectionLt<'__this> { array: &'__this mut [u8; 1024 * 1024], _pin: ::core::pin::Pin<&'__this mut PhantomPinned>, ___pin_phantom_data: ::core::marker::PhantomData<&'__this mut Foo>, } - #[allow(dead_code, non_snake_case)] + #[allow(dead_code, non_snake_case, explicit_outlives_requirements)] #[doc(hidden)] struct __ProjectionRef<'__this> { array: &'__this [u8; 1024 * 1024], @@ -87,7 +87,7 @@ const _: () = { } } #[doc(hidden)] - #[allow(non_snake_case)] + #[allow(non_snake_case, explicit_outlives_requirements)] struct __PinDataLt { array: ::pin_init::__internal::PhantomInvariant<[u8; 1024 * 1024]>, _pin: ::pin_init::__internal::PhantomInvariant, diff --git a/tests/ui/expand/pinned_drop.expanded.rs b/tests/ui/expand/pinned_drop.expanded.rs index c90ad117..81c6f58c 100644 --- a/tests/ui/expand/pinned_drop.expanded.rs +++ b/tests/ui/expand/pinned_drop.expanded.rs @@ -14,14 +14,14 @@ const _: () = { __this: ::core::marker::PhantomData<&'__this mut Foo>, } /// Pin-projections of [`Foo`] - #[allow(dead_code, non_snake_case)] + #[allow(dead_code, non_snake_case, explicit_outlives_requirements)] #[doc(hidden)] struct __ProjectionLt<'__this> { array: &'__this mut [u8; 1024 * 1024], _pin: ::core::pin::Pin<&'__this mut PhantomPinned>, ___pin_phantom_data: ::core::marker::PhantomData<&'__this mut Foo>, } - #[allow(dead_code, non_snake_case)] + #[allow(dead_code, non_snake_case, explicit_outlives_requirements)] #[doc(hidden)] struct __ProjectionRef<'__this> { array: &'__this [u8; 1024 * 1024], @@ -87,7 +87,7 @@ const _: () = { } } #[doc(hidden)] - #[allow(non_snake_case)] + #[allow(non_snake_case, explicit_outlives_requirements)] struct __PinDataLt { array: ::pin_init::__internal::PhantomInvariant<[u8; 1024 * 1024]>, _pin: ::pin_init::__internal::PhantomInvariant, diff --git a/tests/ui/expand/tuple_struct.expanded.rs b/tests/ui/expand/tuple_struct.expanded.rs index 4ae147e6..4e51e04f 100644 --- a/tests/ui/expand/tuple_struct.expanded.rs +++ b/tests/ui/expand/tuple_struct.expanded.rs @@ -12,7 +12,7 @@ const _: () = { ::core::marker::PhantomData<&'__this mut Foo<'a, T, N>>, ); /// Pin-projections of [`Foo`] - #[allow(dead_code, non_snake_case)] + #[allow(dead_code, non_snake_case, explicit_outlives_requirements)] #[doc(hidden)] struct __ProjectionLt<'__this, 'a, T: Copy, const N: usize>( &'__this mut &'a mut [T; N], @@ -20,7 +20,7 @@ const _: () = { &'__this mut usize, ::core::marker::PhantomData<&'__this mut Foo<'a, T, N>>, ); - #[allow(dead_code, non_snake_case)] + #[allow(dead_code, non_snake_case, explicit_outlives_requirements)] #[doc(hidden)] struct __ProjectionRef<'__this, 'a, T: Copy, const N: usize>( &'__this &'a mut [T; N], @@ -97,7 +97,7 @@ const _: () = { } } #[doc(hidden)] - #[allow(non_snake_case)] + #[allow(non_snake_case, explicit_outlives_requirements)] struct __PinDataLt<'a, T: Copy, const N: usize> { _0: ::pin_init::__internal::PhantomInvariant<&'a mut [T; N]>, _1: ::pin_init::__internal::PhantomInvariant,