about summary refs log tree commit diff
path: root/tests/ui/feature-gates/feature-gate-unsafe_fields.rs
blob: 8f9b411df46916631e82c12352cf5f321b96e863 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//@ compile-flags: --crate-type=lib
//@ revisions: with_gate without_gate
//@ [with_gate] check-pass

#![cfg_attr(with_gate, feature(unsafe_fields))] //[with_gate]~ WARNING

#[cfg(any())]
struct Foo {
    unsafe field: (), //[without_gate]~ ERROR
}

// This should not parse as an unsafe field definition.
struct FooTuple(unsafe fn());

#[cfg(any())]
enum Bar {
    Variant { unsafe field: () }, //[without_gate]~ ERROR
    // This should not parse as an unsafe field definition.
    VariantTuple(unsafe fn()),
}

#[cfg(any())]
union Baz {
    unsafe field: (), //[without_gate]~ ERROR
}