diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:32 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:32 +0000 |
commit | 4547b622d8d29df964fa2914213088b148c498fc (patch) | |
tree | 9fc6b25f3c3add6b745be9a2400a6e96140046e9 /vendor/derive_more/tests/generics.rs | |
parent | Releasing progress-linux version 1.66.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-4547b622d8d29df964fa2914213088b148c498fc.tar.xz rustc-4547b622d8d29df964fa2914213088b148c498fc.zip |
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/derive_more/tests/generics.rs')
-rw-r--r-- | vendor/derive_more/tests/generics.rs | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/vendor/derive_more/tests/generics.rs b/vendor/derive_more/tests/generics.rs new file mode 100644 index 000000000..17af5f397 --- /dev/null +++ b/vendor/derive_more/tests/generics.rs @@ -0,0 +1,123 @@ +#![allow(dead_code, non_camel_case_types)] +#[macro_use] +extern crate derive_more; + +#[derive( + From, + FromStr, + Display, + Index, + Not, + Add, + Mul, + Sum, + IndexMut, + AddAssign, + MulAssign, + Deref, + DerefMut, + IntoIterator, + Constructor +)] +#[deref(forward)] +#[deref_mut(forward)] +#[into_iterator(owned, ref, ref_mut)] +struct Wrapped<T: Clone>(T); + +#[derive(Deref, DerefMut)] +struct Wrapped2<T: Clone>(T); + +#[derive(From, Not, Add, Mul, AddAssign, MulAssign, Constructor, Sum)] +struct WrappedDouble<T: Clone, U: Clone>(T, U); + +#[derive(From)] +#[from(forward)] +struct WrappedDouble2<T: Clone, U: Clone>(T, U); + +#[cfg(feature = "nightly")] +#[derive( + From, + FromStr, + Display, + Index, + Not, + Add, + Mul, + Sum, + IndexMut, + AddAssign, + MulAssign, + Deref, + DerefMut, + IntoIterator, + Constructor +)] +struct WrappedWithConst<T, const C: u32>(T); + +#[derive( + From, + FromStr, + Display, + Index, + Not, + Add, + Mul, + IndexMut, + AddAssign, + MulAssign, + Deref, + DerefMut, + IntoIterator, + Constructor, + Sum +)] +#[deref(forward)] +#[deref_mut(forward)] +#[into_iterator(owned, ref, ref_mut)] +struct Struct<T: Clone> { + t: T, +} + +#[derive(Deref, DerefMut)] +struct Struct2<T: Clone> { + t: T, +} + +#[derive(From, Not, Add, Mul, AddAssign, MulAssign, Constructor, Sum)] +struct DoubleStruct<T: Clone, U: Clone> { + t: T, + u: U, +} + +#[derive(From)] +#[from(forward)] +struct DoubleStruct2<T: Clone, U: Clone> { + t: T, + u: U, +} + +#[derive(From, Not, Add)] +enum TupleEnum<T: Clone, U: Clone> { + Tuple(T), + DoubleTuple(T, U), +} + +#[derive(From)] +#[from(forward)] +enum TupleEnum2<T: Clone, U: Clone, X: Clone> { + DoubleTuple(T, U), + TripleTuple(T, U, X), +} + +#[derive(From, Not, Add)] +enum StructEnum<T: Clone, U: Clone> { + Struct { t: T }, + DoubleStruct { t: T, u: U }, +} + +#[derive(From)] +#[from(forward)] +enum StructEnum2<T: Clone, U: Clone, X: Clone> { + DoubleStruct { t: T, u: U }, + TripleStruct { t: T, u: U, x: X }, +} |