summaryrefslogtreecommitdiff
path: root/tests/struct_unaligned.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/struct_unaligned.rs')
-rw-r--r--tests/struct_unaligned.rs25
1 files changed, 22 insertions, 3 deletions
diff --git a/tests/struct_unaligned.rs b/tests/struct_unaligned.rs
index e843a0c..a7db432 100644
--- a/tests/struct_unaligned.rs
+++ b/tests/struct_unaligned.rs
@@ -1,6 +1,10 @@
-// Copyright 2019 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
+// Copyright 2019 The Fuchsia Authors
+//
+// Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
+// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
+// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
+// This file may not be copied, modified, or distributed except according to
+// those terms.
#![allow(warnings)]
@@ -79,3 +83,18 @@ struct TypeParams<'a, T: ?Sized, I: Iterator> {
assert_impl_all!(TypeParams<'static, (), IntoIter<()>>: Unaligned);
assert_impl_all!(TypeParams<'static, u8, IntoIter<()>>: Unaligned);
assert_impl_all!(TypeParams<'static, [u8], IntoIter<()>>: Unaligned);
+
+// Deriving `Unaligned` should work if the struct has bounded parameters.
+
+#[derive(Unaligned)]
+#[repr(transparent)]
+struct WithParams<'a: 'b, 'b: 'a, const N: usize, T: 'a + 'b + Unaligned>(
+ [T; N],
+ PhantomData<&'a &'b ()>,
+)
+where
+ 'a: 'b,
+ 'b: 'a,
+ T: 'a + 'b + Unaligned;
+
+assert_impl_all!(WithParams<'static, 'static, 42, u8>: Unaligned);