Skip to content

Commit

Permalink
Merge #30
Browse files Browse the repository at this point in the history
30: Fix compatibility of generated code with forbid(future_incompatible) r=taiki-e a=taiki-e

Note: This does not guarantee compatibility with `forbid(future_incompatible)` in the future.
If rustc adds a new lint, we may not be able to keep this.

cc taiki-e/pin-project#281

Co-authored-by: Taiki Endo <[email protected]>
  • Loading branch information
bors[bot] and taiki-e authored Sep 26, 2020
2 parents 96bb178 + 38c3c04 commit 85ca8db
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ macro_rules! __pin_project_internal {
// Ensure that it's impossible to use pin projections on a #[repr(packed)] struct.
//
// Taking a reference to a packed field is unsafe, amd appplying
// #[deny(safe_packed_borrows)] makes sure that doing this without
// #[forbid(safe_packed_borrows)] makes sure that doing this without
// an 'unsafe' block (which we deliberately do not generate)
// is a hard error.
//
Expand All @@ -285,7 +285,7 @@ macro_rules! __pin_project_internal {
// a much nicer error above.
//
// See https://github.com/taiki-e/pin-project/pull/34 for more details.
#[deny(safe_packed_borrows)]
#[forbid(safe_packed_borrows)]
fn __assert_not_repr_packed <$($impl_generics)*> (this: &$ident <$($ty_generics)*>)
$(where
$($where_clause)*)?
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/tests/expand/default-struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const _: () = {
#[allow(clippy::drop_bounds)]
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
impl<T, U> MustNotImplDrop for Struct<T, U> {}
#[deny(safe_packed_borrows)]
#[forbid(safe_packed_borrows)]
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
let _ = &this.pinned;
let _ = &this.unpinned;
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/tests/expand/pub-struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const _: () = {
#[allow(clippy::drop_bounds)]
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
impl<T, U> MustNotImplDrop for Struct<T, U> {}
#[deny(safe_packed_borrows)]
#[forbid(safe_packed_borrows)]
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
let _ = &this.pinned;
let _ = &this.unpinned;
Expand Down
5 changes: 4 additions & 1 deletion tests/lint.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#![warn(future_incompatible, nonstandard_style, rust_2018_compatibility, rust_2018_idioms, unused)]
#![warn(nonstandard_style, rust_2018_compatibility, rust_2018_idioms, unused)]
// Note: This does not guarantee compatibility with `forbid(future_incompatible)` in the future.
// If rustc adds a new lint, we may not be able to keep this.
#![forbid(future_incompatible)]
#![forbid(unsafe_code)]
#![allow(unknown_lints)] // for old compilers
#![warn(
Expand Down

0 comments on commit 85ca8db

Please sign in to comment.