Skip to content

Commit

Permalink
Prepare for removal of safe_packed_borrows lint
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Feb 27, 2021
1 parent 1aa88e9 commit 2872f1e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,8 @@ 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
// #[forbid(safe_packed_borrows)] makes sure that doing this without
// Taking a reference to a packed field is unsafe, and appplying
// #[forbid(unaligned_references)] makes sure that doing this without
// an 'unsafe' block (which we deliberately do not generate)
// is a hard error.
//
Expand All @@ -601,7 +601,14 @@ macro_rules! __pin_project_internal {
// a much nicer error above.
//
// See /~https://github.com/taiki-e/pin-project/pull/34 for more details.
#[forbid(safe_packed_borrows)]
//
// Lint-based tricks aren't perfect, but they're much better than nothing:
// /~https://github.com/taiki-e/pin-project-lite/issues/26
//
// TODO: Enable both lint as unaligned_references does not exist in older compilers.
// However, for now, disable safe_packed_borrows to see if unaligned_references is working.
// #[forbid(safe_packed_borrows)]
#[forbid(unaligned_references)]
fn __assert_not_repr_packed <$($impl_generics)*> (this: &$ident <$($ty_generics)*>)
$(where
$($where_clause)*)?
Expand Down

0 comments on commit 2872f1e

Please sign in to comment.