summaryrefslogtreecommitdiff
path: root/tests/struct_from_zeroes.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/struct_from_zeroes.rs')
-rw-r--r--tests/struct_from_zeroes.rs25
1 files changed, 22 insertions, 3 deletions
diff --git a/tests/struct_from_zeroes.rs b/tests/struct_from_zeroes.rs
index e9609d1..75d8245 100644
--- a/tests/struct_from_zeroes.rs
+++ b/tests/struct_from_zeroes.rs
@@ -1,6 +1,10 @@
-// Copyright 2022 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)]
@@ -56,3 +60,18 @@ struct TypeParams<'a, T: ?Sized, I: Iterator> {
assert_impl_all!(TypeParams<'static, (), IntoIter<()>>: FromZeroes);
assert_impl_all!(TypeParams<'static, AU16, IntoIter<()>>: FromZeroes);
assert_impl_all!(TypeParams<'static, [AU16], IntoIter<()>>: FromZeroes);
+
+// Deriving `FromZeroes` should work if the struct has bounded parameters.
+
+#[derive(FromZeroes)]
+#[repr(transparent)]
+struct WithParams<'a: 'b, 'b: 'a, const N: usize, T: 'a + 'b + FromZeroes>(
+ [T; N],
+ PhantomData<&'a &'b ()>,
+)
+where
+ 'a: 'b,
+ 'b: 'a,
+ T: 'a + 'b + FromZeroes;
+
+assert_impl_all!(WithParams<'static, 'static, 42, u8>: FromZeroes);