Sha256: 7bc4979b3f9cadc4784afd821ea1c0670fe987a842627f9bb4406b248c5c6ce4

Contents?: true

Size: 915 Bytes

Versions: 20

Compression:

Stored size: 915 Bytes

Contents

// 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.

#![allow(warnings)]

mod util;

use {core::marker::PhantomData, static_assertions::assert_impl_all, zerocopy::KnownLayout};

#[derive(KnownLayout)]
enum Foo {
    A,
}

assert_impl_all!(Foo: KnownLayout);

#[derive(KnownLayout)]
enum Bar {
    A = 0,
}

assert_impl_all!(Bar: KnownLayout);

#[derive(KnownLayout)]
enum Baz {
    A = 1,
    B = 0,
}

assert_impl_all!(Baz: KnownLayout);

// Deriving `KnownLayout` should work if the enum has bounded parameters.

#[derive(KnownLayout)]
#[repr(C)]
enum WithParams<'a: 'b, 'b: 'a, const N: usize, T: 'a + 'b + KnownLayout>
where
    'a: 'b,
    'b: 'a,
    T: 'a + 'b + KnownLayout,
{
    Variant([T; N], PhantomData<&'a &'b ()>),
}

assert_impl_all!(WithParams<'static, 'static, 42, u8>: KnownLayout);

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
wasmtime-30.0.2 ./ext/cargo-vendor/zerocopy-derive-0.7.35/tests/enum_known_layout.rs
wasmtime-29.0.0 ./ext/cargo-vendor/zerocopy-derive-0.7.35/tests/enum_known_layout.rs
wasmtime-28.0.0 ./ext/cargo-vendor/zerocopy-derive-0.7.35/tests/enum_known_layout.rs
wasmtime-27.0.0 ./ext/cargo-vendor/zerocopy-derive-0.7.35/tests/enum_known_layout.rs
wasmtime-26.0.0 ./ext/cargo-vendor/zerocopy-derive-0.7.35/tests/enum_known_layout.rs
wasmtime-25.0.2 ./ext/cargo-vendor/zerocopy-derive-0.7.35/tests/enum_known_layout.rs
wasmtime-25.0.1 ./ext/cargo-vendor/zerocopy-derive-0.7.35/tests/enum_known_layout.rs
wasmtime-25.0.0 ./ext/cargo-vendor/zerocopy-derive-0.7.35/tests/enum_known_layout.rs
wasmtime-24.0.0 ./ext/cargo-vendor/zerocopy-derive-0.7.35/tests/enum_known_layout.rs
wasmtime-23.0.2 ./ext/cargo-vendor/zerocopy-derive-0.7.32/tests/enum_known_layout.rs
wasmtime-22.0.0 ./ext/cargo-vendor/zerocopy-derive-0.7.32/tests/enum_known_layout.rs
wasmtime-21.0.1 ./ext/cargo-vendor/zerocopy-derive-0.7.32/tests/enum_known_layout.rs
wasmtime-20.0.2 ./ext/cargo-vendor/zerocopy-derive-0.7.32/tests/enum_known_layout.rs
wasmtime-20.0.0 ./ext/cargo-vendor/zerocopy-derive-0.7.32/tests/enum_known_layout.rs
wasmtime-18.0.3 ./ext/cargo-vendor/zerocopy-derive-0.7.32/tests/enum_known_layout.rs
wasmtime-17.0.1 ./ext/cargo-vendor/zerocopy-derive-0.7.32/tests/enum_known_layout.rs
wasmtime-17.0.0 ./ext/cargo-vendor/zerocopy-derive-0.7.32/tests/enum_known_layout.rs
wasmtime-16.0.0 ./ext/cargo-vendor/zerocopy-derive-0.7.32/tests/enum_known_layout.rs
wasmtime-15.0.1 ./ext/cargo-vendor/zerocopy-derive-0.7.32/tests/enum_known_layout.rs
wasmtime-15.0.0 ./ext/cargo-vendor/zerocopy-derive-0.7.32/tests/enum_known_layout.rs