From 2872f1eae2e22fbc7106cceef86827be804e6255 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sat, 27 Feb 2021 17:09:13 +0900 Subject: [PATCH] Prepare for removal of safe_packed_borrows lint --- src/lib.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 1bde524..1457b41 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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. // @@ -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)*)?