const-field-offset: Fix warnings on nightly rust

```
warning: non-local impl definition, they should be avoided as they go against expectation
```

Part of  #4706
This commit is contained in:
Olivier Goffart 2024-02-28 09:14:40 +01:00
parent 345da48a7e
commit aa7360a91a
2 changed files with 30 additions and 3 deletions

View file

@ -117,6 +117,32 @@ mod tests {
}
}
/**
Test that one can't implement Unpin for pinned struct
This should work:
```
#[derive(const_field_offset::FieldOffsets)]
#[repr(C)]
#[pin]
struct MyStructPin { a: u32 }
```
But this not:
```compile_fail
#[derive(const_field_offset::FieldOffsets)]
#[repr(C)]
#[pin]
struct MyStructPin { a: u32 }
impl Unpin for MyStructPin {};
```
*/
#[cfg(doctest)]
const NO_IMPL_UNPIN: u32 = 0;
#[doc(hidden)]
#[cfg(feature = "field-offset-trait")]
mod internal {