about summary refs log tree commit diff
path: root/tests/ui/layout/invalid-unsized-const-eval.rs
blob: 94fa6449e670d22a7470f1075c0b84b0ea742287 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// issue: #124182

//! This test used to trip an assertion in const eval, because `layout_of(LazyLock)`
//! returned `Ok` with an unsized layout when a sized layout was expected.
//! It was fixed by making `layout_of` always return `Err` for types that
//! contain unsized fields in unexpected locations.

struct LazyLock {
    data: (dyn Sync, ()), //~ ERROR the size for values of type
}

static EMPTY_SET: LazyLock = todo!();
//~^ ERROR the type `(dyn Sync, ())` has an unknown layout

fn main() {}